<commit_before>#!/usr/bin/env python
#
# Simple POP3 relaying proxy with message filtering
#
# The idea is for this to act as much as possible as a transparent proxy,
# but for it also to be able to hide messages from the client if they have
# certain properties - eg. are MS Exchange Calendar requests

from Kamaelia.Chassis.Graphline import Graphline
from Kamaelia.Chassis.ConnectedServer import SimpleServer
from Kamaelia.Internet.TCPClient import TCPClient

from Axon.Component import component
from Axon.Ipc import shutdownMicroprocess, producerFinished

from Caching import SimpleCache

import time
import re
import sys

PROXYSERVER_PORT=20110
POP3SERVER_NAME="localhost"
POP3SERVER_PORT=10110

PERSISTENCE_STORE_FILENAME="uidls.cache"

CRLF="\x0d\x0a"
    
OK = re.compile("^[+]OK([ ]+.*|)$")    # match an OK msg
ERR = re.compile("^[-]ERR([ ]+.*|)$")  # match an ERR msg


class Pop3CommandRelay(component):
    Inboxes = {
      "inbox"   : "Commands from client",
      "control" : "Shutdown signalling from client",
    
      "fromServer"       : "",
      "fromServerSignal" : "",<commit_msg>Put uidl cache into /tmp<commit_after>#!/usr/bin/env python
#
# Simple POP3 relaying proxy with message filtering
#
# The idea is for this to act as much as possible as a transparent proxy,
# but for it also to be able to hide messages from the client if they have
# certain properties - eg. are MS Exchange Calendar requests

from Kamaelia.Chassis.Graphline import Graphline
from Kamaelia.Chassis.ConnectedServer import SimpleServer
from Kamaelia.Internet.TCPClient import TCPClient

from Axon.Component import component
from Axon.Ipc import shutdownMicroprocess, producerFinished

from Caching import SimpleCache

import time
import re
import sys

PROXYSERVER_PORT=20110
POP3SERVER_NAME="localhost"
POP3SERVER_PORT=10110

PERSISTENCE_STORE_FILENAME="/tmp/pop3proxy.uidls.cache"

CRLF="\x0d\x0a"
    
OK = re.compile("^[+]OK([ ]+.*|)$")    # match an OK msg
ERR = re.compile("^[-]ERR([ ]+.*|)$")  # match an ERR msg


class Pop3CommandRelay(component):
    Inboxes = {
      "inbox"   : "Commands from client",
      "control" : "Shutdown signalling from client",
    
      "fromServer"       : "",
      "fromServerSignal" : "",
{'fraction_non_alphanumeric': 0.09928443649373882, 'fraction_numerical': 0.014758497316636851, 'mean_word_length': 4.214452214452215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '953135', 'n_tokens_mistral': 731, 'n_tokens_neox': 694, 'n_words': 224}