src/0000755000175000017500000000000012074647476011200 5ustar dererkdererksrc/torchat.py0000666000175000017500000000622111714662540013210 0ustar dererkdererk#!/usr/bin/env python # -*- coding: UTF-8 -*- # vim: set sw=4 sts=4 expandtab: ############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # This program is licensed under the GNU General Public License V3, # # the full source code is included in the binary distribution. # # # # Included in the distribution are files from other open source projects: # # - TOR Onion Router (c) The Tor Project, 3-clause-BSD # # - SocksiPy (c) Dan Haim, BSD Style License # # - Gajim buddy status icons (c) The Gajim Team, GNU GPL # # # ############################################################################## import config import wxversion if config.isMac(): if wxversion.checkInstalled('2.9'): wxversion.select('2.9') # For Mac it is tweaked and optimized with 2.9 else: print "(1) wxPython-2.9 is not installed" else: try: if wxversion.checkInstalled('2.8'): wxversion.select('2.8') # On MSW and GTK we stick with 2.8 for now else: print "(1) wxPython-2.8 is not installed" except: # continue anyways. # in the pyinstaller binary wxversion can screw up and throw exceptions # so we ignore the error and just use the wx that happens to be available. # TODO: Does this still happen since we now use checkInstalled()? print "(2) wxversion screwed up, this is harmless, ignoring it." import wx import os import tc_client import tc_gui def main(): print "(2) wxPython version %s" % wx.version() #create the mandatory wx application object if config.isMac(): import tc_mac app = tc_mac.App(redirect=False) else: app = wx.App(redirect=False) #test for availability of our listening port interface = config.get("client", "listen_interface") port = config.getint("client", "listen_port") print "(1) opening TorChat listener on %s:%s" % (interface, port) listen_socket = tc_client.tryBindPort(interface, port) if not listen_socket: print "(1) %s:%s is already in use" % (interface, port) wx.MessageBox(tc_gui.lang.D_WARN_USED_PORT_MESSAGE % (interface, port), tc_gui.lang.D_WARN_USED_PORT_TITLE) return else: print "(1) TorChat is listening on %s:%s" % (interface, port) #now continue with normal program startup print "(1) start initializing main window" app.mw = tc_gui.MainWindow(listen_socket) app.SetTopWindow(app.mw) print "(1) main window initialized" print "(1) entering main loop" app.MainLoop() if __name__ == "__main__": try: main() except KeyboardInterrupt: tc_client.stopPortableTor() src/changelog.txt0000666000175000017500000001706512025157354013670 0ustar dererkdererkversion 0.9.9.553 - fix (regression) buddy context menu not working - windows: update the bundled tor.exe to current stable version 0.2.2.39 version 0.9.9.552 - added Italian translation (thanks to HostFat) - improve/update polish translation (thanks to Szary Czlowiek) - add ability to copy TorChat ID to clipboard - fix foreground colour of hint windows and notification windows to always match current desktop theme - fix problems with permissions in the profile folder - fix regression: don't create a new tor.sh file every time - windows: update the bundled tor.exe to current stable version 0.2.2.37 version 0.9.9.551 - Added Swedish translation (thanks to Åke Engelbrektson) - Windows: update the bundled tor.exe to current stable version 0.2.2.35 version 0.9.9.550 - fix some string encoding problems (and crashes) with non-ascii user names or folder names. - Unix/Linux: make data folder and file permissions more restrictive - Windows: update the bundled tor.exe to current stable version 0.2.2.34 version 0.9.9.534 - Windows: fix old scroll bug which reappeared on Windows 7 - added Russian translation version 0.9.9.530 - fix some focus and focus-stealing problems - improve the way the standard browser is found - fix race condition in the GUI resulting in the same line sent twice - Windows: update bundled Tor binary to version 0.2.1.30 version 0.9.9.515 - fix (regression): make notification window stay on top again - fix wrong handling of new line characters in chat messages - make main window always come to front when unhiding from tray version 0.9.9.509 - fixed the focus stealing of the notification window on Windows - made the notofication window less obtrusive, more native looking and make it immediately disappear on mouse contact. - made the animation of the popup faster and look more natural. - additional notification methods: knotify, gtknotify, growlnotify, xosd - Mac OSX: more Mac conforming UI with menu bar - Windows: use stable Tor-0.2.1.29 instead of experimental 0.2.2.20-alpha - updated french translation - remove annoying popup warning about debug log, we even allow logging of conversations now so this is only consequent. version 0.9.9.458 - fixed crash that could happen while torchat was minimized to the tray version 0.9.9.453 - fixed connection handshake: timeout for unanswered outgoing connections version 0.9.9.449 - speed up the wiping of deleted files and not freeze the GUI while doing it version 0.9.9.425 - (security) wipe temporary files and sent offline messages before deleting - (security) properly sanitize incoming file names - profile text and avatar (will be shown when mouse over buddy in list) - enable the logging for individual buddies and show backlog in opened window - make the splitter in the chat window movable - remember and restore window sizes - fix receiving of very small files (sometimes got stuck at 0%) - fix the annoying "list item -1" error on windows once and for all (hopefully) - allow sending files to offline buddies (will wait until connect, then send) - allow dropping of files directly to a buddy in the buddy list - remove some CPU hogging in the GUI, also removed annoying flickering - configurable fonts and colors (in the .ini file, no GUI config yet) - configurable branding ("Ask Bernd" name and ID can now be pre-configured in torchat.ini for easier adaption to different usage scenarios) version 0.9.9.328 - fixed a flaw in the PING-PONG-sequence, where pong messages went missing and got stuck in the middle of the handshake, this fix now dramatically increases connection speed - fix error in Bulgarian translation version 0.9.9.324 - (windows) updated tor.exe to version 0.2.2.20-alpha - fixed crash bug on Ubuntu Karmic and later - fixed a possible race condition when incoming connection detected (not critical and happens only once a week, but still annoying) - check incoming ping sender address for length and allowed characters - make the .deb package allow more different python versions (2.5 .. 2.7) - added some more logging - added Bulgarian translation version 0.9.9.292 - prevent possible MITM attack by better verifying incoming pong messages - prevent possible attack by disallowing most incoming messages on the outgoing connections (only file messages are allowed) - make it work with Python 2.7.1 - (windows) use current version of Tor.exe (0.2.2.19-alpha) - (windows) changed build process to use pyinstaller instead of py2exe - added chinese translation version 0.9.9.277 - fix (regression): non ascii characters in messages and filenames - fix (regression): sending files on win98 immediately disconnected buddy - added hungarian translation version 0.9.9.269 - implemented drag 'n' drop file transfer - "edit contact" in chat window context menu - "send file" in chat window context menu - "quit" in main popup menu - meaningful titles for file open and save dialogs - removed the "bitmap not found" errors - the program now runs on Windows 98 SE - added polish translation - fixed issue 19: Enter-Key inserted newline before sending - fixed issue 20: Ask before overwriting files - fixed issue 27: indication of messages in main window - fixed: find application data folder on windows 98 - fixed: don't open two chat windows for the same buddy - detect second instance on same port - allow multiple profiles (for permanent installation) - zero configuration now also on *ix platforms - implemented (experimental) debian package version 0.9.9.191 - implemented configuration dialog - added german translation - added (partial) dutch translation - added (partial) french translation - let the user specify a path for temporary files, change the default to be the data directory (the torchat folder in portable mode) version 0.9.9.149 - remove the annoying permanent flicker of the buddy list - show own hostname in windows and taskbar icon - option to start up with hidden main window (only taskbar icon) - option to open new chat windows hidden (taskbar icon flashing instead) - show list of unread (hidden) windows when right click on taskbar icon - show buddy status in chat window icon - show list of unread (hidden) windows in taskbar icon tooltip - ask before exiting when there are unread messages - show message with timestamp when delayed messages have been sent version 0.9.9.140 - incompatible protocol change! (adding and removing buddies) - implemented offline messages - implemented logging - bugfix: possible race condition when opening 2 chat windows in a short time - bugfix: allow non-ascii characters in buddy name - bugfix: a buddy can now be removed from the list - bugfix: prevent possible DoS attack through faked "ping" messages - bugfix: wrong initialization of buddy list window didn't work on Mac version 0.9.9.109 - bugfix: if /tmp was on a separate partition, file receiving was broken - bugfix: show correct buddy status immediately after connect - new connection attempts and keep-alives now in random intervals - implemented configuration file - included some (unfinished) documentation version 0.9.9.98 - bugfix: allow non ascii characters in filenames version 0.9.9.96 - bugfix: fixes slow connection in 0.9.9.95 version 0.9.9.95 - notification popups and flashing symbols in taskbar - file transfers can recover from connection breakdowns version 0.9.9.85 - time stamps in chat window - fixed: Messages may now contain newline characters - file transfer versions up to 0.9.9.64 - basic messaging functionality - first really stable version src/tc_notification.py0000666000175000017500000001445511726672052014732 0ustar dererkdererkimport wx import config import os import subprocess import threading import time import textwrap # notification_method = gtknotify # # should be available when GTK+ is installed def notificationWindow_gtknotify(mw, name, text, buddy): import pynotify import cgi if not pynotify.is_initted(): if not pynotify.init('torchat'): raise Exception('gtknotify not supported') pynotify.Notification( cgi.escape(name).encode('ascii', 'xmlcharrefreplace'), cgi.escape(text).encode('ascii', 'xmlcharrefreplace') ).show() # notification_method = knotify # # works with KDE4 (maybe somebody could tell me # how to make this work with KDE3 also) def notificationWindow_knotify(mw, name, text, buddy): import dbus knotify = dbus.SessionBus().get_object("org.kde.knotify", "/Notify") knotify.event('warning', 'kde', [], name, text, [], [], 0, 0, dbus_interface='org.kde.KNotify') # notification_method = growlnotify # # this is meant for Mac OS X where growl is used by many # other apps. You need to have growl and growlnotify def notificationWindow_growlnotify(mw, name, text, buddy): # This seems to fail about half the time # iconpath = os.path.join(config.ICON_DIR, "torchat.png") #args = ['growlnotify', '-m', text, '--image', iconpath] text = "%s\n\n%s" % (name, text) args = ['growlnotify', '-m', text] subprocess.Popen(args).communicate() # notification_method = xosd # # this needs python-osd installed on the system # and works only on the X Window System def notificationWindow_xosd(mw, name, text, buddy): NotificationWindowXosd(mw, name, text, buddy).start() class NotificationWindowXosd(threading.Thread): def __init__(self, mw, name, text, buddy): threading.Thread.__init__(self) self.name = name.encode("utf-8") self.text = text.encode("utf-8") def run(self): import pyosd text = "%s\n%s" % (self.name, self.text) text_lines = textwrap.fill(text, 40).split(os.linesep) osd = pyosd.osd(lines=len(text_lines), shadow=2, colour="#FFFF00") line_number = 0 for text_line in text_lines: osd.display(text_line, line=line_number) line_number += 1 time.sleep(3) # notification_method = generic # # this is the default and works everywhere def notificationWindow_generic(mw, name, text, buddy): NotificationWindowGeneric(mw, name, text, buddy) class NotificationWindowGeneric(wx.Frame): def __init__(self, mw, name, text, buddy): wx.Frame.__init__(self, mw, style=wx.FRAME_NO_TASKBAR | wx.NO_BORDER | wx.STAY_ON_TOP) self.panel = wx.Panel(self, style=wx.SIMPLE_BORDER) self.panel.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOBK)) sizer = wx.BoxSizer() self.panel.SetSizer(sizer) if buddy.profile_avatar_object <> None: bitmap = buddy.profile_avatar_object else: bitmap = wx.Bitmap(os.path.join(config.ICON_DIR, "torchat.png"), wx.BITMAP_TYPE_PNG) static_image = wx.StaticBitmap(self.panel, -1, bitmap) sizer.Add(static_image, 0, wx.ALL, 5 ) self.label = wx.StaticText(self.panel) self.label.SetForegroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOTEXT)) self.label.SetLabel("%s\n\n%s" % (name, text)) sizer.Add(self.label, 0, wx.ALL, 5 ) wsizer = wx.BoxSizer() wsizer.Add(self.panel, 0, wx.ALL, 0) self.SetSizerAndFit(wsizer) self.Layout() # initialize animation cx, cy, maxx, maxy = wx.ClientDisplayRect() self.w, self.h = self.GetSize() self.x_end = maxx - self.w - 20 self.y_end = maxy - self.h - 20 self.x_pos = -self.w self.y_pos = self.y_end self.phase = 0 self.SetPosition((self.x_pos, self.y_pos)) # the following will prevent the focus # stealing on windows self.Disable() self.Show() self.Enable() self.timer = wx.Timer(self, -1) self.Bind(wx.EVT_TIMER, self.onTimer) # start animation self.timer.Start(10, True) def onTimer(self, evt): if self.phase == 0: if self.x_pos < self.x_end: # move right and restart timer speed = ((self.x_end - self.x_pos) ^ 2) / 10 self.x_pos += (1 + speed) self.SetPosition((self.x_pos, self.y_pos)) self.timer.Start(10, True) return else: # we are at the right border. # now switch phase and wait a bit self.phase = 1 self.timer.Start(3000, True) # and from now on we also close on mouse contact self.panel.Bind(wx.EVT_MOUSE_EVENTS, self.onMouse) return if self.phase == 1: if self.y_pos > -self.h: # move upwards and restart timer speed = ((self.y_end - self.y_pos) ^ 2) / 10 self.y_pos -= (5 + speed) self.SetPosition((self.x_pos, self.y_pos)) self.timer.Start(10, True) return else: # we reached the end of the animation self.Hide() self.Destroy() def onMouse(self, evt): # restart the timer to immediately end the waiting self.timer.Start(10, True) def notificationWindow(mw, name, text, buddy): method = config.get('gui', 'notification_method') try: function = globals()["notificationWindow_%s" % method] except: print "(1) notification method '%s' is not implemented, falling back to 'generic'." % method notificationWindow_generic(mw, name, text, buddy) return try: function(mw, name, text, buddy) except: print "(1) exception while using notification method '%s'" % method print "(1) falling back to 'generic'. Traceback follows:" config.tb() notificationWindow_generic(mw, name, text, buddy) # vim: set tw=0 sts=4 sw=4 expandtab: src/tc_client.py0000666000175000017500000025040011746115560013510 0ustar dererkdererk# -*- coding: UTF-8 -*- ############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # This program is licensed under the GNU General Public License V3, # # the full source code is included in the binary distribution. # # # # Included in the distribution are files from other open source projects: # # - TOR Onion Router (c) The Tor Project, 3-clause-BSD # # - SocksiPy (c) Dan Haim, BSD Style License # # - Gajim buddy status icons (c) The Gajim Team, GNU GPL # # # ############################################################################## # This is the TorChat client library. Import this module, make an instance # of BuddyList, give it your call-back function and your client is running. import SocksiPy.socks as socks import socket import threading import random import time import sys import os import shutil import subprocess import tempfile import hashlib import config import version TORCHAT_PORT = 11009 #do NOT change this. TOR_CONFIG = "tor" #the name of the active section in the .ini file STATUS_OFFLINE = 0 STATUS_HANDSHAKE = 1 STATUS_ONLINE = 2 STATUS_AWAY = 3 STATUS_XA = 4 CB_TYPE_CHAT = 1 CB_TYPE_FILE = 2 CB_TYPE_OFFLINE_SENT = 3 CB_TYPE_STATUS = 4 CB_TYPE_LIST_CHANGED = 5 CB_TYPE_AVATAR = 6 CB_TYPE_PROFILE = 7 CB_TYPE_REMOVE = 8 tb = config.tb # the traceback function has moved to config tb1 = config.tb1 tor_pid = None tor_proc = None tor_timer = None def splitLine(text): """split a line of text on the first space character and return two strings, the first word and the remaining string. This is used for parsing the incoming messages from left to right since the command and its arguments are all delimited by spaces and the command may not contain spaces""" sp = text.split(" ") try: a = sp[0] b = " ".join(sp[1:]) except: a = text b = "" return a, b def encodeLF(blob): """takes a string of 8 bit binary data and encodes it so that there are no 0x0a (LF) bytes anymore""" # first we get all '\' out of the way by encoding each # backslash '\' as the character sequence '\/' # so there will not remain any '\n' sequence anymore, # and then we can safely encode every 0x0a as '\n'. # # Please do not rant in the source code comments of your # own protocol implementations about how "suboptimal" my # decision was, actally I spent quite some time thinking # about it in the early design phase and this solution is # pragmatic, easy to implement and rock solid. # # Also please do not suggest alternative encodings like # bandwidth wasting base64, there is NO NEED for it, # TorChat is NOT a text based protocol in the common # sense, we are transmitting binary data over 8-bit-clean # sockets. We don't have to fit them into RFC confoming # message bodies of SMTP or NNTP messages, print them # line by line on a terminal or a printer or anything # else that would interpret control characters. The # only special character in this protocol is the message # delimiter which I chose to be 0x0a and because 0x0a is # often referred to as "newline" I call the chunks of # encoded data between them "lines" and each "line" is # representing exactly one protocol message. # # The first word of each line will be the command and # may only consist of [a..z] or underscore, see the # individual message classes for detailed descriptions. return blob.replace("\\", "\\/").replace("\n", "\\n") def decodeLF(line): """takes the line as it comes from the socket and decodes it to the original binary data contained in a string of bytes""" return line.replace("\\n", "\n").replace("\\/", "\\") def createTemporaryFile(file_name): if config.getint("files", "temp_files_in_data_dir"): dir = config.getDataDir() else: dir = config.get("files", "temp_files_custom_dir") try: if dir == "": dir = None tmp = tempfile.mkstemp("_" + file_name, "torchat_incoming_", dir) except: print "(1) could not create temporary file in %s" % dir tb() print "(1) trying system temporary folder" tmp = tempfile.mkstemp("_" + file_name, "torchat_incoming_") fd, file_name_tmp = tmp file_handle_tmp = os.fdopen(fd, "w+b") os.chmod(file_name_tmp, 0600) print "(2) created temporary file %s" % file_name_tmp return (file_name_tmp, file_handle_tmp) class WipeFileThread(threading.Thread): """This wipes a file in a separate thread because wiping a file is a long running task and we don't want to freeze parts of the application. This is only called by the function wipeFile(). Call the function wipeFile() if you want to wipe a file.""" def __init__(self, file_name): threading.Thread.__init__(self) self.file_name = file_name self.start() def run(self): BLOCK_SIZE = 8192 print "(2) wiping %s" % self.file_name if os.path.exists(self.file_name): try: handle = open(self.file_name, mode="r+b") handle.seek(0, 2) #SEEK_END size = handle.tell() handle.seek(0) blocks = size / BLOCK_SIZE + 1 for i in range(blocks): handle.write(os.urandom(BLOCK_SIZE)) print "(2) sync to disk" handle.flush() os.fsync(handle.fileno()) handle.close() print "(2) unlinking wiped file" os.unlink(self.file_name) except: print "(0) could not wipe file %s (file is locked or wrong permissions)" % self.file_name else: print "(2) file %s does not exist" % self.file_name def wipeFile(file_name): """Wipe a file by first overwriting it with random data, synching it to disk and finally unlinking it. For this purpose it will start a separat thread to do this in the background and return immediately.""" WipeFileThread(file_name) #--- ### Client API class Buddy(object): """Represets a buddy. Every buddy on the buddy list will have sich an instance created directly after program start and also every new connection from unknown addresses will result in the instantiation of a new buddy object when a valid ping message has been processed. All Buddy objects are maintained by and contained in the BuddyList object""" def __init__(self, address, buddy_list, name=u"", temporary=False): assert isinstance(buddy_list, BuddyList) #type hint for PyDev print "(2) initializing buddy %s, temporary=%s" % (address, temporary) self.bl = buddy_list self.address = address self.name = name self.profile_name = u"" self.profile_text = u"" self.profile_avatar_data = "" # uncompressed 64*64*24 bit RGB. self.profile_avatar_data_alpha = "" # uncompressed 64*64*8 bit alpha. (optional) self.profile_avatar_object = None # tc_gui.py will cache a wx.Bitmap here, tc_client will not touch this self.random1 = str(random.getrandbits(256)) self.random2 = str(random.getrandbits(256)) self.conn_out = None self.conn_in = None self.status = STATUS_OFFLINE self.client = "" self.version = "" self.timer = False self.last_status_time = 0 self.count_failed_connects = 0 self.count_unanswered_pings = 0 self.active = True self.temporary = temporary self.startTimer() def connect(self): print "(2) %s.connect()" % self.address if self.conn_out == None: self.conn_out = OutConnection(self.address + ".onion", self.bl, self) self.count_unanswered_pings = 0 self.sendPing() def isFullyConnected(self): return self.conn_in and self.conn_out and self.conn_out.pong_sent def isAlreadyPonged(self): return self.conn_out and self.conn_out.pong_sent def disconnect(self): print "(2) %s.disconnect()" % self.address if self.conn_out != None: self.conn_out.close() self.conn_out = None if self.conn_in != None: self.conn_in.close() self.conn_in = None self.onStatus(STATUS_OFFLINE) def onOutConnectionFail(self): print "(2) %s.onOutConnectionFail()" % self.address self.count_failed_connects += 1 self.startTimer() def onInConnectionFail(self): print "(2) %s.onInConnectionFail()" % self.address self.resetConnectionFailCounter() self.startTimer() def onOutConnectionSuccess(self): print "(2) %s.onOutConnectionSuccess()" % self.address self.resetConnectionFailCounter() self.count_unanswered_pings = 0 self.startTimer() def onInConnectionFound(self, connection): print "(2) %s.onInConnectionFound()" % self.address self.count_unanswered_pings = 0 conn_old = self.conn_in if conn_old == connection: print "(2) this connection is already the current conn_in. doing nothing." return self.conn_in = connection connection.buddy = self if conn_old: print "(2) closing old connection of %s, %s" % (self.address, conn_old) print "(2) new connection is %s" % connection conn_old.buddy = None conn_old.close() def resetConnectionFailCounter(self): self.count_failed_connects = 0 def setActive(self, active): print "(2) %s.setActive(%s)" % (self.address, active) self.active = active def setTemporary(self, temporary): print "(2) %s.setTemporary(%s)" % (self.address, temporary) self.temporary = temporary def onStatus(self, status): print "(2) %s.onStatus(%s)" % (self.address, status) self.last_status_time = time.time() if status <> self.status: self.status = status self.bl.gui(CB_TYPE_STATUS, self) def onProfileName(self, name): print "(2) %s.onProfile" % self.address self.profile_name = name if self.name == "" and name <> "": self.name = name self.bl.save() self.bl.gui(CB_TYPE_PROFILE, self) def onProfileText(self, text): print "(2) %s.onProfile" % self.address self.profile_text = text self.bl.gui(CB_TYPE_PROFILE, self) def onAvatarDataAlpha(self, data): print "(2) %s.onAvatarDataAplha()" % self.address # just store it, no gui callback because this is always sent first. # The next message will be the acual image data which will finally notify the GUI self.profile_avatar_data_alpha = data def onAvatarData(self, data): print "(2) %s.onAvatarData()" % self.address if data <> self.profile_avatar_data: self.profile_avatar_data = data self.bl.gui(CB_TYPE_AVATAR, self) def onChatMessage(self, message): self.bl.gui(CB_TYPE_CHAT, (self, message)) def sendChatMessage(self, text): #text must be unicode, will be encoded to UTF-8 if self.isFullyConnected(): message = ProtocolMsg_message(self, text.encode("UTF-8")) message.send() else: self.storeOfflineChatMessage(text) def getOfflineFileName(self): return os.path.join(config.getDataDir(),self.address + "_offline.txt") def storeOfflineChatMessage(self, text): #text must be unicode print "(2) storing offline message to %s" % self.address file = open(self.getOfflineFileName(), "a") file.write("[delayed] " + text.encode("UTF-8") + os.linesep) file.close() def getOfflineMessages(self): #will return the string as unicode try: file = open(self.getOfflineFileName(), "r") text = file.read().rstrip() file.close() return text.decode("UTF-8") except: return "" def sendOfflineMessages(self): #this will be called in the incoming status message #FIXME: call this from onStatus() instead, this would be the ntural place for it text = self.getOfflineMessages() if text: if self.isFullyConnected(): wipeFile(self.getOfflineFileName()) print "(2) sending offline messages to %s" % self.address #we send it without checking online status. because we have sent #a pong before, the receiver will have set the status to online. #text is unicode, so we must encode it to UTF-8 again. message = ProtocolMsg_message(self, text.encode("UTF-8")) message.send() self.bl.gui(CB_TYPE_OFFLINE_SENT, self) else: print "(2) could not send offline messages, not fully connected." pass def getDisplayNameOrAddress(self): if self.name == "": return self.address else: return self.name def getAddressAndDisplayName(self): if self.name == "": return self.address else: return self.address + " (" + self.name + ")" def sendFile(self, filename, gui_callback): sender = FileSender(self, filename, gui_callback) return sender def startTimer(self): if not self.active: print "(2) %s is not active. Will not start a new timer" % self.address return if self.status == STATUS_OFFLINE: if self.count_failed_connects < 10: t = random.randrange(50, 150) / 10.0 else: if self.count_failed_connects < 20: t = random.randrange(300, 400) else: # more than an hour. The other one will ping us if it comes # online which will immediately connect and reset the counting t = random.randrange(5000, 6000) print "(2) %s had %i failed connections. Setting timer to %f seconds" \ % (self.address, self.count_failed_connects, t) else: #whenever we are connected to someone we use a fixed timer. #otherwise we would create a unique pattern of activity #over time that could be identified at the other side if self.status == STATUS_HANDSHAKE: # ping more agressively during handshake # to trigger more connect back attempts there t = config.KEEPALIVE_INTERVAL / 4 else: # when fully connected we can slow down to normal t = config.KEEPALIVE_INTERVAL if self.timer: self.timer.cancel() self.timer = threading.Timer(t, self.onTimer) self.timer.start() def onTimer(self): print "(2) %s.onTimer()" % self.address if not self.active: print "(2) %s is not active, onTimer() won't do anything" % self.address return self.keepAlive() #only restart the timer automatically if we are connected (or handshaking). #else it will be restarted by outConnectionFail() / outConnectionSuccess() if self.status != STATUS_OFFLINE: self.startTimer() def keepAlive(self): print "(2) %s.keepAlive()" % self.address if self.conn_out == None: self.connect() else: if self.conn_in: self.sendStatus() else: # still waiting for return connection if self.count_unanswered_pings < config.MAX_UNANSWERED_PINGS: self.sendPing() print "(2) unanswered pings to %s so far: %i" % (self.address, self.count_unanswered_pings) else: # maybe this will help print "(2) too many unanswered pings to %s on same connection" % self.address self.disconnect() def sendPing(self): print "(2) PING >>> %s" % self.address #self.random1 = str(random.getrandbits(256)) ping = ProtocolMsg_ping(self, (config.get("client","own_hostname"), self.random1)) ping.send() self.count_unanswered_pings += 1 def sendStatus(self): if self.isAlreadyPonged(): status = "" if self.bl.own_status == STATUS_ONLINE: status = "available" if self.bl.own_status == STATUS_AWAY: status = "away" if self.bl.own_status == STATUS_XA: status = "xa" if status != "": print "(2) %s.sendStatus(): sending %s" % (self.address, status) msg = ProtocolMsg_status(self, status) msg.send() else: print "(2) %s.sendStatus(): not connected, not sending" % self.address def sendProfile(self): if self.isAlreadyPonged(): print "(2) %s.sendProfile()" % self.address # this message is optional name = config.get("profile", "name") if name <> "": msg = ProtocolMsg_profile_name(self, name.encode("UTF-8")) msg.send() # this message is optional text = config.get("profile", "text") if text <> "": msg = ProtocolMsg_profile_text(self, text.encode("UTF-8")) msg.send() def sendAvatar(self, send_empty=False): if self.isAlreadyPonged(): print "(2) %s.sendAvatar()" % self.address # the GUI has put our own avatar into the BuddyList object, ready for sending. # avatar is optional but if sent then both messages must be in the following order: if self.bl.own_avatar_data or send_empty: # alpha might be empty (0 bytes) but we must always send it. data = self.bl.own_avatar_data_alpha msg = ProtocolMsg_profile_avatar_alpha(self, data) #send raw binary data msg.send() data = self.bl.own_avatar_data msg = ProtocolMsg_profile_avatar(self, data) #send raw binary data msg.send() else: print "(2) we have no avatar, sending nothing" else: print "(2) %s.sendAvatar(): not connected, not sending avatar" % self.address def sendAddMe(self): if self.isAlreadyPonged(): msg = ProtocolMsg_add_me(self) msg.send() else: print "(2) not connected, not sending add_me to %s" % self.address def sendRemoveMe(self): if self.isFullyConnected(): msg = ProtocolMsg_remove_me(self) msg.send() else: print "(2) not connected, not sending remove_me to %s" % self.address def sendVersion(self): if self.isAlreadyPonged(): msg = ProtocolMsg_client(self, version.NAME) msg.send() msg = ProtocolMsg_version(self, version.VERSION) msg.send() else: print "(2) not connected, not sending version to %s" % self.address def getDisplayName(self): if self.name != "": line = "%s (%s)" % (self.address, self.name) else: line = self.address return line class BuddyList(object): """the BuddyList object is the central API of the client. Initializing it will start the client, load and initialize all Buddy objects on the buddy list, etc. It does much more than only maintaining the buddies, it also maintains a bunch of other objects like for example the FileSender and FileReceiver objects for currrently running file transfers etc. BuddyList actually represents the whole client functionality and controls everything else. The GUI will instantiate a BuddyList object and this is all it needs to do in order to start the client and access all functionality""" def __init__(self, callback, socket=None): print "(1) initializing buddy list" self.gui = callback startPortableTor() self.file_sender = {} self.file_receiver = {} #temporary buddies, created from incoming pings with new hostnames #these buddies are not yet in the list and if they do not #answer and authenticate on the first try they will be deleted self.incoming_buddies = [] self.listener = Listener(self, socket) self.own_status = STATUS_ONLINE filename = os.path.join(config.getDataDir(), "buddy-list.txt") #create empty buddy list file if it does not already exist f = open(filename, "a") f.close() f = open(filename, "r") l = f.read().replace("\r", "\n").replace("\n\n", "\n").split("\n") f.close self.list = [] for line in l: line = line.rstrip().decode("UTF-8") if len(line) > 15: address = line[0:16] if len(line) > 17: name = line[17:] else: name = u"" buddy = Buddy(address, self, name) self.list.append(buddy) found = False for buddy in self.list: if buddy.address == config.get("client", "own_hostname"): found = True self.own_buddy = buddy break if not found: print "(1) adding own hostname %s to list" % config.get("client", "own_hostname") if config.get("client", "own_hostname") != "0000000000000000": self.own_buddy = Buddy(config.get("client", "own_hostname"), self, "myself") self.addBuddy(self.own_buddy) # the own avatar is set by the GUI. # Only the GUI knows how to deal with graphics, so we just # provide these variables, if the GUI puts the 64*64*24 RGB bitmaps # here and an optional alpha channel 64*64*8 and then it will be # transmitted as it is. tc_client.py will not interpret or convert it, # only transmit and receive this raw data and notify the GUI self.own_avatar_data = "" self.own_avatar_data_alpha = "" print "(1) BuddList initialized" def save(self): f = open(os.path.join(config.getDataDir(), "buddy-list.txt"), "w") for buddy in self.list: line = ("%s %s\r\n" % (buddy.address, buddy.name.rstrip())).encode("UTF-8") f.write(line) f.close() print "(2) buddy list saved" # this is the optimal spot to notify the GUI to redraw the list self.gui(CB_TYPE_LIST_CHANGED, None) def logMyselfMessage(self, msg): self.own_buddy.onChatMessage("*** %s" % msg) def addBuddy(self, buddy): if self.getBuddyFromAddress(buddy.address) == None: self.list.append(buddy) buddy.setTemporary(False) buddy.setActive(True) if buddy in self.incoming_buddies: self.incoming_buddies.remove(buddy) self.save() buddy.keepAlive() return buddy else: return False def removeBuddy(self, buddy_to_remove, disconnect=True): print "(2) removeBuddy(%s, %s)" % (buddy_to_remove.address, disconnect) self.gui(CB_TYPE_REMOVE, buddy_to_remove) buddy_to_remove.setActive(False) if not disconnect: # send remove_me and leave the connections open # but remove them from this buddy. # the connections will be closed by the other buddy # or if the timeout for unused connections occurs buddy_to_remove.sendRemoveMe() if buddy_to_remove.conn_out: buddy_to_remove.conn_out.buddy = None buddy_to_remove.conn_out = None if buddy_to_remove.conn_in: buddy_to_remove.conn_in.buddy = None buddy_to_remove.conn_in = None else: buddy_to_remove.disconnect() self.list.remove(buddy_to_remove) file_name = buddy_to_remove.getOfflineFileName() try: wipeFile(file_name) except: pass self.save() def removeBuddyWithAddress(self, address): buddy = self.getBuddyFromAddress(address) if buddy != None: self.removeBuddy(buddy) def getBuddyFromAddress(self, address): for buddy in self.list: if buddy.address == address: return buddy return None def getIncomingBuddyFromAddress(self, address): for buddy in self.incoming_buddies: if buddy.address == address: return buddy return None def getBuddyFromRandom(self, random): for buddy in self.list: if buddy.random1 == random: return buddy return None def getIncomingBuddyFromRandom(self, random): for buddy in self.incoming_buddies: if buddy.random1 == random: return buddy return None def getFileReceiver(self, address, id): try: return self.file_receiver[address, id] except: return None def getFileSender(self, address, id): try: return self.file_sender[address, id] except: return None def setStatus(self, status): self.own_status = status for buddy in self.list: buddy.sendStatus() def onErrorIn(self, connection): for buddy in self.incoming_buddies: if buddy.conn_in == connection: print "(2) in-connection %s of temporary buddy %s failed" % (connection, buddy.address) print "(2) removing buddy instance %s" % buddy.address buddy.setActive(False) buddy.disconnect() if buddy in self.incoming_buddies: self.incoming_buddies.remove(buddy) break for buddy in self.list: if buddy.conn_in == connection: buddy.disconnect() buddy.onInConnectionFail() break def onErrorOut(self, connection): buddy = connection.buddy if buddy: if buddy.temporary: print "(2) out-connection of temporary buddy %s failed" % buddy.address print "(2) removing buddy instance %s" % buddy.address buddy.setActive(False) if buddy in self.incoming_buddies: self.incoming_buddies.remove(buddy) buddy.disconnect() buddy.onOutConnectionFail() else: print "(2) out-connection without buddy failed" def onConnected(self, connection): connection.buddy.onStatus(STATUS_HANDSHAKE) connection.buddy.onOutConnectionSuccess() def stopClient(self): stopPortableTor() for buddy in self.list + self.incoming_buddies: buddy.disconnect() self.listener.close() #FIXME: does this really work? class FileSender(threading.Thread): def __init__(self, buddy, file_name, callback): threading.Thread.__init__(self) self.buddy = buddy self.bl = buddy.bl self.file_name = file_name self.file_name_short = os.path.basename(self.file_name) self.gui = callback self.id = str(random.getrandbits(32)) self.buddy.bl.file_sender[self.buddy.address, self.id] = self self.file_size = 0 self.block_size = 8192 self.blocks_wait = 16 self.start_ok = -1 self.restart_at = 0 self.restart_flag = False self.completed = False self.timeout_count = 0 self.start() def testTimeout(self): #this will be called every 0.1 seconds whenever the sender #is waiting for confirmation messages. Either in the #sendBlocks() loop or when all blocks are sent in the #outer loop in run() #if a timeout is detected then the restart flag will be set if self.buddy.isFullyConnected(): #we only increase timeout if we are connected #otherwise other mechanisms are responsible and trying #to get us connected again and we just wait self.timeout_count += 1 else: self.timeout_count = 0 if self.timeout_count == 6000: #ten minutes without filedata_ok new_start = self.start_ok + self.block_size self.restart(new_start) #enforce a new connection try: self.buddy.disconnect() except: pass print "(2) timeout file sender restart at %i" % new_start def canGoOn(self, start): position_ok = self.start_ok + self.blocks_wait * self.block_size if not self.running or self.restart_flag: return True else: return position_ok > start def sendBlocks(self, first): blocks = int(self.file_size / self.block_size) + 1 print "(2) FileSender now entering inner loop, starting at block #%i, last block in file #%i" \ % (first, blocks - 1) #the inner loop (of the two loops for i in range(blocks): start = i * self.block_size #jump over already sent blocks if start >= first: remaining = self.file_size - start if remaining > self.block_size: size = self.block_size else: size = remaining self.file_handle.seek(start) data = self.file_handle.read(size) hash = hashlib.md5(data).hexdigest() #we can only send data if we are connected while not self.buddy.isFullyConnected() and not self.restart_flag: time.sleep(0.1) self.testTimeout() # the message is sent over conn_in msg = ProtocolMsg_filedata(self.buddy.conn_in, (self.id, start, hash, data)) msg.send() #wait for confirmations more than blocks_wait behind while not self.canGoOn(start): time.sleep(0.1) self.testTimeout() #this can trigger the restart flag if self.restart_flag: #the outer loop in run() will start us again print "(2) FileSender restart_flag, breaking innner loop" break if not self.running: #the outer loop in run() will also end print "(2) FileSender not running, breaking innner loop" break print "(2) FileSender inner loop ended, last sent block: #%i, last block in file #%i" % (i, blocks-1) def run(self): self.running = True try: self.file_handle = open(self.file_name, mode="rb") self.file_handle.seek(0, 2) #SEEK_END self.file_size = self.file_handle.tell() self.gui(self.file_size, 0) filename_utf8 = self.file_name_short.encode("utf-8") if not self.buddy.isFullyConnected(): print "(2) file transfer waiting for connection" self.gui(self.file_size, 0, "waiting for connection") # self.running will be set to false when the user hits "cancel" # wait for connection to start file transfer while self.running and not self.buddy.isFullyConnected(): time.sleep(1) # user could have aborted while waiting in the loop above if self.running: print "(2) sending 'filename' message" self.gui(self.file_size, 0, "starting transfer") msg = ProtocolMsg_filename(self.buddy.conn_in, (self.id, self.file_size, self.block_size, filename_utf8)) msg.send() #the outer loop (of the two sender loops) #runs forever until completed ore canceled while self.running and not self.completed: print "(2) FileSender now at start of retry loop" self.restart_flag = False #(re)start the inner loop self.sendBlocks(self.restart_at) #wait for *last* filedata_ok or restart flag while self.running and not self.completed and not self.restart_flag: time.sleep(0.1) self.testTimeout() #this can trigger the restart flag if self.running: print "(2) FileSender, retry loop ended because of success" else: print "(2) FileSender, retry loop ended because of cancel" self.running = False self.file_handle.close() except: # haven't seen this happening yet self.gui(self.file_size, -1, "error") self.close() tb() def receivedOK(self, start): self.timeout_count = 0 # we have received a sign of life end = start + self.block_size if end > self.file_size: end = self.file_size try: self.gui(self.file_size, end) except: #cannot update gui tb() self.close() self.start_ok = start if end == self.file_size: #the outer sender loop can now stop waiting for timeout self.gui(self.file_size, end, "transfer complete") self.completed = True def restart(self, start): #trigger the reatart flag self.timeout_count = 0 self.restart_at = start self.restart_flag = True #the inner loop will now immediately break and #the outer loop will start it again at position restart_at def sendStopMessage(self): msg = ProtocolMsg_file_stop_receiving(self.buddy, self.id) msg.send() def close(self): if self.running: self.running = False self.sendStopMessage() try: self.gui(self.file_size, -1, "transfer aborted") except: pass del self.buddy.bl.file_sender[self.buddy.address, self.id] class FileReceiver(object): # ths will be instantiated automatically on an incoming file transfer. # it will then notify the GUI which will open a window and give us a callback to interact def __init__(self, buddy, id, block_size, file_size, file_name): self.buddy = buddy self.id = id self.closed = False self.block_size = block_size self.file_name = file_name self.file_name_save = "" tmp = createTemporaryFile(self.file_name) self.file_name_tmp, self.file_handle_tmp = tmp print "(2) FileReceiver: created temp file: %s" % self.file_name_tmp self.file_size = file_size self.next_start = 0 self.wrong_block_number_count = 0 self.buddy.bl.file_receiver[self.buddy.address, self.id] = self #this will (MUST) point to the file transfer GUI callback self.gui = None #the following will result in a call into the GUI #the GUI will then give us a callback function print "(2) FileReceiver: notifying GUI about new file transfer" self.buddy.bl.gui(CB_TYPE_FILE, self) #we cannot receive without a GUI (or other piece of code #that provides the callback) because this other code #(usually the GUI) will decide what to do with the file #and will be responsible to close this FileReceiver object #again after it is done. #therefore now we wait for the callback #function to be provided before we continue. #It CANNOT get stuck in this loop unless the GUI #code is broken. The GUI WILL provide this callback! while self.gui == None: time.sleep(0.1) print "(2) FileReceiver: attached GUI seems ready, initialization done" def setCallbackFunction(self, callback): # this must be called from the GUI # to set the callback function so we can notify # the GUI about the progress (or errors) self.gui = callback def data(self, start, hash, data): if self.closed: # ignore still incoming data blocks # for already aborted transfers print "(2) ignoring incoming file data block for canceled receiver" return if start > self.next_start: if self.wrong_block_number_count == 0: #not on every single out-of-order block in a row #we must send an error message... msg = ProtocolMsg_filedata_error(self.buddy, (self.id, self.next_start)) msg.send() self.wrong_block_number_count += 1 #...only every 16 #FIXME: This must be solved more elegantly if self.wrong_block_number_count == 16: self.wrong_block_number_count = 0 return self.wrong_block_number_count = 0 hash2 = hashlib.md5(data).hexdigest() if hash == hash2: self.file_handle_tmp.seek(start) self.file_handle_tmp.write(data) self.next_start = start + len(data) msg = ProtocolMsg_filedata_ok(self.buddy, (self.id, start)) msg.send() self.gui(self.file_size, start + len(data)) else: print "(3) receiver wrong hash %i len: %i" % (start, len(data)) msg = ProtocolMsg_filedata_error(self, (self.id, start)) msg.send() #we try to avoid unnecessary wrong-block-number errors #the next block sure will be out of order, but we have sent #an error already because of the wrong hash self.wrong_block_number_count = 1 def setFileNameSave(self, file_name_save): self.file_name_save = file_name_save try: self.file_handle_save = open(file_name_save, "w") print "(2) created and opened placeholder file %s" % self.file_name_save except: self.file_handle_save = None self.file_name_save = None self.file_save_error = str(sys.exc_info()[1]) print "(2) %s could not be created: %s" % (self.file_name_save, self.file_save_error) def sendStopMessage(self): msg = ProtocolMsg_file_stop_receiving(self.buddy, self.id) msg.send() def closeForced(self): try: self.gui(self.file_size, -1, "transfer aborted") except: pass self.sendStopMessage() if self.file_name_save: self.file_handle_save.close() print "(2) unlinking empty placeholder file %s" % self.file_name_save os.unlink(self.file_name_save) #its still empty, no wiping needed self.file_name_save = "" self.close() def close(self): # this is called from the GUI (or its replacement) # therefore this FileReceiver object cannot work without # a GUI attached to it (or some other piece of code) that # properly provides and reacts to the callback function # and closes this obect after it is done # (user clicked save or whatever this GUI or GUI-replacement does) if self.closed: return try: self.closed = True self.file_handle_tmp.close() if self.file_name_save: self.file_handle_save.close() shutil.copy(self.file_name_tmp, self.file_name_save) print "(2) copied file to %s" % self.file_name_save print "(2) wiping received temporary file data" wipeFile(self.file_name_tmp) del self.buddy.bl.file_receiver[self.buddy.address, self.id] except: tb() #TODO: what could go wrong here? Why did I use try/except? #--- ### Protocol messages def ProtocolMsgFromLine(bl, conn, line): """this is the factory for producing instances of ProtocolMsg classes for incoming messages. The receiver will call this for every line it receives and then call the message's execute() method.""" # each protocol message as it is transmitted and received from the socket # is in the following form (which I call the "line") # # 0x20 # # future extensions to the protocol might define new commands # but may only consist of characters [a..z] or _ # we split it at the first space character (0x20) command, encoded = splitLine(line) # encoded is a string of encoded binary data. # The constructor will decode and parse it and we can return # a readily initialized message object. try: Msg = globals()["ProtocolMsg_%s" % command] except: Msg = ProtocolMsg return Msg(bl, conn, command, encoded) class ProtocolMsg(object): """the base class for all ProtocolMsg_* classes. All message classes must inherit from this Besides being the base class for all ProtocolMsg_* classes this class is also instantiated for every unknown incoming message. in this case execute() will simply reply with not_implemented""" def __init__(self, *args): """ this is actually a few overloaded constructors, depending on the types of argumments when receiving a message we instantiate it like this: __init__(self, bl, connection, command, encoded) when preparing a message for sending we do it like this: __init__(self, connection, blob) __init__(self, buddy, blob) blob is a string of raw binary 8 bit data, the contents of chat messages, names, texts must be UTF8 encoded""" self.bl = None self.buddy = None self.connection = None # # incoming # #__init__(self, bl, connection, command, encoded) if type(args[0]) == BuddyList: self.bl = args[0] self.connection = args[1] if self.connection: self.buddy = self.connection.buddy self.command = args[2] # decode from line format to raw binary # and then let the message parse it self.blob = decodeLF(args[3]) self.parse() # the incoming message is now properly initialized and somebody # could now call its execute() method to trigger its action return # # outgoing # #__init__(self, connection, blob) #__init__(self, buddy, blob) if type(args[0]) in [InConnection, OutConnection, Buddy]: if type(args[0]) in [InConnection, OutConnection]: self.connection = args[0] if self.connection.buddy: self.buddy = self.connection.buddy elif type(args[0]) == Buddy: self.buddy = args[0] self.connection = self.buddy.conn_out if len(args) > 1: blob = args[1] if type(blob) in [list, tuple]: self.blob = " ".join(str(part) for part in blob) else: self.blob = str(blob) else: self.blob = "" self.command = type(self).__name__[12:] def parse(self): pass def execute(self): # a generic message of this class will be automatically instantiated # if an incoming message with an unknown command is received # do nothing and just reply with "not_implemented" if self.buddy: print "(2) received unimplemented msg (%s) from %s" % (self.command, self.buddy.address) message = ProtocolMsg_not_implemented(self.buddy) message.send() else: print "(2) received unknown command on unknown connection. closing." print "(2) unknown connection had '%s' in last ping. closing" % self.connection.last_ping_address self.connection.close() def getLine(self): """return the entire message readily encoded as a string of charactrs that we can transmit over the socket, terminated by a 0x0a character""" # This is important: # The data that is transmitted over the socket (the entire contents # of one protocol message will be put into one string of bytes that # is terminated by exactly one newline character 0x0a at the end. # # This string of bytes is what I refer to as the "line" # # Therefore the entire message data (the contents of ProtocolMsg.blob) # which can contain any arbitrary byte sequence (even chat messages are # considered a blob since they are UTF-8 text with arbitrary formatting # chars) will be properly encoded for transmission in such a way that # it will not contain any 0x0a bytes anymore. # # This is implemented in the functions encodeLF() and decodeLF() # # getLine() is called right before transmitting it over the socket # to produce the "line" and the exact inverse operation on the # receiving side will happen in __init__() when a new message object # is constructed from the incoming encoded line string. return "%s %s\n" % (self.command, encodeLF(self.blob)) def send(self): """send the outgoing message""" if self.connection: self.connection.send(self.getLine()) else: print "(0) message without connection could not be sent" class ProtocolMsg_not_implemented(ProtocolMsg): """This message is sent whenever we cannot understand the command. When receiving this we currently do nothing, except logging it to the debug log""" def parse(self): self.offending_command = self.blob def execute(self): if self.buddy: print "(2) %s says it can't handle '%s'" % (self.buddy.address, self.offending_command) class ProtocolMsg_ping(ProtocolMsg): """a ping message consists of sender address and a random string (cookie). It must be answered with a pong message containing the same cookie to so that the other side can undoubtedly identify the connection""" def parse(self): self.address, self.answer = splitLine(self.blob) def isValidAddress(self): if len(self.address) <> 16: return False for c in self.address: if not c in "234567abcdefghijklmnopqrstuvwxyz": # base32 return False return True def execute(self): print "(2) <<< PING %s" % self.address #is sender a valid onion address? if not self.isValidAddress(): print "(1) ping sender '%s' not a valid onion ID. closing connection." % self.address self.connection.close() return #first a little security check to detect mass pings #with faked host names over the same connection if self.connection.last_ping_address != "": #this is not the first ping over this connection #lets see if it has the correct address: if self.address != self.connection.last_ping_address: print "(1) Possible Attack: in-connection sent fake address %s" % self.address print "(1) Will disconnect incoming connection from fake %s" % self.address self.connection.close() return else: self.connection.last_ping_address = self.address self.connection.last_ping_cookie = self.answer #another check for faked pings: we search all our already #*connected* buddies and if there is one with the same address #but another incoming connection then this one must be a fake. # # FIXME: Might this check disrupt legitimate conditions? # found = False for buddy in self.bl.list + self.bl.incoming_buddies: if buddy.conn_in: if buddy.address == self.address: if buddy.conn_in != self.connection: found = True break if found: print "(1) detected ping from %s on other connection." % self.address print "(1) last cookie %s" %buddy.conn_in.last_ping_cookie print "(1) this cookie %s" %self.answer print "(1) simply ignoring it" ## #warn the victim ## print "(1) ***** sending double connection warning to %s" %self.address ## buddy.sendAddMe() #might only be on his temporary list ## #buddy.sendChatMessage("Received more than one connection with your ID!") self.connection.send("not_implemented double connection\n") return #if someone is pinging us with our own address and the #random value is not from us, then someone is definitely #trying to fake and we can close. if self.address == config.get("client", "own_hostname"): own_buddy = self.bl.getBuddyFromAddress(self.address) if own_buddy.random1 != self.answer: print "(1) faked ping with our own address. closing" self.connection.close() #close this possibly faked incoming connection return #ping messages must be answered with pong messages #the pong must contain the same random string as the ping. #note that we will NOT yet assign buddy.conn_in #this can only be done in reaction to a pong message self.buddy = self.bl.getBuddyFromAddress(self.address) if not self.buddy: print "(2) %s is not on the buddy-list" % self.address #we have received a ping, but there is no buddy with #that address in our buddy-list. The only reason for that #can be that someone new has added our address to his list #and his client now has connected us. First we search if #we already have a connection to this buddy, if not we #create one. self.buddy = self.bl.getIncomingBuddyFromAddress(self.address) if not self.buddy: #create it and put it in the temporary list print "(2) %s is new. creating a temporary buddy instance" % self.address self.buddy = Buddy(self.address, self.bl, temporary=True) self.bl.incoming_buddies.append(self.buddy) else: print "(2) %s is already in the incoming list" % self.address print "(2) %s status is %i" % (self.address, self.buddy.status) #this ping is valid. We can now reset in-connection timeout #and also reset the out-connection fail counter because now we #assume the buddy is alive and we have a motivation to try harder again. self.connection.last_active = time.time() self.buddy.resetConnectionFailCounter() #connect if needed if not self.buddy.conn_out: self.buddy.connect() else: if not self.buddy.conn_in: #the buddie's last pong might have been lost when his first conn-out failed #so we send another ping, just to be on the safe side. self.buddy.count_unanswered_pings = 0 self.buddy.sendPing() if self.buddy.isAlreadyPonged(): #but we don't need to send more than one pong on the same conn_out #only if this is also a new conn_out because the last one failed print "(2) not sending another pong over same connection" return #now we can finally put our answer into the send queue print "(2) PONG >>> %s" % self.address answer = ProtocolMsg_pong(self.buddy, self.answer) answer.send() self.buddy.conn_out.pong_sent = True self.buddy.sendVersion() self.buddy.sendProfile() self.buddy.sendAvatar() if self.buddy in self.bl.list: self.buddy.sendAddMe() #send status as the last message because the other #client will update the GUI only after status messages self.buddy.sendStatus() class ProtocolMsg_pong(ProtocolMsg): """incoming pong messages are used to identify and authenticate incoming connections. Basically we send out pings and see which corresponding pongs come in on which connections. we search all our known buddies for the corresponding random cookie to identify which buddy is replying here.""" def parse(self): self.cookie = self.blob def execute(self): #first we search the buddy-list buddy = self.bl.getBuddyFromRandom(self.cookie) if not buddy: #we also try to find it in the temporary buddies list buddy = self.bl.getIncomingBuddyFromRandom(self.cookie) if buddy: if self.connection.last_ping_address == buddy.address: self.buddy = buddy else: #MITM protection: #this pong is an answer to a ping we have sent to a different address. #we will simply ignore this pong to make any mitm attacks that #simply try to forward original pings to other clients impossilbe print "(2) ignoring pong from %s which should have come from %s" % (self.connection.last_ping_address, buddy.address) return #if the pong is found to belong to a known buddy we can now #safely assign this incoming connection to this buddy and #regard the handshake as completed. if self.buddy: print "(2) <<< PONG %s" % self.buddy.address #assign the in-connection to this buddy self.buddy.onInConnectionFound(self.connection) else: #there is no buddy for this pong. nothing to do. print "(1) ignoring pong with unknown cookie. Sender: %s" % self.connection.last_ping_address print "(1) !!! There might be another client sending pings with OUR address!" print "(1) !!! Are we trying to run a second instance with the same ID?" class ProtocolMsg_client(ProtocolMsg): """transmits the name of the client software. Usually sent after the pong""" def parse(self): self.client = self.blob def execute(self): if self.buddy: print "(2) %s is using %s" % (self.buddy.address, self.client) self.buddy.client = self.client class ProtocolMsg_version(ProtocolMsg): """transmits the version number of the client software. Usually sent after the 'client' message""" def parse(self): self.version = self.blob def execute(self): if self.buddy: print "(2) %s has version %s" % (self.buddy.address, self.version) self.buddy.version = self.version class ProtocolMsg_status(ProtocolMsg): """transmit the status, this MUST be sent every 120 seconds or the client may trigger a timeout and close the conection. When receiving this message the client will update the status icon of the buddy, it will be transmitted after the pong upon connection, immediately on every status change or at least once every 120 seconds. Allowed values for the data are "avalable", "away", "xa", other values are not defined yet""" def parse(self): self.status = self.blob def execute(self): #set the status flag of the corresponding buddy if self.buddy: print "(3) received status %s from %s" % (self.status, self.buddy.address) #send offline messages if buddy was previously offline if self.buddy.status == STATUS_HANDSHAKE: print "(2) %s came online, sending delayed messages" % self.buddy.address self.buddy.sendOfflineMessages() #set buddy status if self.status == "available": self.buddy.onStatus(STATUS_ONLINE) if self.status == "away": self.buddy.onStatus(STATUS_AWAY) if self.status == "xa": self.buddy.onStatus(STATUS_XA) #avoid timeout of in-connection self.connection.last_active = time.time() class ProtocolMsg_profile_name(ProtocolMsg): """transmit the name that is set in the pofile (this message is optional)""" def parse(self): self.name = self.blob.decode("UTF-8") def execute(self): if self.buddy: print "(2) received name from %s" % self.buddy.address self.buddy.onProfileName(self.name) class ProtocolMsg_profile_text(ProtocolMsg): """transmit the text that is set in the pofile (this message is optional)""" def parse(self): self.text = self.blob.decode("UTF-8") def execute(self): if self.buddy: print "(2) received profile text from %s" % self.buddy.address self.buddy.onProfileText(self.text) class ProtocolMsg_profile_avatar_alpha(ProtocolMsg): """This message has to be sent BEFORE profile_avatar because only the latter one will trigger the GUI notification. It contains the uncompressed 64*64*8bit alpha channel. this message must be sent with empty data (0 bytes) if there is no alpha, it may not be omitted if you have an avatar. It CAN be omitted only if you also omit profile_avatar""" def parse(self): if len(self.blob) == 4096 or len(self.blob) == 0: self.bitmap = self.blob else: self.bitmap = None def execute(self): if self.buddy: print "(2) received avatar alpha channel from %s (%i bytes)" % (self.buddy.address, len(self.bitmap)) if self.bitmap: # the buddy obect stores the raw binary data self.buddy.onAvatarDataAlpha(self.bitmap) else: print("(1) %s sent invalid avatar alpha data (wrong size)" % self.buddy.address) self.buddy.onAvatarDataAlpha("") class ProtocolMsg_profile_avatar(ProtocolMsg): """the uncompesseed 64*64*24bit image. Avatar messages can be completely omitted but IF they are sent then the correct order is first the alpha and then this one""" def parse(self): if len(self.blob) == 12288 or len(self.blob) == 0: self.bitmap = self.blob else: self.bitmap = None def execute(self): if self.buddy: print "(2) received avatar from %s (%i bytes)" % (self.buddy.address, len(self.bitmap)) if self.bitmap: # the buddy obect stores the raw binary data self.buddy.onAvatarData(self.bitmap) else: print("(1) %s sent invalid avatar image data (wrong size)" % self.buddy.address) self.buddy.onAvatarData("") class ProtocolMsg_add_me(ProtocolMsg): """This must be sent after connection if you are (or want to be) on the other's buddy list. Since a client can also connect for the purpose of joining a chat room without automatically appearing on the buddy list this message is needed.""" def execute(self): if self.buddy: print "(2) add me from %s" % self.buddy.address if not self.buddy in self.bl.list: print "(2) received add_me from new buddy %s" % self.buddy.address self.buddy.name = self.buddy.profile_name self.bl.addBuddy(self.buddy) msg = "<- has added you" self.buddy.onChatMessage(msg) class ProtocolMsg_remove_me(ProtocolMsg): """when receiving this message the buddy MUST be removed from the buddy list (or somehow marked as removed) so that it will not automatically add itself again and cause annoyance. When removing a buddy first send this message before disconnecting or the other client will never know about it and add itself again next time""" def execute(self): if self.buddy: print "(2) received remove_me from buddy %s" % self.buddy.address if self.buddy in self.bl.list: print "(2) removing %s from list" % self.buddy.address self.bl.removeBuddy(self.buddy) else: print "(2) received 'remove_me' on unknown connection" print "(2) unknown connection had '%s' in last ping. closing" % self.connection.last_ping_address self.connection.close() class ProtocolMsg_message(ProtocolMsg): """this is a normal text message. Text is encoded UTF-8""" def parse(self): self.text = self.blob.decode("UTF-8") self.text = self.text.replace("\r\n", "\n").replace("\r", "\n").replace("\x0b", "\n").replace("\n", os.linesep) def execute(self): #give buddy and text to bl. bl will then call into the gui #to open a chat window and/or display the text. if self.buddy: if self.buddy in self.bl.list: self.buddy.onChatMessage(self.text) else: print "(1) ***** protocol violation reply to %s" % self.buddy.address msg = "This is an automatic reply." msg += "Your version might be out of date or some" msg += "other reason caused this unexpected protocol violation." msg += "Make sure you have the latest version of TorChat" msg += "and everything is configured correctly." self.buddy.sendChatMessage(msg) time.sleep(5) self.buddy.disconnect() else: print "(2) received 'message' on unknown connection" print "(2) unknown connection had '%s' in last ping. closing" % self.connection.last_ping_address self.connection.close() class ProtocolMsg_filename(ProtocolMsg): """The first message in a file transfer, initiating the transfer. Note that File transfer messages are the only messages that are allowed to be sent out on the incoming connection to avoid delaying of chat messages""" def parse(self): self.id, text = splitLine(self.blob) # each transfer has a unique ID, made up by the sender file_size, text = splitLine(text) # bytes block_size, self.file_name = splitLine(text) self.file_size = int(file_size) self.block_size = int(block_size) # the filename is tansmitted in UTF-8 encoding # so we decode the name to unicode (widestring) name = self.file_name.decode("utf-8") # remove all occurences 0x0000 name = u"".join([c for c in name if c <> "\u0000"]) # remove all path manipulations in front of the name name = os.path.basename(name) # the filename may not start with '.' # or be completely empty root, ext = os.path.splitext(name) if root == u"": root = u"unnamed" self.file_name = root + ext def execute(self): if not self.buddy: print "(2) received 'filename' on unknown connection" print "(2) unknown connection had '%s' in last ping. closing" % self.connection.last_ping_address self.connection.close() return #we create a file receiver instance which can deal with the #file data we expect to receive now. This obect will then #also notify the GUI and interact with it FileReceiver(self.buddy, self.id, self.block_size, self.file_size, self.file_name) class ProtocolMsg_filedata(ProtocolMsg): """After a filename message has initiated the transfer several filedata messagess transport the actual data in blocks of fixed size. start is the byte offset of the block in the file and hash is an md5 hash of the block used as a checksum. Each message must be answered with filedata_ok after sucessfully verifying the hash. The sender should send only a limited number of blocks ahead of incoming ok messages (for example send the 5th block only after the 1st is confirmed, the 6th only after the 2nd confirmed, etc., this number is only a wild guess and might need some tuning)""" def parse(self): self.id, text = splitLine(self.blob) start, text = splitLine(text) # block start position in bytes self.hash, self.data = splitLine(text) # md5 self.start = int(start) def execute(self): if not self.buddy: print "(2) received 'filedata' on unknown connection" print "(2) unknown connection had '%s' in last ping. closing" % self.connection.last_ping_address self.connection.close() return #there should already be a receiver, because there should have been #a "filename"-message at the very beginning of the transfer. receiver = self.bl.getFileReceiver(self.buddy.address, self.id) if receiver: receiver.data(self.start, self.hash, self.data) else: #if there is no receiver for this data, we just reply #with a stop message and hope the sender gets it and #stops sending data. Not much else to do for us here. msg = ProtocolMsg_file_stop_sending(self.buddy, self.id) msg.send() class ProtocolMsg_filedata_ok(ProtocolMsg): """Every received "filedata" must be confirmed with a "filedata_ok" (or a "filedata_error") message. A File sender will use these messages to update the sending progress bar and to know that it can send more blocks""" def parse(self): self.id, start = splitLine(self.blob) self.start = int(start) # block start position in bytes def execute(self): if self.buddy: sender = self.bl.getFileSender(self.buddy.address, self.id) if sender: sender.receivedOK(self.start) else: #there is no sender (anymore) to handle confirmation messages #so we can send a stop message to tell the other side #to stop receiving msg = ProtocolMsg_file_stop_receiving(self.buddy, self.id) msg.send() else: print "(2) received 'filedata_ok' on unknown connection" print "(2) unknown connection had '%s' in last ping. closing" % self.connection.last_ping_address self.connection.close() class ProtocolMsg_filedata_error(ProtocolMsg): """This is sent instead of filedata_ok when the hash was wrong or the block start was later than what we would have expected (entire blocks have been skipped/lost due to temporary disconnect). A file sender must react to this message by restarting the file transmission at the offset given in start. A file receiver will send this message whenever it wants the the transfer restart at a certain position.""" def parse(self): self.id, start = splitLine(self.blob) self.start = int(start) # block start position in bytes def execute(self): if self.buddy: sender = self.bl.getFileSender(self.buddy.address, self.id) if sender: sender.restart(self.start) else: msg = ProtocolMsg_file_stop_receiving(self.buddy, self.id) msg.send() else: print "(2) received 'filedata_error' on unknown connection" print "(2) unknown connection had '%s' in last ping. closing" % self.connection.last_ping_address self.connection.close() class ProtocolMsg_file_stop_sending(ProtocolMsg): """A file receiver sends this to make the file sender stop sending, a file sender must react to this message by stopping the file sending, the GUI should notify the user that the receiver has canceled. This message usually occurs when a file receiver clicks the cancel button""" def parse(self): self.id = self.blob def execute(self): if self.buddy: sender = self.bl.getFileSender(self.buddy.address, self.id) if sender: #close the sender (if not already closed) #otherwise just ignore it sender.close() else: print "(2) received 'file_stop_sending' on unknown connection" print "(2) unknown connection had '%s' in last ping. closing" % self.connection.last_ping_address self.connection.close() class ProtocolMsg_file_stop_receiving(ProtocolMsg): """A file sender sends this message to tell the file receiver that the transfer has been canceled. A file receiver when receiving this message must stop waiting for further blocks, no further messages regarding the same transfer can be expected after this, all allocated resources regarding this transfer can be freed, incomplete temp files should be wiped and the user notified about the cancel.""" def parse(self): self.id = self.blob def execute(self): if self.buddy: receiver = self.bl.getFileReceiver(self.buddy.address, self.id) if receiver: #close the receiver (if not already closed) #otherwise just ignore it receiver.closeForced() else: print "(2) received 'file_stop_receiving' on unknown connection" print "(2) unknown connection had '%s' in last ping. closing" % self.connection.last_ping_address self.connection.close() #--- ### Low level network stuff class Receiver(threading.Thread): def __init__(self, conn, is_incoming=False): threading.Thread.__init__(self) self.conn = conn self.is_incoming = is_incoming self.socket = conn.socket self.running = True self.start() def run(self): readbuffer = "" #self.socket.settimeout(5) while self.running: try: recv = self.socket.recv(4096) if recv != "": readbuffer = readbuffer + recv temp = readbuffer.split("\n") readbuffer = temp.pop() for line in temp: if self.running: try: # on outgoing connections we do not allow any # incoming messages other than file* # this prevents an attacker from messaging # or sending commands before the handshake is # completed or pong on the wrong connection if (self.is_incoming or line[:4] == "file"): message = ProtocolMsgFromLine(self.conn.bl, self.conn, line) message.execute() else: # this is an outgoing connection. Incoming protocol messages are ignored print "(1) received unexpected '%s' on outgoing connection to %s" % (line, self.conn.buddy.address) except: tb() else: self.running = False self.conn.onReceiverError() except socket.timeout: self.running = False self.conn.onReceiverError() except socket.error: self.running = False self.conn.onReceiverError() class InConnection(object): def __init__(self, socket, buddy_list): self.buddy = None self.bl = buddy_list self.socket = socket self.last_ping_address = "" #used to detect mass pings with fake adresses self.last_ping_cookie = "" #used to detect pings with fake cookies self.last_active = time.time() self.started = True self.receiver = Receiver(self, True) def send(self, text): try: self.socket.send(text) except: tb() print "(2) in-connection send error." self.bl.onErrorIn(self) self.close() def onReceiverError(self): if self.buddy: addr = self.buddy.address else: addr = self.last_ping_address + " (unverified)" print "(2) in-connection receive error: %s" % addr self.bl.onErrorIn(self) self.close() def close(self): print "(2) in-connection closing %s" % self.last_ping_address try: self.socket.shutdown(socket.SHUT_RDWR) except: print "(3) socket.shutdown() %s" % sys.exc_info()[1] try: self.socket.close() except: print "(3) socket.close() %s" % sys.exc_info()[1] self.started = False if self in self.bl.listener.conns: self.bl.listener.conns.remove(self) if self.buddy: self.buddy.conn_in = None class OutConnection(threading.Thread): def __init__(self, address, buddy_list, buddy): threading.Thread.__init__(self) self.bl = buddy_list self.buddy = buddy self.address = address self.pong_sent = False self.send_buffer = [] self.start() def run(self): self.running = True try: self.socket = socks.socksocket() self.socket.setproxy(socks.PROXY_TYPE_SOCKS4, config.get(TOR_CONFIG, "tor_server"), config.getint(TOR_CONFIG, "tor_server_socks_port")) print "(2) trying to connect '%s'" % self.address self.socket.connect((str(self.address), TORCHAT_PORT)) print "(2) connected to %s" % self.address self.bl.onConnected(self) self.receiver = Receiver(self, False) # this Receiver will only accept file* messages while self.running: while len(self.send_buffer) > 0: text = self.send_buffer.pop(0) try: print "(2) %s out-connection sending buffer" % self.address self.socket.send(text) except: print "(2) out-connection send error" self.bl.onErrorOut(self) self.close() time.sleep(0.2) except: print "(2) out-connection to %s failed: %s" % (self.address, sys.exc_info()[1]) self.bl.onErrorOut(self) self.close() def send(self, text): self.send_buffer.append(text) def onReceiverError(self): print "(2) out-connection receiver error" self.bl.onErrorOut(self) self.close() def close(self): self.running = False self.send_buffer = [] try: self.socket.shutdown(socket.SHUT_RDWR) except: print "(3) socket.shutdown() %s" % sys.exc_info()[1] try: self.socket.close() except: print "(3) socket.close() %s" % sys.exc_info()[1] if self.buddy: self.buddy.conn_out = None print "(2) out-connection closed (%s)" % self.buddy.address else: print "(2) out connection without buddy closed" # happens after removeBudddy() class Listener(threading.Thread): def __init__(self, buddy_list, socket=None): threading.Thread.__init__(self) self.buddy_list = buddy_list self.conns = [] self.socket = socket self.start() self.startTimer() def run(self): self.running = True if not self.socket: interface = config.get("client", "listen_interface") port = config.getint("client", "listen_port") self.socket = tryBindPort(interface, port) self.socket.listen(5) while self.running: try: conn, address = self.socket.accept() self.conns.append(InConnection(conn, self.buddy_list)) print "(2) new incoming connection" print "(2) have now %i incoming connections" % len(self.conns) except: print "socket listener error!" tb() self.running = False def close(self): self.running = False try: print "(2) closing listening socket %s:%s" \ % (config.get("client", "listen_interface"), config.get("client", "listen_port")) self.socket.close() print "(2) success" except: print "(2) closing socket failed, traceback follows:" tb() def startTimer(self): self.timer = threading.Timer(30, self.onTimer) self.timer.start() def onTimer(self): for conn in self.conns: if time.time() - conn.last_active > config.DEAD_CONNECTION_TIMEOUT: if conn.buddy: print "(2) conn_in timeout: disconnecting %s" % conn.buddy.address conn.buddy.disconnect() else: print "(2) closing unused in-connection from %s" % conn.last_ping_address conn.close() if conn in self.conns: self.conns.remove(conn) print "(2) have now %i incoming connections" % len(self.conns) self.startTimer() def tryBindPort(interface, port): try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind((interface, port)) s.listen(5) return s except: tb() return False def startPortableTor(): print "(1) entering function startPortableTor()" global tor_in, tor_out global TOR_CONFIG global tor_pid global tor_proc old_dir = os.getcwd() print "(1) current working directory is %s" % os.getcwd() try: print "(1) changing working directory" os.chdir(config.getDataDir()) os.chdir("Tor") print "(1) current working directory is %s" % os.getcwd() # completely remove all cache files from the previous run #for root, dirs, files in os.walk("tor_data", topdown=False): # for name in files: # os.remove(os.path.join(root, name)) # for name in dirs: # os.rmdir(os.path.join(root, name)) # now start tor with the supplied config file print "(1) trying to start Tor" if config.isWindows(): if os.path.exists("tor.exe"): #start the process without opening a console window startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= 1 #STARTF_USESHOWWINDOW tor_proc = subprocess.Popen("tor.exe -f torrc.txt".split(), startupinfo=startupinfo) tor_pid = tor_proc.pid else: print "(1) there is no portable tor.exe" tor_pid = False else: if os.path.exists("tor.sh"): #let our shell script start a tor instance os.system("chmod 0700 tor.sh") tor_proc = subprocess.Popen("./tor.sh".split()) tor_pid = tor_proc.pid print "(1) tor pid is %i" % tor_pid else: print "(1) there is no Tor starter script (tor.sh)" tor_pid = False if tor_pid: #tor = subprocess.Popen("tor.exe -f torrc.txt".split(), creationflags=0x08000000) print "(1) successfully started Tor (pid=%i)" % tor_pid # we now assume the existence of our hostname file # it WILL be created after the first start # if not, something must be totally wrong. cnt = 0 found = False while cnt <= 20: try: print "(1) trying to read hostname file (try %i of 20)" % (cnt + 1) f = open(os.path.join("hidden_service", "hostname"), "r") hostname = f.read().rstrip()[:-6] print "(1) found hostname: %s" % hostname print "(1) writing own_hostname to torchat.ini" config.set("client", "own_hostname", hostname) found = True f.close() break except: # we wait 20 seconds for the file to appear time.sleep(1) cnt += 1 if not found: print "(0) very strange: portable tor started but hostname could not be read" print "(0) will use section [tor] and not [tor_portable]" else: #in portable mode we run Tor on some non-standard ports: #so we switch to the other set of config-options print "(1) switching active config section from [tor] to [tor_portable]" TOR_CONFIG = "tor_portable" #start the timer that will periodically check that tor is still running startPortableTorTimer() else: print "(1) no own Tor instance. Settings in [tor] will be used" except: print "(1) an error occured while starting tor, see traceback:" tb(1) print "(1) changing working directory back to %s" % old_dir os.chdir(old_dir) print "(1) current working directory is %s" % os.getcwd() def stopPortableTor(): if not tor_pid: return else: print "(1) tor has pid %i, terminating." % tor_pid config.killProcess(tor_pid) def startPortableTorTimer(): global tor_timer tor_timer = threading.Timer(10, onPortableTorTimer) tor_timer.start() def onPortableTorTimer(): if tor_proc.poll() != None: print "(1) Tor stopped running. Will restart it now" startPortableTor() else: startPortableTorTimer() src/LICENSE0000666000175000017500000012341611714662540012205 0ustar dererkdererk############################################################################# # License for TorChat (see below for licenses of other included files) # ############################################################################# Copyright (c) 2007..2010 Bernd Kreuss TorChat is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. TorChat is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ~~~*~~~ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ############################################################################# # License for Tor # ############################################################################# This file contains the license for Tor, a free software project to provide anonymity on the Internet. It also lists the licenses for other components used by Tor. For more information about Tor, see http://www.torproject.org/. If you got this file as a part of a larger bundle, there may be other license terms that you should be aware of. =============================================================================== Tor is distributed under this license: Copyright (c) 2001-2004, Roger Dingledine Copyright (c) 2004-2007, Roger Dingledine, Nick Mathewson Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the names of the copyright owners nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =============================================================================== src/common/strlcat.c and src/common/strlcpy.c by Todd C. Miller are licensed under the following license: * Copyright (c) 1998 Todd C. Miller * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =============================================================================== If you got Tor as a static binary with OpenSSL included, then you should know: "This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/)" =============================================================================== ############################################################################# # License for SocksiPy # ############################################################################# Copyright 2006 Dan-Haim. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of Dan Haim nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY DAN HAIM "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAN HAIM OR HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMANGE. src/torchat_windows.spec0000666000175000017500000000077511714662540015274 0ustar dererkdererk# -*- mode: python -*- import os a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'), os.path.join(HOMEPATH,'support\\useUnicode.py'), 'torchat.py'], pathex=['.']) pyz = PYZ(a.pure) exe = EXE( pyz, a.scripts, a.binaries, a.zipfiles, a.datas, name=os.path.join('dist', 'torchat.exe'), debug=False, strip=False, upx=True, console=False, icon='icons\\torchat.ico' ) src/tc_gui.py0000666000175000017500000021643512023126730013016 0ustar dererkdererk# -*- coding: UTF-8 -*- ############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # This program is licensed under the GNU General Public License V3, # # the full source code is included in the binary distribution. # # # # Included in the distribution are files from other open source projects: # # - TOR Onion Router (c) The Tor Project, 3-clause-BSD # # - SocksiPy (c) Dan Haim, BSD Style License # # - Gajim buddy status icons (c) The Gajim Team, GNU GPL # # # ############################################################################## # this is a graphical User interface for the TorChat client library. import config import wx import tc_client import sys import os import shutil import time import subprocess import textwrap import version import dlg_settings import translations import tc_notification lang = translations.lang_en tb = config.tb tb1 = config.tb1 ICON_NAMES = {tc_client.STATUS_OFFLINE : "offline.png", tc_client.STATUS_ONLINE : "online.png", tc_client.STATUS_HANDSHAKE : "connecting.png", tc_client.STATUS_AWAY : "away.png", tc_client.STATUS_XA : "xa.png"} _icon_images = {} #this is a cache for getStatusBitmap() def getStatusBitmap(status): global _icon_images if not status in _icon_images: image = wx.Image(os.path.join(config.ICON_DIR, ICON_NAMES[status]), wx.BITMAP_TYPE_PNG) image.ConvertAlphaToMask() _icon_images[status] = image bitmap = _icon_images[status].ConvertToBitmap() return bitmap class TaskbarIcon(wx.TaskBarIcon): def __init__(self, main_window): wx.TaskBarIcon.__init__(self) self.mw = main_window #load event icon img = wx.Image(os.path.join(config.ICON_DIR, "event.png")) img.ConvertAlphaToMask() self.event_icon = wx.IconFromBitmap(img.ConvertToBitmap()) self.showStatus(self.mw.buddy_list.own_status) self.timer = wx.Timer(self, -1) self.blink_phase = False self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.onLeftClick) self.Bind(wx.EVT_TIMER, self.onTimer) def showEvent(self): self.SetIcon(self.event_icon, self.getToolTipText()) def showStatus(self, status): icon = wx.IconFromBitmap(getStatusBitmap(status)) self.SetIcon(icon, self.getToolTipText()) def onLeftClick(self, evt): self.mw.Show(not self.mw.IsShown()) if self.mw.IsShown(): self.mw.Iconize(False) # never show it minimized (can happen on KDE) #bring it to the front self.mw.SetFocus() self.mw.SetWindowStyle(self.mw.GetWindowStyle() | wx.STAY_ON_TOP) self.mw.SetWindowStyle(self.mw.GetWindowStyle() & ~wx.STAY_ON_TOP) def CreatePopupMenu(self): return TaskbarMenu(self.mw) def getToolTipText(self): text = "TorChat: %s" % config.getProfileLongName() for window in self.mw.chat_windows: if not window.IsShown(): text += os.linesep + window.getTitleShort() return text def blink(self, start=True): if start: self.timer.Start(500, False) else: self.timer.Stop() self.showStatus(self.mw.buddy_list.own_status) def onTimer(self, evt): self.blink_phase = not self.blink_phase if self.blink_phase: self.showStatus(self.mw.buddy_list.own_status) else: self.showEvent() #stop blinking, if there are no more hidden windows found = False for window in self.mw.chat_windows: if not window.IsShown(): found = True break if not found: self.blink(False) class TaskbarMenu(wx.Menu): def __init__(self, main_window): wx.Menu.__init__(self) self.mw = main_window self.mw.taskbar_icon.blink(False) # show/hide item = wx.MenuItem(self, wx.NewId(), lang.MTB_SHOW_HIDE_TORCHAT) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onShowHide, item) self.AppendSeparator() # (hidden) chat windows cnt = 0 self.wnd = {} for window in self.mw.chat_windows: if not window.IsShown(): id = wx.NewId() self.wnd[id] = window item = wx.MenuItem(self, id, window.getTitleShort()) item.SetBitmap(getStatusBitmap(window.buddy.status)) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onChatWindow, item) cnt += 1 if cnt: self.AppendSeparator() # edit profile item = wx.MenuItem(self, wx.NewId(), lang.MPOP_EDIT_MY_PROFILE) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onProfile, item) # status item = wx.MenuItem(self, wx.NewId(), lang.ST_AVAILABLE) item.SetBitmap(getStatusBitmap(tc_client.STATUS_ONLINE)) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onAvailable, item) item = wx.MenuItem(self, wx.NewId(), lang.ST_AWAY) item.SetBitmap(getStatusBitmap(tc_client.STATUS_AWAY)) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onAway, item) item = wx.MenuItem(self, wx.NewId(), lang.ST_EXTENDED_AWAY) item.SetBitmap(getStatusBitmap(tc_client.STATUS_XA)) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onXA, item) self.AppendSeparator() # quit item = wx.MenuItem(self, wx.NewId(), lang.MTB_QUIT) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onExit, item) def onShowHide(self, evt): self.mw.taskbar_icon.onLeftClick(evt) def onChatWindow(self, evt): self.wnd[evt.GetId()].Show() #force update of the tooltip text (window list) self.mw.taskbar_icon.showStatus(self.mw.buddy_list.own_status) def onExit(self, evt): self.mw.exitProgram() def onAvailable(self, evt): self.mw.status_switch.setStatus(tc_client.STATUS_ONLINE) def onAway(self, evt): self.mw.status_switch.setStatus(tc_client.STATUS_AWAY) def onXA(self, evt): self.mw.status_switch.setStatus(tc_client.STATUS_XA) def onProfile(self, evt): dialog = DlgEditProfile(self.mw, self.mw) dialog.ShowModal() class PopupMenu(wx.Menu): def __init__(self, main_window, type): wx.Menu.__init__(self) self.mw = main_window # options for buddy if type == "contact": self.buddy = self.mw.gui_bl.getSelectedBuddy() item = wx.MenuItem(self, wx.NewId(), lang.MPOP_CHAT) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.mw.gui_bl.onDClick, item) item = wx.MenuItem(self, wx.NewId(), lang.MPOP_SEND_FILE) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onSendFile, item) if self.buddy.getOfflineMessages(): item = wx.MenuItem(self, wx.NewId(), lang.MPOP_SHOW_OFFLINE_MESSAGES) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onShowOffline, item) item = wx.MenuItem(self, wx.NewId(), lang.MPOP_CLEAR_OFFLINE_MESSAGES) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onClearOffline, item) item = wx.MenuItem(self, wx.NewId(), lang.MPOP_COPY_ID_TO_CLIPBOARD) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onCopyIdToClipboard, item) self.AppendSeparator() if not self.isCurrentBuddyLoggingActivated(): item = wx.MenuItem(self, wx.NewId(), lang.MPOP_ACTIVATE_LOG) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onActivateLog, item) if self.hasOldLog(): item = wx.MenuItem(self, wx.NewId(), lang.MPOP_DELETE_EXISTING_LOG) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onDeleteLog, item) else: item = wx.MenuItem(self, wx.NewId(), lang.MPOP_STOP_LOG) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onStopLog, item) item = wx.MenuItem(self, wx.NewId(), lang.MPOP_DELETE_AND_STOP_LOG) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onDeleteLog, item) self.AppendSeparator() item = wx.MenuItem(self, wx.NewId(), lang.MPOP_EDIT_CONTACT) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onEdit, item) item = wx.MenuItem(self, wx.NewId(), lang.MPOP_DELETE_CONTACT) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onDelete, item) self.AppendSeparator() item = wx.MenuItem(self, wx.NewId(), lang.MPOP_ADD_CONTACT) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onAdd, item) #ask support item = wx.MenuItem(self, wx.NewId(), lang.MPOP_ASK_AUTHOR % config.get("branding", "support_name")) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onAskAuthor, item) item = wx.MenuItem(self, wx.NewId(), lang.MPOP_EDIT_MY_PROFILE) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onProfile, item) self.AppendSeparator() #settings item = wx.MenuItem(self, wx.NewId(), lang.MPOP_SETTINGS) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onSettings, item) #about item = wx.MenuItem(self, wx.NewId(), lang.MPOP_ABOUT) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onAbout, item) #exit program self.AppendSeparator() item = wx.MenuItem(self, wx.NewId(), lang.MTB_QUIT) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.onQuit, item) def onSendFile(self, evt): title = lang.DFT_FILE_OPEN_TITLE % self.buddy.getAddressAndDisplayName() dialog = wx.FileDialog(self.mw, title, style=wx.OPEN) dialog.SetDirectory(config.getHomeDir()) if dialog.ShowModal() == wx.ID_OK: file_name = dialog.GetPath() FileTransferWindow(self.mw, self.buddy, file_name) def onEdit(self, evt): dialog = DlgEditContact(self.mw, self.mw, self.buddy) dialog.ShowModal() def onDelete(self, evt): answer = wx.MessageBox(lang.D_CONFIRM_DELETE_MESSAGE % (self.buddy.address, self.buddy.name), lang.D_CONFIRM_DELETE_TITLE, wx.YES_NO|wx.NO_DEFAULT) if answer == wx.YES: #remove from list without disconnecting #this will send a remove_me message #the other buddy will then disconnect, #because there is not much it can do with the #connections anymore. self.mw.buddy_list.removeBuddy(self.buddy, disconnect=False) def onShowOffline(self, evt): om = self.buddy.getOfflineMessages() if om: om = lang.MSG_OFFLINE_QUEUED % (self.buddy.address, om) else: om = lang.MSG_OFFLINE_EMPTY % self.buddy.address wx.MessageBox(om, lang.MSG_OFFLINE_TITLE, wx.ICON_INFORMATION) def onClearOffline(self, evt): try: tc_client.wipeFile(self.buddy.getOfflineFileName()) except: pass def onCopyIdToClipboard(self, evt): if not wx.TheClipboard.IsOpened(): address = wx.TextDataObject(self.buddy.address) wx.TheClipboard.Open() wx.TheClipboard.SetData(address) wx.TheClipboard.Close() def getChatWindow(self): # this is called by the on*Log() functions, # because all logging is done by the chat windows, # logging does not belong to the functionality # of the Buddy in tc_client.py for window in self.mw.chat_windows: if window.buddy == self.buddy: print "found" return window #must open a hidden window return ChatWindow(self.mw, self.buddy, "", True) def isCurrentBuddyLoggingActivated(self): return os.path.exists(os.path.join(config.getDataDir(), '%s.log' % self.buddy.address)) def hasOldLog(self): return os.path.exists(os.path.join(config.getDataDir(), 'disabled_%s.log' % self.buddy.address)) def onActivateLog(self, evt): self.getChatWindow().onActivateLog(evt) def onStopLog(self, evt): self.getChatWindow().onStopLog(evt) def onDeleteLog(self, evt): self.getChatWindow().onDeleteLog(evt) def onAdd(self, evt): dialog = DlgEditContact(self.mw, self.mw) dialog.ShowModal() def onProfile(self, evt): dialog = DlgEditProfile(self.mw, self.mw) dialog.ShowModal() def onSettings(self, evt): dialog = dlg_settings.Dialog(self.mw) dialog.ShowModal() def onAbout(self, evt): wx.MessageBox(lang.ABOUT_TEXT % {"version":version.VERSION, "svn":version.VERSION_SVN, "copyright":config.COPYRIGHT, "python":".".join(str(x) for x in sys.version_info), "wx":wx.version(), "translators":config.getTranslators()}, lang.ABOUT_TITLE) def onAskAuthor(self, evt): if self.mw.buddy_list.getBuddyFromAddress(config.get("branding", "support_id")): wx.MessageBox(lang.DEC_MSG_ALREADY_ON_LIST % config.get("branding", "support_name")) else: dialog = DlgEditContact(self.mw, self.mw, add_author=True) dialog.ShowModal() def onQuit(self, evt): self.mw.exitProgram() class DlgEditContact(wx.Dialog): def __init__(self, parent, main_window, buddy=None, add_author=False): #no buddy -> Add new wx.Dialog.__init__(self, parent, -1) self.mw = main_window self.bl = self.mw.buddy_list self.buddy = buddy if buddy is None: self.SetTitle(lang.DEC_TITLE_ADD) address = "" name = "" else: self.SetTitle(lang.DEC_TITLE_EDIT) address = buddy.address name = buddy.name self.panel = wx.Panel(self) #setup the sizers sizer = wx.GridBagSizer(vgap = 5, hgap = 5) box_sizer = wx.BoxSizer() box_sizer.Add(sizer, 1, wx.EXPAND | wx.ALL, 5) #address row = 0 lbl = wx.StaticText(self.panel, -1, lang.DEC_TORCHAT_ID) sizer.Add(lbl, (row, 0)) self.txt_address = wx.TextCtrl(self.panel, -1, address) self.txt_address.SetMinSize((250, -1)) sizer.Add(self.txt_address, (row, 1), (1, 2)) #name row += 1 lbl = wx.StaticText(self.panel, -1, lang.DEC_DISPLAY_NAME) sizer.Add(lbl, (row, 0)) self.txt_name = wx.TextCtrl(self.panel, -1, name) self.txt_name.SetMinSize((250, -1)) sizer.Add(self.txt_name, (row, 1), (1, 2)) #add-me message (new buddies) if not self.buddy: row += 1 lbl = wx.StaticText(self.panel, -1, lang.DEC_INTRODUCTION) sizer.Add(lbl, (row, 0)) self.txt_intro = wx.TextCtrl(self.panel, -1, "hello, my friend...") self.txt_intro.SetMinSize((250, -1)) sizer.Add(self.txt_intro, (row, 1), (1, 2)) if add_author: self.txt_address.SetValue(config.get("branding", "support_id")) self.txt_name.SetValue(config.get("branding", "support_name")) #buttons row += 1 self.btn_cancel = wx.Button(self.panel, wx.ID_CANCEL, lang.BTN_CANCEL) sizer.Add(self.btn_cancel, (row, 1), flag=wx.EXPAND) self.btn_ok = wx.Button(self.panel, wx.ID_OK, lang.BTN_OK) self.btn_ok.SetDefault() sizer.Add(self.btn_ok, (row, 2), flag=wx.EXPAND) #fit the sizers self.panel.SetSizer(box_sizer) box_sizer.Fit(self) #bind the events self.btn_cancel.Bind(wx.EVT_BUTTON, self.onCancel) self.btn_ok.Bind(wx.EVT_BUTTON, self.onOk) def onOk(self, evt): address = self.txt_address.GetValue().rstrip().lstrip() if len(address) != 16: l = len(address) wx.MessageBox(lang.DEC_MSG_16_CHARACTERS % l) return for c in address: if c not in "234567abcdefghijklmnopqrstuvwxyz": wx.MessageBox(lang.DEC_MSG_ONLY_ALPANUM) return if self.buddy is None: buddy = tc_client.Buddy(address, self.bl, self.txt_name.GetValue()) res = self.bl.addBuddy(buddy) if res == False: wx.MessageBox(lang.DEC_MSG_ALREADY_ON_LIST % address) else: if self.txt_intro.GetValue() <> "": buddy.storeOfflineChatMessage(self.txt_intro.GetValue()) else: address_old = self.buddy.address offline_file_name_old = self.buddy.getOfflineFileName() self.buddy.address = address offline_file_name_new = self.buddy.getOfflineFileName() self.buddy.name = self.txt_name.GetValue() self.bl.save() if address != address_old: self.buddy.disconnect() try: os.rename(offline_file_name_old, offline_file_name_new) except: pass self.Close() def onCancel(self,evt): self.Close() class DlgEditProfile(wx.Dialog): def __init__(self, parent, main_window): wx.Dialog.__init__(self, parent, -1, title=lang.DEP_TITLE) self.mw = main_window self.panel = wx.Panel(self) self.remove_avatar_on_ok = False #setup the sizers sizer = wx.GridBagSizer(vgap = 5, hgap = 5) avatar_sizer = wx.BoxSizer(wx.VERTICAL) box_sizer = wx.BoxSizer() box_sizer.Add(avatar_sizer, 0, wx.EXPAND | wx.ALL, 5) box_sizer.Add(sizer, 1, wx.EXPAND | wx.ALL, 5) #avatar self.avatar = wx.StaticBitmap(self.panel, -1, self.getAvatarBitmap()) avatar_sizer.Add(self.avatar, 0, wx.EXPAND | wx.ALL, 2) #avatar buttons self.btn_set_avatar = wx.Button(self.panel, -1, lang.DEP_SET_AVATAR) avatar_sizer.Add(self.btn_set_avatar, 0, wx.EXPAND | wx.ALL, 2) self.btn_remove_avatar = wx.Button(self.panel, -1, lang.DEP_REMOVE_AVATAR) avatar_sizer.Add(self.btn_remove_avatar, 0, wx.EXPAND | wx.ALL, 2) if not self.mw.buddy_list.own_avatar_data: self.btn_remove_avatar.Disable() #name row = 0 lbl = wx.StaticText(self.panel, -1, lang.DEP_NAME) sizer.Add(lbl, (row, 0)) self.txt_name = wx.TextCtrl(self.panel, -1, config.get("profile", "name")) self.txt_name.SetMinSize((250, -1)) sizer.Add(self.txt_name, (row, 1), (1, 2)) #text row += 1 lbl = wx.StaticText(self.panel, -1, lang.DEP_TEXT) sizer.Add(lbl, (row, 0)) self.txt_text = wx.TextCtrl(self.panel, -1, config.get("profile", "text"), style=wx.TE_MULTILINE | wx.TE_PROCESS_ENTER) self.txt_text.SetMinSize((250, 70)) sizer.Add(self.txt_text, (row, 1), (1, 2)) #buttons row += 1 self.btn_cancel = wx.Button(self.panel, wx.ID_CANCEL, lang.BTN_CANCEL) sizer.Add(self.btn_cancel, (row, 1), flag=wx.EXPAND) self.btn_ok = wx.Button(self.panel, wx.ID_OK, lang.BTN_OK) self.btn_ok.SetDefault() sizer.Add(self.btn_ok, (row, 2), flag=wx.EXPAND) #fit the sizers self.panel.SetSizer(box_sizer) box_sizer.Fit(self) #bind the events self.btn_set_avatar.Bind(wx.EVT_BUTTON, self.onAvatar) self.btn_remove_avatar.Bind(wx.EVT_BUTTON, self.onAvatarRemove) self.btn_cancel.Bind(wx.EVT_BUTTON, self.onCancel) self.btn_ok.Bind(wx.EVT_BUTTON, self.onOk) self.txt_text.Bind(wx.EVT_TEXT_ENTER, self.onEnter) self.avatar.Bind(wx.EVT_LEFT_UP, self.onAvatar) self.txt_text.SetFocus() self.avatar.SetDropTarget(AvatarDropTarget(self)) self.txt_name.SetDropTarget(AvatarDropTarget(self)) self.txt_text.SetDropTarget(AvatarDropTarget(self)) # position the dialog near the mouse # (yes, I am paying attention to details) w,h = self.GetSize() sx, sy, sx1, sy1 = wx.ClientDisplayRect() (x,y) = wx.GetMousePosition() x = x - w/2 y = y - h/2 if x < sx: x = sx if y < sy: y = sy if x > sx1 - w: x = sx1 - w if y > sy1 - h: y = sy1 - h self.SetPosition((x,y)) def getAvatarBitmap(self, file_name=None): if file_name: image = wx.Image(file_name, wx.BITMAP_TYPE_PNG) image.Rescale(64, 64, wx.IMAGE_QUALITY_HIGH) return wx.BitmapFromImage(image) else: if self.mw.buddy_list.own_avatar_data: image = wx.ImageFromData(64, 64, self.mw.buddy_list.own_avatar_data) if self.mw.buddy_list.own_avatar_data_alpha: image.SetAlphaData(self.mw.buddy_list.own_avatar_data_alpha) return wx.BitmapFromImage(image) else: return wx.Bitmap(os.path.join(config.ICON_DIR, "torchat.png"), wx.BITMAP_TYPE_PNG) def onAvatarSelected(self, file_name): self.remove_avatar_on_ok = False avatar_old = os.path.join(config.getDataDir(), "avatar.png") avatar_new = os.path.join(config.getDataDir(), "avatar_new.png") if file_name == avatar_old or file_name == avatar_new: wx.MessageBox(lang.DEP_WARN_IS_ALREADY, lang.DEP_WARN_TITLE) else: # onOk() will find the file avatar_new.png and know what to do shutil.copy(file_name, avatar_new) # set the new bitmap (in this dialog only) self.avatar.SetBitmap(self.getAvatarBitmap(avatar_new)) self.btn_remove_avatar.Enable() self.panel.Layout() self.panel.Refresh() def onAvatarRemove(self, evt): self.avatar.SetBitmap(wx.Bitmap(os.path.join(config.ICON_DIR, "torchat.png"), wx.BITMAP_TYPE_PNG)) self.panel.Layout() self.panel.Refresh() self.remove_avatar_on_ok = True self.btn_remove_avatar.Disable() def onAvatar(self, evt): title = lang.DEP_AVATAR_SELECT_PNG dialog = wx.FileDialog(self, title, style=wx.OPEN) dialog.SetWildcard("%s (*.png)|*.png|%s (*.*)|*.*" % (lang.DEP_PNG_FILES, lang.DEP_ALL_FILES)) dialog.SetDirectory(config.getHomeDir()) if dialog.ShowModal() == wx.ID_OK: self.onAvatarSelected(dialog.GetPath()) pass def onEnter(self, evt): self.onOk(evt) def onCancel(self, evt): avatar_new = os.path.join(config.getDataDir(), "avatar_new.png") if os.path.exists(avatar_new): tc_client.wipeFile(avatar_new) self.Close() def onOk(self, evt): config.set("profile", "name", self.txt_name.GetValue()) config.set("profile", "text", self.txt_text.GetValue()) # replace the avatar if a new one has been selected # or remove it and send an empty avatar if it has been removed avatar_old = os.path.join(config.getDataDir(), "avatar.png") avatar_new = os.path.join(config.getDataDir(), "avatar_new.png") if self.remove_avatar_on_ok: tc_client.wipeFile(avatar_old) tc_client.wipeFile(avatar_new) self.mw.buddy_list.own_avatar_data = "" self.mw.buddy_list.own_avatar_data_alpha = "" for buddy in self.mw.buddy_list.list: buddy.sendAvatar(True) else: if os.path.exists(avatar_new): shutil.copy(avatar_new, avatar_old) tc_client.wipeFile(avatar_new) self.mw.gui_bl.loadOwnAvatarData() # this will also send it for buddy in self.mw.buddy_list.list: buddy.sendProfile() buddy.sendStatus() self.Close() class BuddyList(wx.ListCtrl): def __init__(self, parent, main_window): wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT | wx.LC_NO_HEADER) self.mw = main_window self.bl = self.mw.buddy_list self.InsertColumn(0, "buddy") self.r_down = False self.last_mouse_time = time.time() self.tool_tip = None self.tool_tip_index = -1 self.has_mouse = False self.il = wx.ImageList(16, 16) self.il_idx = {} for status in [tc_client.STATUS_OFFLINE, tc_client.STATUS_HANDSHAKE, tc_client.STATUS_ONLINE, tc_client.STATUS_AWAY, tc_client.STATUS_XA]: self.il_idx[status] = self.il.Add(getStatusBitmap(status)) img_event = wx.Image(os.path.join(config.ICON_DIR, "event.png")) img_event.ConvertAlphaToMask() self.il_idx[100] = self.il.Add(img_event.ConvertToBitmap()) self.SetImageList(self.il, wx.IMAGE_LIST_SMALL) self.blink_phase = False self.timer = wx.Timer(self, -1) self.Bind(wx.EVT_TIMER, self.onTimer, self.timer) self.old_sum = "" self.timer.Start(milliseconds=500, oneShot=False) self.Bind(wx.EVT_LEFT_DCLICK, self.onDClick) self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.onRClick) self.Bind(wx.EVT_RIGHT_DOWN, self.onRDown) self.Bind(wx.EVT_MOUSE_EVENTS, self.onMouse) self.Bind(wx.EVT_ENTER_WINDOW, self.onMouseEnter) self.Bind(wx.EVT_LEAVE_WINDOW, self.onMouseLeave) self.SetDropTarget(DropTarget(self.mw, None)) if config.getint("gui", "color_text_use_system_colors") == 0: self.SetBackgroundColour(config.get("gui", "color_text_back")) self.SetForegroundColour(config.get("gui", "color_text_fore")) self.onListChanged() self.loadOwnAvatarData() def loadOwnAvatarData(self): file_name = os.path.join(config.getDataDir(), "avatar.png") if os.path.exists(file_name): print "(2) reading own avatar file %s" % file_name image = wx.Image(file_name, wx.BITMAP_TYPE_PNG) image.Rescale(64, 64, wx.IMAGE_QUALITY_HIGH) self.bl.own_avatar_data = image.GetData() print "(2) uncompressed image data: %i bytes" % len(self.bl.own_avatar_data) if image.HasAlpha(): self.bl.own_avatar_data_alpha = image.GetAlphaData() print "(2) uncompressed aplha data: %i bytes" % len(self.bl.own_avatar_data_alpha) else: self.bl.own_avatar_data_alpha = "" for buddy in self.bl.list: buddy.sendAvatar() def setStatusIcon(self, index, image_idx): # we also store the image index in the ItemData because # we can then avoid setting it twice and avoid flickering old = self.GetItemData(index) if image_idx <> old: self.SetItemImage(index, image_idx) self.SetItemData(index, image_idx) def blinkBuddy(self, buddy, blink=True): name = buddy.getDisplayName() for index in xrange(0, self.GetItemCount()): if name == self.GetItemText(index): if blink: if self.blink_phase: self.setStatusIcon(index, self.il_idx[100]) else: self.setStatusIcon(index, self.il_idx[buddy.status]) else: self.setStatusIcon(index, self.il_idx[buddy.status]) def onTimer(self, evt): self.blink_phase = not self.blink_phase # blink all buddies with hidden chat windows for window in self.mw.chat_windows: if not window.IsShown(): self.blinkBuddy(window.buddy, True) else: self.blinkBuddy(window.buddy, False) # tooltips: if self.has_mouse and self.mw.IsActive(): if time.time() - self.last_mouse_time > 0.5: index, flags = self.HitTest(self.ScreenToClient(wx.GetMousePosition())) if index == -1: # not over any item (anymore) self.closeToolTip() else: # hovering over item if self.tool_tip is None: self.openToolTip(index) else: self.closeToolTip() def closeToolTip(self): if self.tool_tip <> None: self.tool_tip.Hide() self.tool_tip.Destroy() self.tool_tip = None self.tool_tip_index = -1 def openToolTip(self, index): self.closeToolTip() self.tool_tip = BuddyToolTip(self, index) self.tool_tip_index = index #TODO: wx.PopupWindow stealing focus under wine #find a better way to prevent this wx.CallAfter(self.mw.SetFocus) def onDClick(self, evt): i = self.GetFirstSelected() if i <> -1: address = self.GetItemText(i)[0:16] for buddy in self.bl.list: if buddy.address == address: found_window = False for window in self.mw.chat_windows: if window.buddy == buddy: found_window = True break if not found_window: window = ChatWindow(self.mw, buddy) if not window.IsShown(): window.Show() window.txt_out.SetFocus() break evt.Skip() def onRClick(self, evt): index, flags = self.HitTest(evt.GetPosition()) if index != -1: self.onMouseLeave(evt) self.mw.PopupMenu(PopupMenu(self.mw, "contact")) def onRDown(self, evt): index, flags = self.HitTest(evt.GetPosition()) if index == -1: self.onMouseLeave(evt) self.mw.PopupMenu(PopupMenu(self.mw, "empty")) else: evt.Skip() def getSelectedBuddy(self): index = self.GetFirstSelected() addr = self.GetItemText(index)[0:16] return self.bl.getBuddyFromAddress(addr) def getBuddyFromXY(self, position): index, flags = self.HitTest(position) if index != -1: addr = self.GetItemText(index)[0:16] return self.bl.getBuddyFromAddress(addr) else: return None def onBuddyStatusChanged(self, buddy): assert isinstance(buddy, tc_client.Buddy) line = buddy.getDisplayName() index = self.FindItem(0, line) self.SetItemImage(index, self.il_idx[buddy.status]) #notify the chat window for window in self.mw.chat_windows: if window.buddy == buddy: window.onBuddyStatusChanged() break # if a tooltip for this buddy is currently shown then refresh it if self.tool_tip <> None and index == self.tool_tip_index: self.openToolTip(index) def onBuddyProfileChanged(self, buddy): assert isinstance(buddy, tc_client.Buddy) #notify the chat window for window in self.mw.chat_windows: if window.buddy == buddy: window.onBuddyProfileChanged() break # if a tooltip for this buddy is currently shown then refresh it line = buddy.getDisplayName() index = self.FindItem(0, line) if self.tool_tip <> None and index == self.tool_tip_index: self.openToolTip(index) def onBuddyAvatarChanged(self, buddy): print "(2) converting %s avatar data into wx.Bitmap" % buddy.address try: image = wx.ImageFromData(64, 64, buddy.profile_avatar_data) if buddy.profile_avatar_data_alpha: print "(2) %s avatar has alpha channel" % buddy.address image.SetAlphaData(buddy.profile_avatar_data_alpha) buddy.profile_avatar_object = wx.BitmapFromImage(image) except: print "(2) could not convert %s avatar data to wx.Bitmap" % buddy.address tb() # notify the chat window for window in self.mw.chat_windows: if window.buddy == buddy: window.onBuddyAvatarChanged() break # if a tooltip for this buddy is currently shown then refresh it line = buddy.getDisplayName() index = self.FindItem(0, line) if self.tool_tip <> None and index == self.tool_tip_index: self.openToolTip(index) def onListChanged(self): # usually called via callback from the client # whenever the client has saved the changed list # TODO: This whole method seems a bit ugly # remove items which are not in list anymore for index in xrange(0, self.GetItemCount()): found = False for buddy in self.bl.list: if buddy.getDisplayName() == self.GetItemText(index): found = True break if not found: self.DeleteItem(index) break #add new items to the list for buddy in self.bl.list: line = buddy.getDisplayName() index = self.FindItem(0, line) if index == -1: index = self.InsertImageStringItem(sys.maxint, line, self.il_idx[tc_client.STATUS_OFFLINE]) self.SetColumnWidth(0, wx.LIST_AUTOSIZE) self.onBuddyStatusChanged(buddy) def onMouse(self, evt): self.has_mouse = True self.last_mouse_time = time.time() if self.tool_tip <> None: index, flags = self.HitTest(self.ScreenToClient(wx.GetMousePosition())) if index == -1: self.closeToolTip() elif index <> self.tool_tip_index: self.openToolTip(index) else: self.tool_tip.setPos(wx.GetMousePosition()) evt.Skip() def onMouseEnter(self, evt): self.has_mouse = True def onMouseLeave(self, evt): self.has_mouse = False self.closeToolTip() def getBuddyFromIndex(self, index): name = self.GetItemText(index) for buddy in self.bl.list: if buddy.getDisplayName() == name: return buddy class BuddyToolTip(wx.PopupWindow): def __init__(self, list, index): wx.PopupWindow.__init__(self, list) self.buddy = list.getBuddyFromIndex(index) self.mw = list.mw self.panel = wx.Panel(self, style=wx.SIMPLE_BORDER) self.panel.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOBK)) sizer = wx.BoxSizer() self.panel.SetSizer(sizer) if self.buddy.profile_avatar_object <> None: bitmap = self.buddy.profile_avatar_object else: bitmap = wx.Bitmap(os.path.join(config.ICON_DIR, "torchat.png"), wx.BITMAP_TYPE_PNG) self.avatar = wx.StaticBitmap(self.panel, -1, bitmap) sizer.Add(self.avatar, 0, wx.ALL, 5) name = self.buddy.name if self.buddy.profile_name <> u"": name = self.buddy.profile_name text = "%s\n%s" % (self.buddy.address, name) if self.buddy.profile_text <> u"": text = "%s\n\n%s" % (text, textwrap.fill(self.buddy.profile_text, 30)) if self.buddy.conn_in: text = "%s\n\n%s" % (text, lang.BPOP_CLIENT_SOFTWARE % (self.buddy.client, self.buddy.version)) else: if self.buddy.status == tc_client.STATUS_HANDSHAKE: text = "%s\n\n%s" % (text, lang.BPOP_CONNECTED_AWAITING_RETURN_CONN) else: text = "%s\n\n%s" % (text, lang.BPOP_BUDDY_IS_OFFLINE) self.label = wx.StaticText(self.panel) self.label.SetForegroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOTEXT)) self.label.SetLabel(text) sizer.Add(self.label, 0, wx.ALL, 5) # sizer for whole window, containing the panel wsizer = wx.BoxSizer() wsizer.Add(self.panel, 0, wx.ALL, 0) self.SetSizerAndFit(wsizer) self.Layout() self.setPos(wx.GetMousePosition()) self.Show() def setPos(self, pos): self.SetPosition((pos.x +10, pos.y + 10)) class StatusSwitchList(wx.Menu): def __init__(self, status_switch): wx.Menu.__init__(self) self.status_switch = status_switch item = wx.MenuItem(self, wx.NewId(), lang.ST_AVAILABLE) item.SetBitmap(getStatusBitmap(tc_client.STATUS_ONLINE)) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.status_switch.onAvailable, item) item = wx.MenuItem(self, wx.NewId(), lang.ST_AWAY) item.SetBitmap(getStatusBitmap(tc_client.STATUS_AWAY)) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.status_switch.onAway, item) item = wx.MenuItem(self, wx.NewId(), lang.ST_EXTENDED_AWAY) item.SetBitmap(getStatusBitmap(tc_client.STATUS_XA)) self.AppendItem(item) self.Bind(wx.EVT_MENU, self.status_switch.onXA, item) class StatusSwitch(wx.Button): def __init__(self, parent, main_window): wx.Button.__init__(self, parent) self.parent = parent self.main_window = main_window self.status = self.main_window.buddy_list.own_status self.Bind(wx.EVT_BUTTON, self.onClick) self.setStatus(self.main_window.buddy_list.own_status) def onClick(self, evt): self.PopupMenu(StatusSwitchList(self)) def onAvailable(self, evt): self.setStatus(tc_client.STATUS_ONLINE) def onAway(self, evt): self.setStatus(tc_client.STATUS_AWAY) def onXA(self, evt): self.setStatus(tc_client.STATUS_XA) def setStatus(self, status): self.status = status self.main_window.setStatus(status) if status == tc_client.STATUS_AWAY: status_text = lang.ST_AWAY if status == tc_client.STATUS_XA: status_text = lang.ST_EXTENDED_AWAY if status == tc_client.STATUS_ONLINE: status_text = lang.ST_AVAILABLE if status == tc_client.STATUS_OFFLINE: status_text = lang.ST_OFFLINE self.SetLabel(status_text) class ChatWindow(wx.Frame): def __init__(self, main_window, buddy, message="", hidden=False, notify_offline_sent=False): wx.Frame.__init__( self, main_window, -1, size=( config.getint("gui", "chat_window_width"), config.getint("gui", "chat_window_height") ) ) self.mw = main_window self.buddy = buddy self.unread = 0 self.updateTitle() self.splitter = wx.SplitterWindow( self, -1, style=wx.SP_3D | wx.SP_BORDER | wx.SP_LIVE_UPDATE ) self.panel_lower = wx.Panel(self.splitter, -1) self.panel_upper = wx.Panel(self.splitter, -1) self.splitter.SetMinimumPaneSize(50) self.splitter.SetSashGravity(1) self.splitter.SetSashSize(3) # incoming text (upper area) self.txt_in = wx.TextCtrl( self.panel_upper, -1, style=wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_AUTO_URL | wx.TE_AUTO_SCROLL | wx.TE_RICH2 | wx.BORDER_SUNKEN ) # outgoing text (lower area) self.txt_out = wx.TextCtrl( self.panel_lower, -1, style=wx.TE_MULTILINE | wx.TE_RICH2 | wx.BORDER_SUNKEN ) self.doLayout() # set the sizers # restore peviously saved sash position lower = config.getint("gui", "chat_window_height_lower") w,h = self.GetSize() if lower > h - 50: lower = h - 50 self.splitter.SetSashPosition(h - lower) self.setFontAndColor() self.insertBackLog() om = self.buddy.getOfflineMessages() if om: om = os.linesep + "*** " + lang.NOTICE_DELAYED_MSG_WAITING + om + os.linesep self.writeHintLine(om) self.txt_in.AppendText(os.linesep) #scroll to end + 1 empty line if notify_offline_sent: self.notifyOfflineSent() if message != "": self.process(message) self.Bind(wx.EVT_CLOSE, self.onClose) self.Bind(wx.EVT_SHOW, self.onShow) self.txt_out.Bind(wx.EVT_KEY_DOWN, self.onKey) self.txt_in.Bind(wx.EVT_TEXT_URL, self.onURL) self.Bind(wx.EVT_ACTIVATE, self.onActivate) self.txt_in.Bind(wx.EVT_CONTEXT_MENU, self.onContextMenu) # file drop target self.txt_in.SetDropTarget(DropTarget(self.mw, self.buddy)) # Only the upper part of the chat window will # accept files. The lower part only text and URLs self.txt_out.DragAcceptFiles(False) self.Bind(wx.EVT_CHILD_FOCUS, self.onChildFocus) if not hidden: self.Show() self.mw.chat_windows.append(self) self.onBuddyStatusChanged() def doLayout(self): outer_sizer = wx.BoxSizer(wx.VERTICAL) sizer_lower = wx.BoxSizer(wx.HORIZONTAL) sizer_upper = wx.BoxSizer(wx.HORIZONTAL) sizer_upper.Add(self.txt_in, 1, wx.ALL|wx.EXPAND, 0) self.panel_upper.SetSizer(sizer_upper) sizer_lower.Add(self.txt_out, 1, wx.ALL|wx.EXPAND, 0) self.panel_lower.SetSizer(sizer_lower) self.splitter.SplitHorizontally(self.panel_upper, self.panel_lower) outer_sizer.Add(self.splitter, 1, wx.ALL|wx.EXPAND, 0) self.SetSizer(outer_sizer) self.Layout() def onShow(self, evt): # always make sure we are at the end when showing the window wx.CallAfter(self.txt_in.AppendText, "") wx.CallAfter(self.workaroundScrollBug) def insertBackLogContents(self, file_name): file = open(file_name) for line in file: self.writeHintLine(line.rstrip().decode("UTF-8")) file.close() def insertBackLog(self): old = os.path.join(config.getDataDir(), "disabled_%s.log" % self.buddy.address) cur = os.path.join(config.getDataDir(), "%s.log" % self.buddy.address) if os.path.exists(cur): self.insertBackLogContents(cur) self.writeHintLine(os.linesep + "*** " + lang.LOG_IS_ACTIVATED % cur) else: if os.path.exists(old): self.insertBackLogContents(old) self.writeHintLine(os.linesep + "*** " + lang.LOG_IS_STOPPED_OLD_LOG_FOUND % old) def setFontAndColor(self): font = wx.Font( config.getint("gui", "chat_font_size"), wx.SWISS, wx.NORMAL, wx.NORMAL, False, config.get("gui", "chat_font_name") ) self.txt_out.SetFont(font) self.txt_in.SetFont(font) if config.getint("gui", "color_text_use_system_colors") == 0: self.txt_out.SetBackgroundColour(config.get("gui", "color_text_back")) self.txt_in.SetBackgroundColour(config.get("gui", "color_text_back")) self.txt_out.SetForegroundColour(config.get("gui", "color_text_fore")) self.txt_out.SetDefaultStyle(wx.TextAttr(config.get("gui", "color_text_fore"))) def updateTitle(self): if self.unread == 1: title = "* " elif self.unread > 1: title = "*[%i] " % self.unread else: title = "" title += self.buddy.address if self.buddy.name != "": title += " (%s)" % self.buddy.name self.SetTitle(title + " %s" % config.getProfileLongName()) def getTitleShort(self): t = self.GetTitle() return t[:-19] def workaroundScrollBug(self): if config.isWindows(): # workaround scroll bug on windows # https://sourceforge.net/tracker/?func=detail&atid=109863&aid=665381&group_id=9863 self.txt_in.ScrollLines(-1) self.txt_in.ScrollLines(1) def writeColored(self, color, name, text): # this method will write to the chat window and # will also write to the log file if logging is enabled. self.txt_in.SetDefaultStyle(wx.TextAttr(config.get("gui", "color_time_stamp"))) self.txt_in.write("%s " % time.strftime(config.get("gui", "time_stamp_format"))) self.txt_in.SetDefaultStyle(wx.TextAttr(color)) self.txt_in.write("%s: " % name) if config.getint("gui", "color_text_use_system_colors") == 0: self.txt_in.SetDefaultStyle(wx.TextAttr(config.get("gui", "color_text_fore"))) else: self.txt_in.SetDefaultStyle(wx.TextAttr(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))) self.txt_in.write(text + os.linesep) self.workaroundScrollBug() if os.path.exists(os.path.join(config.getDataDir(), "%s.log" % self.buddy.address)): logtext = "%s %s: %s" % (time.strftime("(%Y-%m-%d %H:%M)"), name, text) self.log(logtext) def writeHintLine(self, line): self.txt_in.SetDefaultStyle(wx.TextAttr(config.get("gui", "color_time_stamp"))) self.txt_in.write(line + os.linesep) if config.getint("gui", "color_text_use_system_colors") == 0: self.txt_in.SetDefaultStyle(wx.TextAttr(config.get("gui", "color_text_fore"))) else: self.txt_in.SetDefaultStyle(wx.TextAttr(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))) self.workaroundScrollBug() def notify(self, name, message): #needs unicode if not self.IsActive(): if config.getint("gui", "notification_flash_window"): self.RequestUserAttention(wx.USER_ATTENTION_INFO) self.unread += 1 self.updateTitle() if config.getint("gui", "notification_popup"): message = textwrap.fill(message, 40) tc_notification.notificationWindow(self.mw, name, message, self.buddy) if not self.IsShown(): self.mw.taskbar_icon.blink() def notifyOfflineSent(self): #all should be unicode here message = "[%s]" % lang.NOTICE_DELAYED_MSG_SENT self.writeColored(config.get("gui", "color_nick_myself"), "myself", message) self.notify("to %s" % self.buddy.address, message) def process(self, message): #message must be unicode if self.buddy.name != "": name = self.buddy.name else: name = self.buddy.address self.writeColored(config.get("gui", "color_nick_buddy"), name, message) self.notify(name, message) def onActivate(self, evt): self.unread = 0 self.updateTitle() evt.Skip() def onChildFocus(self, evt): # no matter which child just got focus, we give # it back to the lower text panel since this is the # only control that should ever own the keyboard. self.txt_out.SetFocus() evt.Skip() def onClose(self, evt): w,h = self.GetSize() config.set("gui", "chat_window_width", w) config.set("gui", "chat_window_height", h) config.set("gui", "chat_window_height_lower", h - self.splitter.GetSashPosition()) self.mw.chat_windows.remove(self) self.Hide() self.Destroy() def onKey(self, evt): #TODO: in wine there is/was a problem with shift-enter. Is this fixed now? #TODO: There was an unconfirmed report that the enter key would not work at all in Windows 7, is this true? print "(3) key pressed: %i" % evt.GetKeyCode() # debug the windows 7 problem if evt.GetKeyCode() == wx.WXK_RETURN and not evt.ShiftDown(): self.onSend(evt) else: # shift-enter will produce 0x0b (vertical tab) (only on windows!) # we will deal with this later in the onSend method evt.Skip() def onSend(self, evt): text = self.txt_out.GetValue().rstrip().lstrip().replace("\x0b", os.linesep) if text == "": return self.txt_out.SetValue("") if self.buddy.status not in [tc_client.STATUS_OFFLINE, tc_client.STATUS_HANDSHAKE]: self.buddy.sendChatMessage(text) self.writeColored(config.get("gui", "color_nick_myself"), "myself", text) else: self.buddy.storeOfflineChatMessage(text) self.writeColored(config.get("gui", "color_nick_myself"), "myself", "[%s] %s" % (lang.NOTICE_DELAYED, text)) def onURL(self, evt): #all URL mouse events trigger this if evt.GetMouseEvent().GetEventType() == wx.wxEVT_LEFT_DOWN: #left button down, now we need the URL start = evt.GetURLStart() end = evt.GetURLEnd() url = self.txt_in.GetRange(start, end) #TODO: is this the way to go? better make it a config option. wx.LaunchDefaultBrowser(url) else: evt.Skip() def onContextMenu(self, evt): menu = wx.Menu() id = wx.NewId() item = wx.MenuItem(menu, id, lang.CPOP_COPY) self.Bind(wx.EVT_MENU, self.onCopy, id=id) menu.AppendItem(item) sel_from, sel_to = self.txt_in.GetSelection() empty = (sel_from == sel_to) if empty: item.Enable(False) id = wx.NewId() item = wx.MenuItem(menu, id, lang.MPOP_SEND_FILE) self.Bind(wx.EVT_MENU, self.onSendFile, id=id) menu.AppendItem(item) id = wx.NewId() item = wx.MenuItem(menu, id, lang.MPOP_EDIT_CONTACT) self.Bind(wx.EVT_MENU, self.onEditBuddy, id=id) menu.AppendItem(item) menu.AppendSeparator() if not self.isLoggingActivated(): item = wx.MenuItem(menu, wx.NewId(), lang.MPOP_ACTIVATE_LOG) menu.AppendItem(item) menu.Bind(wx.EVT_MENU, self.onActivateLog, item) if self.hasOldLog(): item = wx.MenuItem(menu, wx.NewId(), lang.MPOP_DELETE_EXISTING_LOG) menu.AppendItem(item) menu.Bind(wx.EVT_MENU, self.onDeleteLog, item) else: item = wx.MenuItem(menu, wx.NewId(), lang.MPOP_STOP_LOG) menu.AppendItem(item) menu.Bind(wx.EVT_MENU, self.onStopLog, item) item = wx.MenuItem(menu, wx.NewId(), lang.MPOP_DELETE_AND_STOP_LOG) menu.AppendItem(item) menu.Bind(wx.EVT_MENU, self.onDeleteLog, item) self.PopupMenu(menu) menu.Destroy() def onCopy(self, evt): sel_from, sel_to = self.txt_in.GetSelection() if sel_from == sel_to: return text = self.txt_in.GetRange(sel_from, sel_to) clipdata = wx.TextDataObject() clipdata.SetText(text) wx.TheClipboard.Open() wx.TheClipboard.SetData(clipdata) wx.TheClipboard.Close() def onSendFile(self, evt): title = lang.DFT_FILE_OPEN_TITLE % self.buddy.getAddressAndDisplayName() dialog = wx.FileDialog(self, title, style=wx.OPEN) dialog.SetDirectory(config.getHomeDir()) if dialog.ShowModal() == wx.ID_OK: file_name = dialog.GetPath() FileTransferWindow(self.mw, self.buddy, file_name) def onEditBuddy(self, evt): dialog = DlgEditContact(self, self.mw, self.buddy) dialog.ShowModal() def onBuddyStatusChanged(self): bmp = getStatusBitmap(self.buddy.status) icon = wx.IconFromBitmap(bmp) self.SetIcon(icon) def onBuddyAvatarChanged(self): # nothing to to yet pass def onBuddyProfileChanged(self): # nothing to to yet pass def isLoggingActivated(self): return os.path.exists(os.path.join(config.getDataDir(), '%s.log' % self.buddy.address)) def hasOldLog(self): return os.path.exists(os.path.join(config.getDataDir(), 'disabled_%s.log' % self.buddy.address)) def onActivateLog(self, evt): old = os.path.join(config.getDataDir(), "disabled_%s.log" % self.buddy.address) cur = os.path.join(config.getDataDir(), "%s.log" % self.buddy.address) if os.path.exists(old): shutil.move(old, cur) self.log("") # this will create it self.writeColored(config.get("gui", "color_nick_myself"), "***", "[%s]" % lang.LOG_STARTED) def onStopLog(self, evt): old = os.path.join(config.getDataDir(), "disabled_%s.log" % self.buddy.address) cur = os.path.join(config.getDataDir(), "%s.log" % self.buddy.address) if os.path.exists(cur): self.writeColored(config.get("gui", "color_nick_myself"), "***", "[%s]" % lang.LOG_STOPPED) shutil.move(cur, old) def onDeleteLog(self, evt): old = os.path.join(config.getDataDir(), "disabled_%s.log" % self.buddy.address) cur = os.path.join(config.getDataDir(), "%s.log" % self.buddy.address) tc_client.wipeFile(old) tc_client.wipeFile(cur) self.writeHintLine("*** %s" % lang.LOG_DELETED) def log(self, msg): file_name = os.path.join(config.getDataDir(), "%s.log" % self.buddy.address) if not os.path.exists(file_name): f = open(file_name, "w") os.chmod(file_name, 0600) f.write(("*** " + lang.LOG_HEADER + os.linesep + os.linesep).encode("UTF-8")) else: f = open(file_name, "a") if msg <> "": f.write((msg + os.linesep).encode("UTF-8")) f.close() class BetterFileDropTarget(wx.FileDropTarget): def getFileName(self, filenames): if len(filenames) == 0: return None file_name = filenames[0] # --- begin evil hack if not os.path.exists(file_name): #sometimes the file name is in utf8 #but inside a unicode string! #TODO: must report this bug to wx print "(2) dropped file not found with dropped file_name, trying UTF-8 hack" try: file_name_utf8 = "" for c in file_name: file_name_utf8 += chr(ord(c)) file_name = file_name_utf8.decode("utf-8") except: tb() wx.MessageBox("there is a strange bug in wx for your platform with wx.FileDropTarget and non-ascii characters in file names") return None # --- end evil hack print "(2) file dropped: %s" % file_name return file_name class DropTarget(BetterFileDropTarget): #TODO: file dopping does not work in wine at all def __init__(self, mw, buddy): wx.FileDropTarget.__init__(self) self.mw = mw self.buddy = buddy def OnDropFiles(self, x, y, filenames): if len(filenames) > 1: wx.MessageBox(lang.D_WARN_FILE_ONLY_ONE_MESSAGE, lang.D_WARN_FILE_ONLY_ONE_TITLE) return file_name = self.getFileName(filenames) if file_name is None: return """ if not self.window.buddy.isFullyConnected(): wx.MessageBox(lang.D_WARN_BUDDY_OFFLINE_MESSAGE, lang.D_WARN_BUDDY_OFFLINE_TITLE) return """ if self.buddy: buddy = self.buddy else: # this is the drop target for the buddy list # find the buddy buddy = self.mw.gui_bl.getBuddyFromXY((x,y)) if buddy: print "(2) file dropped at buddy %s" % buddy.address else: print "(2) file dropped on empty space, ignoring" return FileTransferWindow(self.mw, buddy, file_name) class AvatarDropTarget(BetterFileDropTarget): def __init__(self, window): wx.FileDropTarget.__init__(self) self.window = window def OnDropFiles(self, x, y, filenames): file_name = self.getFileName(filenames) if file_name is None: return root, ext = os.path.splitext(file_name) if ext.lower() <> ".png": wx.MessageBox(lang.DEP_WARN_MUST_BE_PNG, lang.DEP_WARN_TITLE) return self.window.onAvatarSelected(file_name) class FileTransferWindow(wx.Frame): def __init__(self, main_window, buddy, file_name, receiver=None): #if receiver is given (a FileReceiver instance) we initialize #a Receiver Window, else we initialize a sender window and #let the client library create us a FileSender instance wx.Frame.__init__(self, main_window, -1) self.mw = main_window self.buddy = buddy self.bytes_total = 1 self.bytes_complete = 0 self.file_name = file_name self.file_name_save = "" self.completed = False self.error = False self.error_msg = "" if not receiver: self.is_receiver = False self.transfer_object = self.buddy.sendFile(self.file_name, self.onDataChange) else: self.is_receiver = True receiver.setCallbackFunction(self.onDataChange) self.transfer_object = receiver self.bytes_total = receiver.file_size self.file_name = file_name self.panel = wx.Panel(self) self.outer_sizer = wx.BoxSizer() grid_sizer = wx.GridBagSizer(vgap = 5, hgap = 5) grid_sizer.AddGrowableCol(0) self.outer_sizer.Add(grid_sizer, 1, wx.EXPAND | wx.ALL, 5) self.text = wx.StaticText(self.panel, -1, "") self.text.SetMinSize((300,-1)) grid_sizer.Add(self.text, (0, 0), (1, 4), wx.EXPAND) self.progress_bar = wx.Gauge(self.panel) grid_sizer.Add(self.progress_bar, (1, 0), (1, 4), wx.EXPAND) if self.is_receiver: # the first button that is created will have the focus, so # we create the save button first. # SetDefault() does not seem to work in a wx.Frame. self.btn_save = wx.Button(self.panel, wx.ID_SAVEAS, lang.BTN_SAVE_AS) self.btn_save.Bind(wx.EVT_BUTTON, self.onSave) self.btn_cancel = wx.Button(self.panel, wx.ID_CANCEL, lang.BTN_CANCEL) self.btn_cancel.Bind(wx.EVT_BUTTON, self.onCancel) if self.is_receiver: grid_sizer.Add(self.btn_cancel, (2, 2)) grid_sizer.Add(self.btn_save, (2, 3)) else: grid_sizer.Add(self.btn_cancel, (2, 3)) self.panel.SetSizer(self.outer_sizer) self.updateOutput() self.outer_sizer.Fit(self) self.Disable() self.Show() self.Enable() def updateOutput(self): if self.bytes_complete == -1: self.error = True self.completed = True self.bytes_complete = 0 percent = 100.0 * self.bytes_complete / self.bytes_total peer_name = self.buddy.address if self.buddy.name != "": peer_name += " (%s)" % self.buddy.name title = "%04.1f%% - %s" % (percent, os.path.basename(self.file_name)) self.SetTitle(title) self.progress_bar.SetValue(percent) if self.is_receiver: text = lang.DFT_RECEIVE \ % (os.path.basename(self.file_name), peer_name, percent, self.bytes_complete, self.bytes_total) else: text = lang.DFT_SEND \ % (os.path.basename(self.file_name), peer_name, percent, self.bytes_complete, self.bytes_total) try: # the client has no translation files, # it will send these english error messages error_msg_trans = { "waiting for connection" : lang.DFT_WAITING, "starting transfer" : lang.DFT_STARTING, "transfer complete" : lang.DFT_COMPLETE, "transfer aborted" : lang.DFT_ABORTED, "error" : lang.DFT_ERROR }[self.error_msg] except: error_msg_trans = self.error_msg # error_msg might also contain info messages like # "waiting", etc. which are not fatal errors text = "%s %s" % (text, error_msg_trans) # a fatal error if self.error: self.btn_cancel.SetLabel(lang.BTN_CLOSE) if self.is_receiver: self.btn_save.Enable(False) self.text.SetLabel(text) if self.bytes_complete == self.bytes_total: self.completed = True self.progress_bar.SetValue(100) if self.is_receiver: if self.file_name_save != "": self.btn_cancel.SetLabel(lang.BTN_CLOSE) self.transfer_object.close() #this will actually save the file else: self.btn_cancel.SetLabel(lang.BTN_CLOSE) def onDataChange(self, total, complete, error_msg=""): #will be called from the FileSender/FileReceiver-object in the #protocol module to update gui (called from a non-GUI thread!) self.bytes_total = total self.bytes_complete = complete self.error_msg = error_msg #we must use wx.Callafter to make calls into wx #because we are *NOT* in the context of the GUI thread here wx.CallAfter(self.updateOutput) def onCancel(self, evt): try: # this is not always a real "cancel": # FileReceiver.close() *after* successful transmission # will save the file (if file name is known) self.transfer_object.close() except: pass self.Close() def onSave(self, evt): title = lang.DFT_FILE_SAVE_TITLE % self.buddy.getAddressAndDisplayName() dialog = wx.FileDialog(self, title, defaultFile=self.file_name, style=wx.SAVE) if config.isPortable(): dialog.SetDirectory(config.getDataDir()) else: dialog.SetDirectory(config.getHomeDir()) if dialog.ShowModal() == wx.ID_OK: self.file_name_save = dialog.GetPath() if os.path.exists(self.file_name_save): overwrite = wx.MessageBox(lang.D_WARN_FILE_ALREADY_EXISTS_MESSAGE % self.file_name_save, lang.D_WARN_FILE_ALREADY_EXISTS_TITLE, wx.YES_NO) if overwrite != wx.YES: self.file_name_save = "" return self.transfer_object.setFileNameSave(self.file_name_save) if not self.transfer_object.file_handle_save: error = self.transfer_object.file_save_error wx.MessageBox(lang.D_WARN_FILE_SAVE_ERROR_MESSAGE % (self.file_name_save, error), lang.D_WARN_FILE_SAVE_ERROR_TITLE) self.file_name_save = "" return self.btn_save.Enable(False) if self.completed: self.onCancel(evt) else: pass class MainWindow(wx.Frame): def __init__(self, socket=None): wx.Frame.__init__( self, None, -1, "TorChat", size=( config.getint("gui", "main_window_width"), config.getint("gui", "main_window_height") ) ) self.conns = [] self.chat_windows = [] self.buddy_list = tc_client.BuddyList(self.callbackMessage, socket) self.SetTitle("TorChat: %s" % config.getProfileLongName()) self.Bind(wx.EVT_CLOSE, self.onClose) # setup gui elements self.taskbar_icon = TaskbarIcon(self) self.main_panel = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) self.gui_bl = BuddyList(self.main_panel, self) sizer.Add(self.gui_bl, 1, wx.EXPAND) self.status_switch = StatusSwitch(self.main_panel, self) sizer.Add(self.status_switch, 0, wx.EXPAND) self.main_panel.SetSizer(sizer) sizer.FitInside(self) icon = wx.Icon(name=os.path.join(config.ICON_DIR, "torchat.ico"), type=wx.BITMAP_TYPE_ICO) self.SetIcon(icon) if not config.getint("gui", "open_main_window_hidden"): self.Show() def setStatus(self, status): self.buddy_list.setStatus(status) self.taskbar_icon.showStatus(status) def callbackMessage(self, callback_type, callback_data): #we must always use wx.CallAfter() to interact with #the GUI-Thread because this method will be called #in the context of one of the connection threads if callback_type == tc_client.CB_TYPE_CHAT: buddy, message = callback_data for window in self.chat_windows: if window.buddy == buddy: wx.CallAfter(window.process, message) return #no window found, so we create a new one hidden = config.getint("gui", "open_chat_window_hidden") wx.CallAfter(ChatWindow, self, buddy, message, hidden) #we let this thread block until the window #shows up in our chat window list found = False while not found: time.sleep(1) for window in self.chat_windows: if window.buddy == buddy: found = True break if callback_type == tc_client.CB_TYPE_OFFLINE_SENT: buddy = callback_data for window in self.chat_windows: if window.buddy == buddy: wx.CallAfter(window.notifyOfflineSent) return hidden = config.getint("gui", "open_chat_window_hidden") wx.CallAfter(ChatWindow, self, buddy, "", hidden, notify_offline_sent=True) if callback_type == tc_client.CB_TYPE_FILE: #this happens when an incoming file transfer was initialized #we must now create a FileTransferWindow and return its #event handler method to the caller receiver = callback_data buddy = receiver.buddy file_name = receiver.file_name #we cannot get return values from wx.CallAfter() calls #so we have to CallAfter() and then just wait for #the TransferWindow to appear. wx.CallAfter(FileTransferWindow, self, buddy, file_name, receiver) if callback_type == tc_client.CB_TYPE_STATUS: # this is called when the status of one of the # buddies has changed. callback_data is the Buddy instance wx.CallAfter(self.gui_bl.onBuddyStatusChanged, callback_data) if callback_type == tc_client.CB_TYPE_AVATAR: # this is called when the avatar of one of the # buddy has changed. callback_data is the Buddy instance wx.CallAfter(self.gui_bl.onBuddyAvatarChanged, callback_data) if callback_type == tc_client.CB_TYPE_PROFILE: # this is called when the profile of one of the # buddy has changed. callback_data is the Buddy instance wx.CallAfter(self.gui_bl.onBuddyProfileChanged, callback_data) if callback_type == tc_client.CB_TYPE_LIST_CHANGED: try: wx.CallAfter(self.gui_bl.onListChanged) except: # might be too early and there is no gui_bl object yet. # But this does not matter because gui_bl itself will # call this at least once after initialization. pass if callback_type == tc_client.CB_TYPE_REMOVE: # called when the client is removing the buddy from the list # callback_data is the buddy for window in self.chat_windows: if window.buddy == callback_data: wx.CallAfter(window.Close) def onClose(self, evt): self.Show(False) def exitProgram(self): w,h = self.GetSize() config.set("gui", "main_window_width", w) config.set("gui", "main_window_height", h) found_unread = False for window in self.chat_windows: if not window.IsShown() or window.unread: found_unread = True break if found_unread: answer = wx.MessageBox(lang.D_WARN_UNREAD_MESSAGE, lang.D_WARN_UNREAD_TITLE, wx.YES_NO|wx.NO_DEFAULT) if answer == wx.NO: return self.taskbar_icon.RemoveIcon() self.buddy_list.stopClient() #this will also stop portable Tor # All my threads wouldn't join properly. Don't know why. # sys.exit() would spew lots of tracebacks *sometimes*, # so let's do it the easy way and just kill ourself: config.killProcess(os.getpid()) src/version.py0000666000175000017500000000067612023127150013224 0ustar dererkdererkNAME = "TorChat" VERSION_MAJOR = "0.9.9" VERSION_SVN = 553 EXPERIMENTAL = False # here used to be code that scanned the .svn dirs for the revision # number, generated a cache file if no svn was found, etc. # now I'm on git and for simplicity just manually increment # VERSION_SVN after each official release. VERSION = VERSION_MAJOR + "." + str(VERSION_SVN) VERSION_ONLY = VERSION if EXPERIMENTAL: VERSION += "-experimental" src/tc_mac.py0000666000175000017500000000636511714662540013003 0ustar dererkdererk# vim: set tw=0 sw=4 sts=4 expandtab: import wx def getActiveWindow(): wins = wx.GetTopLevelWindows() for win in wins: if win.IsActive(): return win return None class App(wx.App): def __init__(self, *args, **kwargs): wx.App.__init__(self, *args, **kwargs) self.Bind(wx.EVT_ACTIVATE_APP, self.onActivate) fileMenu = wx.Menu() item = fileMenu.Append(wx.ID_EXIT) self.Bind(wx.EVT_MENU, self.onExit, item) item = fileMenu.Append(wx.ID_OPEN, text = 'Open Contacts') self.Bind(wx.EVT_MENU, self.onOpenContacts, item) item = fileMenu.Append(wx.ID_CLOSE, text = '&Close\tCtrl+W') self.Bind(wx.EVT_UPDATE_UI, self.canClose, item) self.Bind(wx.EVT_MENU, self.onClose, item) #item = fileMenu.Append(wx.ID_PREFERENCES, text = "Settings") #self.Bind(wx.EVT_MENU, self.onPrefs, item) editMenu = wx.Menu() item = editMenu.Append(wx.ID_CUT, text = 'Cut\tCtrl+X') self.Bind(wx.EVT_UPDATE_UI, self.canCut, item) self.Bind(wx.EVT_MENU, self.onCut, item) item = editMenu.Append(wx.ID_COPY, text = '&Copy\tCtrl+C') self.Bind(wx.EVT_UPDATE_UI, self.canCopy, item) self.Bind(wx.EVT_MENU, self.onCopy, item) item = editMenu.Append(wx.ID_PASTE, text = 'Paste\tCtrl+V') self.Bind(wx.EVT_UPDATE_UI, self.canPaste, item) self.Bind(wx.EVT_MENU, self.onPaste, item) mb = wx.MenuBar() mb.Append(fileMenu, "&File") mb.Append(editMenu, "&Edit") wx.MenuBar.MacSetCommonMenuBar(mb) def BringWindowToFront(self): try: mw = self.GetTopWindow() mw.Show(True) mw.Raise() except: pass def onActivate(self, event): if event.GetActive(): self.BringWindowToFront() event.Skip() def onOpenContacts(self, event): self.BringWindowToFront() def canClose(self, event): # This isn't implemented for some reason... # win = wx.GetActiveWindow() # So cache this value self.win = getActiveWindow() event.Enable(self.win is not None) def onClose(self, event): self.win.Close() def MacReopenApp(self): self.BringWindowToFront() def onExit(self, event): self.GetTopWindow().exitProgram() def canCut(self, event): focus = wx.Window.FindFocus() # Annoyingly without the is True this returns None sometimes event.Enable((focus and hasattr(focus, 'CanCut') and focus.CanCut()) is True) def onCut(self, event): focus = wx.Window.FindFocus() focus.Cut() def canCopy(self, event): focus = wx.Window.FindFocus() event.Enable((focus and hasattr(focus, 'CanCopy') and focus.CanCopy()) is True) def onCopy(self, event): focus = wx.Window.FindFocus() focus.Copy() def canPaste(self, event): focus = wx.Window.FindFocus() event.Enable((focus and hasattr(focus, 'CanPaste') and focus.CanPaste()) is True) def onPaste(self, event): focus = wx.Window.FindFocus() focus.Paste() src/dlg.py0000666000175000017500000001622611714662540012320 0ustar dererkdererk############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # This program is licensed under the GNU General Public License V3, # # the full source code is included in the binary distribution. # # # # Included in the distribution are files from other open source projects: # # - TOR Onion Router (c) The Tor Project, 3-clause-BSD # # - SocksiPy (c) Dan Haim, BSD Style License # # - Gajim buddy status icons (c) The Gajim Team, GNU GPL # # # ############################################################################## # Here are some classes that help me with some boring layout stuff and some # other things with controls and their labels inside sizers on a wx.Panel import wx import config import textwrap def wrap(text): if len(text) > 30: text = textwrap.fill(text, 20) return text class Panel(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent, wx.ID_ANY) self.parent = parent self.px = 0 self.py = 0 self.controls = [] self.last_separator = None self.outer_sizer = wx.BoxSizer() self.grid_sizer = wx.GridBagSizer(vgap=5, hgap=5) self.SetSizer(self.outer_sizer) self.outer_sizer.Add(self.grid_sizer, 1, wx.ALL | wx.EXPAND, 5) self.grid_sizer.SetCols(2) self.grid_sizer.AddGrowableCol(1) self.grid_sizer.SetMinSize((300, -1)) def addItem(self, item, offset_x=0, span=(1,1), flags=0, new_line=False): x = self.px + offset_x y = self.py self.grid_sizer.Add(item, (y, x), span, flags) if new_line: self.py += 1 def addSeparatorItem(self, sep): self.grid_sizer.Add(sep.hbox, (self.py, self.px), (1, 2), wx.EXPAND) self.last_separator = sep def registerControl(self, control): self.controls.append(control) try: self.last_separator.controls.append(control) except: pass def newLine(self): self.py += 1 def fit(self): self.outer_sizer.Fit(self.parent) def saveAllData(self): for control in self.controls: control.save() class Control(object): def __init__(self, panel, label, default): self.panel = panel self.label = label self.from_config = False self.default = self.getDefault(default) if self.label: self.wx_label = wx.StaticText(self.panel, wx.ID_ANY, wrap(self.label)) self.wx_ctrl = None self.panel.registerControl(self) def getDefault(self, default): if type(default) == tuple: self.config_section = default[0] self.config_option = default[1] self.from_config = True return self.readConfig(default[0], default[1]) else: return default def setEnabled(self, enabled): self.wx_label.Enable(enabled) if self.wx_ctrl: self.wx_ctrl.Enable(enabled) def getValue(self): if self.wx_ctrl: return self.wx_ctrl.GetValue() else: return None def save(self): if self.from_config: config.set(self.config_section, self.config_option, self.getValue()) def readConfig(self, section, option): return config.get(section, option) class Text(Control): def __init__(self, panel, label, default, expand=False): Control.__init__(self, panel, label, default) self.wx_ctrl = wx.TextCtrl(self.panel, wx.ID_ANY, self.default) box = wx.BoxSizer(wx.VERTICAL) box.Add(self.wx_ctrl, 0, wx.EXPAND) self.panel.addItem(self.wx_label) if expand: self.panel.addItem(box, 1, flags=wx.EXPAND, new_line=True) else: self.panel.addItem(box, 1, new_line=True) class Dir(Control): def __init__(self, panel, label, default, width=0): Control.__init__(self, panel, label, default) box = wx.BoxSizer(wx.HORIZONTAL) self.wx_ctrl self.wx_ctrl = wx.TextCtrl(self.panel, wx.ID_ANY, self.default) box.Add(self.wx_ctrl, 1, wx.EXPAND) self.button = wx.Button(self.panel, wx.ID_ANY, "...") size_btn = self.wx_ctrl.GetSize()[1] #the height self.button.SetSizeHints(size_btn, size_btn) box.Add(self.button, 0) box1 = wx.BoxSizer(wx.VERTICAL) box1.Add(box, 0, wx.EXPAND) self.panel.addItem(self.wx_label) self.panel.addItem(box1, 1, flags=wx.EXPAND, new_line=True) self.button.Bind(wx.EVT_BUTTON, self.onClick) def onClick(self, evt): dir_dialog = wx.DirDialog(self.panel) dir_dialog.SetPath(self.wx_ctrl.GetValue()) res = dir_dialog.ShowModal() if res == wx.ID_OK: self.wx_ctrl.SetValue(dir_dialog.GetPath()) def setEnabled(self, enabled): Control.setEnabled(self, enabled) self.button.Enable(enabled) class Check(Control): def __init__(self, panel, label, default): Control.__init__(self, panel, None, default) self.wx_ctrl = wx.CheckBox(self.panel, wx.ID_ANY) self.wx_ctrl.SetValue(bool(self.default)) self.wx_ctrl.SetLabel(label) self.panel.addItem(self.wx_ctrl, 0, span=(1, 2), flags=wx.EXPAND, new_line=True) def readConfig(self, section, option): return config.getint(section, option) class Separator(Control): def __init__(self, panel, label): #completely different constructor self.panel = panel self.hbox = wx.BoxSizer(wx.HORIZONTAL) self.wx_label = wx.StaticText(self.panel, wx.ID_ANY, label) self.hbox.Add(self.wx_label, 0, wx.EXPAND | wx.TOP, 5) #line must be in a box sizer or it will expand vertically sepbox = wx.BoxSizer(wx.VERTICAL) self.wx_ctrl = wx.StaticLine(self.panel, wx.ID_ANY) sepbox.Add(self.wx_ctrl, 0, wx.EXPAND | wx.TOP, 15) self.hbox.Add(sepbox, 1, wx.EXPAND) self.panel.addSeparatorItem(self) self.panel.newLine() #make the label bold font = self.wx_label.GetFont() font.SetWeight(wx.BOLD) self.wx_label.SetFont(font) #an array of controls below this separator self.controls = [] def setEnabled(self, enabled): Control.setEnabled(self, enabled) for control in self.controls: control.setEnabled(enabled) src/SocksiPy/0000755000175000017500000000000012074647461012736 5ustar dererkdererksrc/SocksiPy/socks.py0000666000175000017500000003745211714662540014444 0ustar dererkdererk"""SocksiPy - Python SOCKS module. Version 1.00 Copyright 2006 Dan-Haim. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of Dan Haim nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY DAN HAIM "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAN HAIM OR HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMANGE. This module provides a standard socket-like interface for Python for tunneling connections through SOCKS proxies. """ import socket import struct PROXY_TYPE_SOCKS4 = 1 PROXY_TYPE_SOCKS5 = 2 PROXY_TYPE_HTTP = 3 _defaultproxy = None _orgsocket = socket.socket class ProxyError(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) class GeneralProxyError(ProxyError): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) class Socks5AuthError(ProxyError): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) class Socks5Error(ProxyError): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) class Socks4Error(ProxyError): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) class HTTPError(ProxyError): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) _generalerrors = ("success", "invalid data", "not connected", "not available", "bad proxy type", "bad input") _socks5errors = ("succeeded", "general SOCKS server failure", "connection not allowed by ruleset", "Network unreachable", "Host unreachable", "Connection refused", "TTL expired", "Command not supported", "Address type not supported", "Unknown error") _socks5autherrors = ("succeeded", "authentication is required", "all offered authentication methods were rejected", "unknown username or invalid password", "unknown error") _socks4errors = ("request granted", "request rejected or failed", "request rejected because SOCKS server cannot connect to identd on the client", "request rejected because the client program and identd report different user-ids", "unknown error") def setdefaultproxy(proxytype=None,addr=None,port=None,rdns=True,username=None,password=None): """setdefaultproxy(proxytype, addr[, port[, rdns[, username[, password]]]]) Sets a default proxy which all further socksocket objects will use, unless explicitly changed. """ global _defaultproxy _defaultproxy = (proxytype,addr,port,rdns,username,password) class socksocket(socket.socket): """socksocket([family[, type[, proto]]]) -> socket object Open a SOCKS enabled socket. The parameters are the same as those of the standard socket init. In order for SOCKS to work, you must specify family=AF_INET, type=SOCK_STREAM and proto=0. """ def __init__(self, family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0, _sock=None): _orgsocket.__init__(self,family,type,proto,_sock) if _defaultproxy != None: self.__proxy = _defaultproxy else: self.__proxy = (None, None, None, None, None, None) self.__proxysockname = None self.__proxypeername = None def __recvall(self, bytes): """__recvall(bytes) -> data Receive EXACTLY the number of bytes requested from the socket. Blocks until the required number of bytes have been received. """ data = "" while len(data) < bytes: received = self.recv(bytes-len(data)) if received == "": raise IOError data = data + received return data def setproxy(self,proxytype=None,addr=None,port=None,rdns=True,username=None,password=None): """setproxy(proxytype, addr[, port[, rdns[, username[, password]]]]) Sets the proxy to be used. proxytype - The type of the proxy to be used. Three types are supported: PROXY_TYPE_SOCKS4 (including socks4a), PROXY_TYPE_SOCKS5 and PROXY_TYPE_HTTP addr - The address of the server (IP or DNS). port - The port of the server. Defaults to 1080 for SOCKS servers and 8080 for HTTP proxy servers. rdns - Should DNS queries be preformed on the remote side (rather than the local side). The default is True. Note: This has no effect with SOCKS4 servers. username - Username to authenticate with to the server. The default is no authentication. password - Password to authenticate with to the server. Only relevant when username is also provided. """ self.__proxy = (proxytype,addr,port,rdns,username,password) def __negotiatesocks5(self,destaddr,destport): """__negotiatesocks5(self,destaddr,destport) Negotiates a connection through a SOCKS5 server. """ # First we'll send the authentication packages we support. if (self.__proxy[4]!=None) and (self.__proxy[5]!=None): # The username/password details were supplied to the # setproxy method so we support the USERNAME/PASSWORD # authentication (in addition to the standard none). self.sendall("\x05\x02\x00\x02") else: # No username/password were entered, therefore we # only support connections with no authentication. self.sendall("\x05\x01\x00") # We'll receive the server's response to determine which # method was selected chosenauth = self.__recvall(2) if chosenauth[0] != "\x05": self.close() raise GeneralProxyError((1,_generalerrors[1])) # Check the chosen authentication method if chosenauth[1] == "\x00": # No authentication is required pass elif chosenauth[1] == "\x02": # Okay, we need to perform a basic username/password # authentication. self.sendall("\x01" + chr(len(self.__proxy[4])) + self.__proxy[4] + chr(len(self.proxy[5])) + self.__proxy[5]) authstat = self.__recvall(2) if authstat[0] != "\x01": # Bad response self.close() raise GeneralProxyError((1,_generalerrors[1])) if authstat[1] != "\x00": # Authentication failed self.close() raise Socks5AuthError,((3,_socks5autherrors[3])) # Authentication succeeded else: # Reaching here is always bad self.close() if chosenauth[1] == "\xFF": raise Socks5AuthError((2,_socks5autherrors[2])) else: raise GeneralProxyError((1,_generalerrors[1])) # Now we can request the actual connection req = "\x05\x01\x00" # If the given destination address is an IP address, we'll # use the IPv4 address request even if remote resolving was specified. try: ipaddr = socket.inet_aton(destaddr) req = req + "\x01" + ipaddr except socket.error: # Well it's not an IP number, so it's probably a DNS name. if self.__proxy[3]==True: # Resolve remotely ipaddr = None req = req + "\x03" + chr(len(destaddr)) + destaddr else: # Resolve locally ipaddr = socket.inet_aton(socket.gethostbyname(destaddr)) req = req + "\x01" + ipaddr req = req + struct.pack(">H",destport) self.sendall(req) # Get the response resp = self.__recvall(4) if resp[0] != "\x05": self.close() raise GeneralProxyError((1,_generalerrors[1])) elif resp[1] != "\x00": # Connection failed self.close() if ord(resp[1])<=8: raise Socks5Error(ord(resp[1]),_generalerrors[ord(resp[1])]) else: raise Socks5Error(9,_generalerrors[9]) # Get the bound address/port elif resp[3] == "\x01": boundaddr = self.__recvall(4) elif resp[3] == "\x03": resp = resp + self.recv(1) boundaddr = self.__recvall(resp[4]) else: self.close() raise GeneralProxyError((1,_generalerrors[1])) boundport = struct.unpack(">H",self.__recvall(2))[0] self.__proxysockname = (boundaddr,boundport) if ipaddr != None: self.__proxypeername = (socket.inet_ntoa(ipaddr),destport) else: self.__proxypeername = (destaddr,destport) def getproxysockname(self): """getsockname() -> address info Returns the bound IP address and port number at the proxy. """ return self.__proxysockname def getproxypeername(self): """getproxypeername() -> address info Returns the IP and port number of the proxy. """ return _orgsocket.getpeername(self) def getpeername(self): """getpeername() -> address info Returns the IP address and port number of the destination machine (note: getproxypeername returns the proxy) """ return self.__proxypeername def __negotiatesocks4(self,destaddr,destport): """__negotiatesocks4(self,destaddr,destport) Negotiates a connection through a SOCKS4 server. """ # Check if the destination address provided is an IP address rmtrslv = False try: ipaddr = socket.inet_aton(destaddr) except socket.error: # It's a DNS name. Check where it should be resolved. if self.__proxy[3]==True: ipaddr = "\x00\x00\x00\x01" rmtrslv = True else: ipaddr = socket.inet_aton(socket.gethostbyname(destaddr)) # Construct the request packet req = "\x04\x01" + struct.pack(">H",destport) + ipaddr # The username parameter is considered userid for SOCKS4 if self.__proxy[4] != None: req = req + self.__proxy[4] req = req + "\x00" # DNS name if remote resolving is required # NOTE: This is actually an extension to the SOCKS4 protocol # called SOCKS4A and may not be supported in all cases. if rmtrslv==True: req = req + destaddr + "\x00" self.sendall(req) # Get the response from the server resp = self.__recvall(8) if resp[0] != "\x00": # Bad data self.close() raise GeneralProxyError((1,_generalerrors[1])) if resp[1] != "\x5A": # Server returned an error self.close() if ord(resp[1]) in (91,92,93): self.close() raise Socks4Error((ord(resp[1]),_socks4errors[ord(resp[1])-90])) else: raise Socks4Error((94,_socks4errors[4])) # Get the bound address/port self.__proxysockname = (socket.inet_ntoa(resp[4:]),struct.unpack(">H",resp[2:4])[0]) if rmtrslv != None: self.__proxypeername = (socket.inet_ntoa(ipaddr),destport) else: self.__proxypeername = (destaddr,destport) def __negotiatehttp(self,destaddr,destport): """__negotiatehttp(self,destaddr,destport) Negotiates a connection through an HTTP server. """ # If we need to resolve locally, we do this now if self.__proxy[3] == False: addr = socket.gethostbyname(destaddr) else: addr = destaddr self.sendall("CONNECT " + addr + ":" + str(destport) + " HTTP/1.1\r\n" + "Host: " + destaddr + "\r\n\r\n") # We read the response until we get the string "\r\n\r\n" resp = self.recv(1) while resp.find("\r\n\r\n")==-1: resp = resp + self.recv(1) # We just need the first line to check if the connection # was successful statusline = resp.splitlines()[0].split(" ",2) if statusline[0] not in ("HTTP/1.0","HTTP/1.1"): self.close() raise GeneralProxyError((1,_generalerrors[1])) try: statuscode = int(statusline[1]) except ValueError: self.close() raise GeneralProxyError((1,_generalerrors[1])) if statuscode != 200: self.close() raise HTTPError((statuscode,statusline[2])) self.__proxysockname = ("0.0.0.0",0) self.__proxypeername = (addr,destport) def connect(self,destpair): """connect(self,despair) Connects to the specified destination through a proxy. destpar - A tuple of the IP/DNS address and the port number. (identical to socket's connect). To select the proxy server use setproxy(). """ # Do a minimal input check first if (type(destpair) in (list,tuple)==False) or (len(destpair)<2) or (type(destpair[0])!=str) or (type(destpair[1])!=int): raise GeneralProxyError((5,_generalerrors[5])) if self.__proxy[0] == PROXY_TYPE_SOCKS5: if self.__proxy[2] != None: portnum = self.__proxy[2] else: portnum = 1080 _orgsocket.connect(self,(self.__proxy[1],portnum)) self.__negotiatesocks5(destpair[0],destpair[1]) elif self.__proxy[0] == PROXY_TYPE_SOCKS4: if self.__proxy[2] != None: portnum = self.__proxy[2] else: portnum = 1080 _orgsocket.connect(self,(self.__proxy[1],portnum)) self.__negotiatesocks4(destpair[0],destpair[1]) elif self.__proxy[0] == PROXY_TYPE_HTTP: if self.__proxy[2] != None: portnum = self.__proxy[2] else: portnum = 8080 _orgsocket.connect(self,(self.__proxy[1],portnum)) self.__negotiatehttp(destpair[0],destpair[1]) elif self.__proxy[0] == None: _orgsocket.connect(self,(destpair[0],destpair[1])) else: raise GeneralProxyError((4,_generalerrors[4])) src/SocksiPy/LICENSE0000666000175000017500000000261711714662540013750 0ustar dererkdererkCopyright 2006 Dan-Haim. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of Dan Haim nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY DAN HAIM "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAN HAIM OR HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMANGE. src/SocksiPy/README0000666000175000017500000002202111714662540013612 0ustar dererkdererkSocksiPy version 1.00 A Python SOCKS module. (C) 2006 Dan-Haim. All rights reserved. See LICENSE file for details. WHAT IS A SOCKS PROXY? A SOCKS proxy is a proxy server at the TCP level. In other words, it acts as a tunnel, relaying all traffic going through it without modifying it. SOCKS proxies can be used to relay traffic using any network protocol that uses TCP. WHAT IS SOCKSIPY? This Python module allows you to create TCP connections through a SOCKS proxy without any special effort. PROXY COMPATIBILITY SocksiPy is compatible with three different types of proxies: 1. SOCKS Version 4 (Socks4), including the Socks4a extension. 2. SOCKS Version 5 (Socks5). 3. HTTP Proxies which support tunneling using the CONNECT method. SYSTEM REQUIREMENTS Being written in Python, SocksiPy can run on any platform that has a Python interpreter and TCP/IP support. This module has been tested with Python 2.3 and should work with greater versions just as well. INSTALLATION ------------- Simply copy the file "socks.py" to your Python's lib/site-packages directory, and you're ready to go. USAGE ------ First load the socks module with the command: >>> import socks >>> The socks module provides a class called "socksocket", which is the base to all of the module's functionality. The socksocket object has the same initialization parameters as the normal socket object to ensure maximal compatibility, however it should be noted that socksocket will only function with family being AF_INET and type being SOCK_STREAM. Generally, it is best to initialize the socksocket object with no parameters >>> s = socks.socksocket() >>> The socksocket object has an interface which is very similiar to socket's (in fact the socksocket class is derived from socket) with a few extra methods. To select the proxy server you would like to use, use the setproxy method, whose syntax is: setproxy(proxytype, addr[, port[, rdns[, username[, password]]]]) Explaination of the parameters: proxytype - The type of the proxy server. This can be one of three possible choices: PROXY_TYPE_SOCKS4, PROXY_TYPE_SOCKS5 and PROXY_TYPE_HTTP for Socks4, Socks5 and HTTP servers respectively. addr - The IP address or DNS name of the proxy server. port - The port of the proxy server. Defaults to 1080 for socks and 8080 for http. rdns - This is a boolean flag than modifies the behavior regarding DNS resolving. If it is set to True, DNS resolving will be preformed remotely, on the server. If it is set to False, DNS resolving will be preformed locally. Please note that setting this to True with Socks4 servers actually use an extension to the protocol, called Socks4a, which may not be supported on all servers (Socks5 and http servers always support DNS). The default is True. username - For Socks5 servers, this allows simple username / password authentication with the server. For Socks4 servers, this parameter will be sent as the userid. This parameter is ignored if an HTTP server is being used. If it is not provided, authentication will not be used (servers may accept unauthentication requests). password - This parameter is valid only for Socks5 servers and specifies the respective password for the username provided. Example of usage: >>> s.setproxy(socks.PROXY_TYPE_SOCKS5,"socks.example.com") >>> After the setproxy method has been called, simply call the connect method with the traditional parameters to establish a connection through the proxy: >>> s.connect(("www.sourceforge.net",80)) >>> Connection will take a bit longer to allow negotiation with the proxy server. Please note that calling connect without calling setproxy earlier will connect without a proxy (just like a regular socket). Errors: Any errors in the connection process will trigger exceptions. The exception may either be generated by the underlying socket layer or may be custom module exceptions, whose details follow: class ProxyError - This is a base exception class. It is not raised directly but rather all other exception classes raised by this module are derived from it. This allows an easy way to catch all proxy-related errors. class GeneralProxyError - When thrown, it indicates a problem which does not fall into another category. The parameter is a tuple containing an error code and a description of the error, from the following list: 1 - invalid data - This error means that unexpected data has been received from the server. The most common reason is that the server specified as the proxy is not really a Socks4/Socks5/HTTP proxy, or maybe the proxy type specified is wrong. 4 - bad proxy type - This will be raised if the type of the proxy supplied to the setproxy function was not PROXY_TYPE_SOCKS4/PROXY_TYPE_SOCKS5/PROXY_TYPE_HTTP. 5 - bad input - This will be raised if the connect method is called with bad input parameters. class Socks5AuthError - This indicates that the connection through a Socks5 server failed due to an authentication problem. The parameter is a tuple containing a code and a description message according to the following list: 1 - authentication is required - This will happen if you use a Socks5 server which requires authentication without providing a username / password at all. 2 - all offered authentication methods were rejected - This will happen if the proxy requires a special authentication method which is not supported by this module. 3 - unknown username or invalid password - Self descriptive. class Socks5Error - This will be raised for Socks5 errors which are not related to authentication. The parameter is a tuple containing a code and a description of the error, as given by the server. The possible errors, according to the RFC are: 1 - General SOCKS server failure - If for any reason the proxy server is unable to fulfill your request (internal server error). 2 - connection not allowed by ruleset - If the address you're trying to connect to is blacklisted on the server or requires authentication. 3 - Network unreachable - The target could not be contacted. A router on the network had replied with a destination net unreachable error. 4 - Host unreachable - The target could not be contacted. A router on the network had replied with a destination host unreachable error. 5 - Connection refused - The target server has actively refused the connection (the requested port is closed). 6 - TTL expired - The TTL value of the SYN packet from the proxy to the target server has expired. This usually means that there are network problems causing the packet to be caught in a router-to-router "ping-pong". 7 - Command not supported - The client has issued an invalid command. When using this module, this error should not occur. 8 - Address type not supported - The client has provided an invalid address type. When using this module, this error should not occur. class Socks4Error - This will be raised for Socks4 errors. The parameter is a tuple containing a code and a description of the error, as given by the server. The possible error, according to the specification are: 1 - Request rejected or failed - Will be raised in the event of an failure for any reason other then the two mentioned next. 2 - request rejected because SOCKS server cannot connect to identd on the client - The Socks server had tried an ident lookup on your computer and has failed. In this case you should run an identd server and/or configure your firewall to allow incoming connections to local port 113 from the remote server. 3 - request rejected because the client program and identd report different user-ids - The Socks server had performed an ident lookup on your computer and has received a different userid than the one you have provided. Change your userid (through the username parameter of the setproxy method) to match and try again. class HTTPError - This will be raised for HTTP errors. The parameter is a tuple containing the HTTP status code and the description of the server. After establishing the connection, the object behaves like a standard socket. Call the close method to close the connection. In addition to the socksocket class, an additional function worth mentioning is the setdefaultproxy function. The parameters are the same as the setproxy method. This function will set default proxy settings for newly created socksocket objects, in which the proxy settings haven't been changed via the setproxy method. This is quite useful if you wish to force 3rd party modules to use a socks proxy, by overriding the socket object. For example: >>> socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5,"socks.example.com") >>> socket.socket = socks.socksocket >>> urllib.urlopen("http://www.sourceforge.net/") PROBLEMS --------- If you have any problems using this module, please first refer to the BUGS file (containing current bugs and issues). If your problem is not mentioned you may contact the author at the following E-Mail address: negativeiq@users.sourceforge.net Please allow some time for your question to be received and handled. Dan-Haim, Author. src/SocksiPy/BUGS0000666000175000017500000000115611714662540013423 0ustar dererkdererkSocksiPy version 1.00 A Python SOCKS module. (C) 2006 Dan-Haim. All rights reserved. See LICENSE file for details. KNOWN BUGS AND ISSUES ---------------------- There are no currently known bugs in this module. There are some limits though: 1) Only outgoing connections are supported - This module currently only supports outgoing TCP connections, though some servers may support incoming connections as well. UDP is not supported either. 2) GSSAPI Socks5 authenticaion is not supported. If you find any new bugs, please contact the author at: negativeiq@users.sourceforge.net Thank you! src/SocksiPy/__init__.py0000666000175000017500000000000011714662540015034 0ustar dererkdererksrc/dlg_settings.py0000666000175000017500000001265111714662540014236 0ustar dererkdererk############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # This program is licensed under the GNU General Public License V3, # # the full source code is included in the binary distribution. # # # # Included in the distribution are files from other open source projects: # # - TOR Onion Router (c) The Tor Project, 3-clause-BSD # # - SocksiPy (c) Dan Haim, BSD Style License # # - Gajim buddy status icons (c) The Gajim Team, GNU GPL # # # ############################################################################## # This is the settings dialog import wx import dlg import config import tc_client import translations lang = translations.lang_en class Dialog(wx.Dialog): def __init__(self, main_window): wx.Dialog.__init__(self, main_window, wx.ID_ANY, lang.DSET_TITLE) self.mw = main_window #1 outer panel and vertical sizer self.outer_panel = wx.Panel(self) outer_sizer = wx.BoxSizer(wx.VERTICAL) self.outer_panel.SetSizer(outer_sizer) #1.1 the notebook on the top self.notebook = wx.Notebook(self.outer_panel) outer_sizer.Add(self.notebook, 1, wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, border=5) #1.2 the button_sizer at the bottom button_sizer = wx.BoxSizer(wx.HORIZONTAL) outer_sizer.Add(button_sizer, 0, wx.ALIGN_RIGHT | wx.ALL, border=5) #1.2.1 cancel button btn_cancel = wx.Button(self.outer_panel, wx.ID_CANCEL, lang.BTN_CANCEL) button_sizer.Add(btn_cancel) #1.2.2 ok button btn_ok = wx.Button(self.outer_panel, wx.ID_OK, lang.BTN_OK) button_sizer.Add(btn_ok, 0, wx.LEFT, 5) #2 the button bindings btn_ok.Bind(wx.EVT_BUTTON, self.onOk) btn_cancel.Bind(wx.EVT_BUTTON, self.onCancel) #3 now we create the notebook tabs #3.1 network self.p1 = dlg.Panel(self.notebook) self.notebook.AddPage(self.p1, lang.DSET_NET_TITLE) self.s_tor_portable = dlg.Separator(self.p1, "Tor portable") dlg.Text(self.p1, lang.DSET_NET_TOR_ADDRESS, ("tor_portable", "tor_server"), True) dlg.Text(self.p1, lang.DSET_NET_TOR_SOCKS, ("tor_portable", "tor_server_socks_port")) dlg.Text(self.p1, lang.DSET_NET_TOR_CONTROL, ("tor_portable", "tor_server_control_port")) self.s_tor = dlg.Separator(self.p1, "Tor") dlg.Text(self.p1, lang.DSET_NET_TOR_ADDRESS, ("tor", "tor_server"), True) dlg.Text(self.p1, lang.DSET_NET_TOR_SOCKS, ("tor", "tor_server_socks_port")) dlg.Text(self.p1, lang.DSET_NET_TOR_CONTROL, ("tor", "tor_server_control_port")) dlg.Text(self.p1, lang.DSET_NET_OWN_HOSTNAME, ("client", "own_hostname"), True) dlg.Separator(self.p1, "Client") dlg.Text(self.p1, lang.DSET_NET_LISTEN_INTERFACE, ("client", "listen_interface"), True) dlg.Text(self.p1, lang.DSET_NET_LISTEN_PORT, ("client", "listen_port")) self.p1.fit() portable = (tc_client.TOR_CONFIG == "tor_portable") if portable: self.s_tor.setEnabled(False) else: self.s_tor_portable.setEnabled(False) #3.2 user interface self.p2 = dlg.Panel(self.notebook) self.notebook.AddPage(self.p2, lang.DSET_GUI_TITLE) self.lang = dlg.Text(self.p2, lang.DSET_GUI_LANGUAGE, ("gui", "language")) self.lang_old = self.lang.getValue() dlg.Check(self.p2, lang.DSET_GUI_OPEN_MAIN_HIDDEN, ("gui", "open_main_window_hidden")) dlg.Check(self.p2, lang.DSET_GUI_OPEN_CHAT_HIDDEN, ("gui", "open_chat_window_hidden")) dlg.Check(self.p2, lang.DSET_GUI_NOTIFICATION_POPUP, ("gui", "notification_popup")) dlg.Text(self.p2, lang.DSET_GUI_NOTIFICATION_METHOD, ("gui", "notification_method")) dlg.Check(self.p2, lang.DSET_GUI_FLASH_WINDOW, ("gui", "notification_flash_window")) #3.3 misc options self.p3 = dlg.Panel(self.notebook) self.notebook.AddPage(self.p3, lang.DSET_MISC_TITLE) self.chk_tmp = dlg.Check(self.p3, lang.DSET_MISC_TEMP_IN_DATA, ("files", "temp_files_in_data_dir")) self.dir_tmp = dlg.Dir(self.p3, lang.DSET_MISC_TEMP_CUSTOM_DIR, ("files", "temp_files_custom_dir")) self.dir_tmp.setEnabled(not self.chk_tmp.getValue()) self.chk_tmp.wx_ctrl.Bind(wx.EVT_CHECKBOX, self.onChkTmp) #4 fit the sizers outer_sizer.Fit(self) def onChkTmp(self, evt): self.dir_tmp.setEnabled(not self.chk_tmp.getValue()) def onCancel(self, evt): evt.Skip() #let the frame now process the Cancel event def onOk(self, evt): self.p1.saveAllData() self.p2.saveAllData() self.p3.saveAllData() if self.lang.getValue() != self.lang_old: config.importLanguage() evt.Skip() #let the frame now process the Ok event src/translations/0000755000175000017500000000000012074647461013713 5ustar dererkdererksrc/translations/readme.txt0000666000175000017500000000441411714662540015713 0ustar dererkdererktranslations ============ lang_en.py is the only language file that is *guaranteed* to be complete. If a language file misses a string, TorChat will just use the version in lang_en.py If you have a new translation file then add it to this directory and update the imports statements in __init__.py. Translation files in the script directory take precedence over the built-in ones in this folder. This is because if someone is using the portable windows version (torchat.exe) and just wants to help translating he has no access to this folder. So if you want to start a new translation, do the following: - make a copy of lang_en.py (it is always complete) rename it to lang_xx.py where xx is the language code used in torchat.ini. and place it *outside* this folder, next to torchat.exe or torchat.py - change the language code in torchat.ini to the new one - start translating the strings in your new lang_xx.py - start TorChat with log_level 2 and look into the log file for error messages relating to the translation. - put your name into the header of the file and send it to me, I will include it in the next release. If you want to update an existing translation because it is outdated and missing some strings: - run TorChat with loglevel 2 to get a list of the missing strings. (if the file has been processed by insert_missing.py as it should be with files from regular releases, then there will be already all missing strings inserted but commented out in the file) - Begin with a copy of the language file in question, add the missing strings (just remove the # before the untranslated definition and translate) and watch the output of the log to see when you are done. - Add your name to the header of the file, to receive fame and immortality, send it to me and I will include it in the next release. You can always work with a copy of the lang_xx file outside of this folder, language files in the script directory take precedence over the built-in ones in the folder "translations" UNICODE! ======== - The file must be saved with the encoding UTF-8 - all string literals have to be in unicode notation: * wrong: FOO_BAR = "something" * right: FOO_BAR = u"something" src/translations/lang_pt.py0000666000175000017500000002024011714662540015706 0ustar dererkdererk# -*- coding: UTF-8 -*- ############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # Translation file for TorChat # # # ############################################################################## LANGUAGE_CODE = u"pt" LANGUAGE_NAME = u"Português" LANGUAGE_NAME_ENGLISH = u"Portuguese" TRANSLATOR_NAMES = [u"Marc Young mycbx@lavabit.com"] #buttons BTN_CANCEL = u"Cancelar" BTN_OK = u"Ok" BTN_SAVE_AS = u"Salvar como..." BTN_CLOSE = u"Fechar" #status ST_AVAILABLE = u"Disponível" ST_AWAY = u"Longe" ST_EXTENDED_AWAY = u"Longe por mais tempo" ST_OFFLINE = u"Desligado" #TaskbarMenu MTB_SHOW_HIDE_TORCHAT = u"Mostrar/Esconder o TorChat" MTB_QUIT = u"Sair" #popup menu MPOP_CHAT = u"Bate-papo..." MPOP_SEND_FILE = u"Enviar arquivo..." MPOP_EDIT_CONTACT = u"Editar contato..." MPOP_DELETE_CONTACT = u"Deletar contato..." MPOP_SHOW_OFFLINE_MESSAGES = u"Mostrar mensagens offline enfileiradas" MPOP_CLEAR_OFFLINE_MESSAGES = u"Limpar mensagens offline enfileiradas" # MPOP_ACTIVATE_LOG = u"Activate logging to file" # MPOP_STOP_LOG = u"Stop logging" # MPOP_DELETE_EXISTING_LOG = u"Delete existing log file" # MPOP_DELETE_AND_STOP_LOG = u"Delete log and stop logging" MPOP_ADD_CONTACT = u"Adicionar contato..." MPOP_ABOUT = u"Sobre o TorChat" MPOP_ASK_AUTHOR = u"Perguntar ao %s..." MPOP_SETTINGS = u"Configurações..." # MPOP_EDIT_MY_PROFILE = u"Edit my profile..." #chat window popup menu CPOP_COPY = u"Copiar" #confirm delete message box D_CONFIRM_DELETE_TITLE = u"Confirmar exclusão" D_CONFIRM_DELETE_MESSAGE = u"Realmente deletar este contato?\n(%s %s)" #warning about log D_LOG_WARNING_TITLE = u"TorChat: O Arquivo de registros(Log) está ativo" D_LOG_WARNING_MESSAGE = u"Arquivo de registros(Log) ativado!\n\nArquivo de registros: %s\n\nLembrar de deletar o arquivo de registros se você terminou de eliminar os erros(debugging) porque o arquivo de registros pode conter informações sensíveis." #warning about used port D_WARN_USED_PORT_TITLE = u"TorChat: Porta em uso " D_WARN_USED_PORT_MESSAGE = u"Algo, provavelmente outra intância do TorChat já está escutando pela porta %s:%s. Você deve criar outro perfil usando diferentes portas para ser possível iniciar o TorChat uma segunda vez." #warnig about unread messages D_WARN_UNREAD_TITLE = u"TorChat: Mensagens não lidas" D_WARN_UNREAD_MESSAGE = u"Essas mensagens não foram lidas.\nElas serão perdidas para sempre!\n\nVocê realmente quer sair do TorChat agora?" #warning about offline buddy D_WARN_BUDDY_OFFLINE_TITLE = u"TorChat: Esse amigo está desligado" D_WARN_BUDDY_OFFLINE_MESSAGE = u"Essa operação não é possível com amigos desligados" #warning about multiple files D_WARN_FILE_ONLY_ONE_TITLE = u"TorChat: Múltiplos arquivos" D_WARN_FILE_ONLY_ONE_MESSAGE = u"Você não pode iniciar a tranferência de arquivos múltiplos usando uma única operação. Inicie transferências uma de cada vez ou ao invés disso envie um arquivo zip." #warning about file save error D_WARN_FILE_SAVE_ERROR_TITLE = u"TorChat: Erro ao salvar arquivo" D_WARN_FILE_SAVE_ERROR_MESSAGE = u"O arquivo '%s' não pôde ser criado.\n\n%s" #warning about file already exists D_WARN_FILE_ALREADY_EXISTS_TITLE = u"TorChat: O arquivo existe" D_WARN_FILE_ALREADY_EXISTS_MESSAGE = u"O arquivo '%s' já existe.\nSobrescrevê-lo?" #dialog: add/edit contact DEC_TITLE_ADD = u"Adicionar novo contato" DEC_TITLE_EDIT = u"Editar contato" DEC_TORCHAT_ID = u"TorChat ID" DEC_DISPLAY_NAME = u"Nome aparente(display name)" DEC_INTRODUCTION = u"Introdução" DEC_MSG_16_CHARACTERS = u"O endereço deve ter 16 caracteres, não %i." DEC_MSG_ONLY_ALPANUM = u"O endereço deve conter apenas números e letras minúsculas" DEC_MSG_ALREADY_ON_LIST = u"%s já está na sua lista" # #dialog: edit my profile # DEP_TITLE = u"Edit my profile" # DEP_NAME = u"Name" # DEP_TEXT = u"Text" # DEP_SET_AVATAR = u"Set Avatar" # DEP_REMOVE_AVATAR = u"Remove Avatar" # DEP_AVATAR_SELECT_PNG = u"Select .PNG file to use as your avatar (will be scaled to 64*64, may contain transparency)" # DEP_PNG_FILES = u"PNG files" # DEP_ALL_FILES = u"All files" # DEP_WARN_TITLE = u"Avatar selection not possible" # DEP_WARN_IS_ALREADY = u"This is already the current avatar" # DEP_WARN_MUST_BE_PNG = u"The avatar must be a .png file" #file transfer window DFT_FILE_OPEN_TITLE = u"Enviar arquivo para %s" DFT_FILE_SAVE_TITLE = u"Salvar arquivo de %s" DFT_SEND = u"Enviando %s\npara %s\n%04.1f%% (%i de %i bytes)" DFT_RECEIVE = u"Recebendo %s\nde %s\n%04.1f%% (%i de %i bytes)" # DFT_WAITING = u"waiting for connection" # DFT_STARTING = u"starting transfer" # DFT_ABORTED = u"transfer aborted" # DFT_COMPLETE = u"transfer complete" # DFT_ERROR = u"error" #settings dialaog DSET_TITLE = u"Configuração do TorChat" DSET_NET_TITLE = u"Rede" DSET_NET_ACTIVE = u"ativo" DSET_NET_INACTIVE = u"inativo" DSET_NET_TOR_ADDRESS = u"Endereço de proxy do Tor" DSET_NET_TOR_SOCKS = u"Porta Socks" DSET_NET_TOR_CONTROL = u"Porta de Controle" DSET_NET_OWN_HOSTNAME = u"Meu próprio TorChat-ID" DSET_NET_LISTEN_INTERFACE = u"Interface de escuta" DSET_NET_LISTEN_PORT = u"Porta de Escuta" DSET_GUI_TITLE = u"Interface do usuário" DSET_GUI_LANGUAGE = u"Língua" DSET_GUI_OPEN_MAIN_HIDDEN = u"Iniciar com a janela principal minimizada" DSET_GUI_OPEN_CHAT_HIDDEN = u"Não abrir novas janelas automáticamente" DSET_GUI_NOTIFICATION_POPUP = u"Pop-up de notificação" # DSET_GUI_NOTIFICATION_METHOD = u"Notification method" DSET_GUI_FLASH_WINDOW = u"Janela rápida quando chegar uma nova mensagem" DSET_MISC_TITLE = u"Variado" DSET_MISC_TEMP_IN_DATA = u"Armazenar arquivos temporários no diretório de dados" DSET_MISC_TEMP_CUSTOM_DIR = u"Diretório temporário (deixar vazio para OS-padrão)" #notices in the chat window (those in square brackets) NOTICE_DELAYED_MSG_WAITING = u"mensagens atrazadas estão esperando para serem enviadas" NOTICE_DELAYED_MSG_SENT = u"as mensagens atrazadas foram enviadas" NOTICE_DELAYED = u"atrazada" #messagebox for offline messages MSG_OFFLINE_TITLE = u"TorChat: mensagens não lidas" MSG_OFFLINE_EMPTY = u"essas não são (mais) mensagens enfileiradas para %s" MSG_OFFLINE_QUEUED = u"mensagens enfileiradas offline para %s:\n\n%s" # #buddy list mouse hover popup # BPOP_BUDDY_IS_OFFLINE = u"Buddy is offline" # BPOP_CONNECTED_AWAITING_RETURN_CONN = u"Connected, awaiting return connection..." # BPOP_CLIENT_SOFTWARE = u"Client: %s %s" # #logging of conversations to file # LOG_HEADER = u"This log file is not signed and has no cogency of proof" # LOG_STARTED = u"Logging started" # LOG_STOPPED = u"Logging stopped" # LOG_DELETED = u"Log files have been deleted" # LOG_IS_ACTIVATED = u"Logging to file is activated:\n%s" # LOG_IS_STOPPED_OLD_LOG_FOUND = u"Logging is stopped but old log file still exists:\n%s" #about box ABOUT_TITLE = u"Sobre o TorChat" ABOUT_TEXT = u"""TorChat %(version)s (svn: r%(svn)s) %(copyright)s Traduções: %(translators)s Ambiente Runtime: Python: %(python)s wx: %(wx)s O TorChat é um software livre: você pode redistribuí-lo e/ou \ modificá-lo sob os termos da GNU General Public \ License publicada pela Free Software Foundation, \ usando qualquer versão 3 dessa licença, ou (conforme sua opção) \ qualquer versão anterior. O TorChat é distribuído na esperança de que ele seja útil, \ mas SEM QUALQUER GARANTIA; sem que isso implique \ em garantia de MERCANTIBILIDADE ou APTIDÃO PARA PROPÓSITOS PARTICULARES. \ Veja a GNU General Public License para mais detalhes. * E agora para algo completamente diferente: Se acontecer de você rodar um software proprietário perto de Hannover, Alemanha ou \ está precisando de um novo programador, sinta-se livre para considerar esse pequeno programa \ bem como meus documentos da aplicação e enviar-me um email com suas perguntas. """src/translations/lang_sv.py0000666000175000017500000001736311714662540015727 0ustar dererkdererk# # -*- coding: UTF-8 -*- ############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # Translation file for TorChat # # # ############################################################################## LANGUAGE_CODE = u"sv" LANGUAGE_NAME = u"Svenska" LANGUAGE_NAME_ENGLISH = u"Swedish" TRANSLATOR_NAMES = [u"Åke Engelbrektson"] #buttons BTN_CANCEL = u"Avbryt" BTN_OK = u"OK" BTN_SAVE_AS = u"Spara som..." BTN_CLOSE = u"Stäng" #status ST_AVAILABLE = u"Tillgänglig" ST_AWAY = u"Frånvarande" ST_EXTENDED_AWAY = u"Utökad frånvaro" ST_OFFLINE = u"Offline" #TaskbarMenu MTB_SHOW_HIDE_TORCHAT = u"Visa/Dölj TorChat" MTB_QUIT = u"Avsluta" #popup menu MPOP_CHAT = u"Chatta..." MPOP_SEND_FILE = u"Sänd fil..." MPOP_EDIT_CONTACT = u"Redigera kontakt..." MPOP_DELETE_CONTACT = u"Ta bort kontakt..." MPOP_SHOW_OFFLINE_MESSAGES = u"Visa köade offline-meddelanden" MPOP_CLEAR_OFFLINE_MESSAGES = u"Rensa köade offline-meddelanden" MPOP_ACTIVATE_LOG = u"Aktivera loggning till fil" MPOP_STOP_LOG = u"Stoppa loggning" MPOP_DELETE_EXISTING_LOG = u"Ta bort befintlig loggfil" MPOP_DELETE_AND_STOP_LOG = u"Ta bort logg och stoppa loggning" MPOP_ADD_CONTACT = u"Lägg till kontakt..." MPOP_ABOUT = u"Om TorChat" MPOP_ASK_AUTHOR = u"Fråga %s..." MPOP_SETTINGS = u"Inställningar..." MPOP_EDIT_MY_PROFILE = u"Redigera min profil..." #chat window popup menu CPOP_COPY = u"Kopiera" #confirm delete message box D_CONFIRM_DELETE_TITLE = u"Bekräfta borttagning" D_CONFIRM_DELETE_MESSAGE = u"Vill du verkligen ta bort den här kontakten?\n(%s %s)" #warning about log D_LOG_WARNING_TITLE = u"TorChat: Loggning är aktiverad" D_LOG_WARNING_MESSAGE = u"Loggning till fil är aktiverad!\n\nLoggfil: %s\n\nGlöm inte att ta bort loggfilen när du har avslutat felsökningen. Loggfilen kan innehålla känslig information." #warning about used port D_WARN_USED_PORT_TITLE = u"TorChat: Porten används redan" D_WARN_USED_PORT_MESSAGE = u"Något, troligen en annan TorChat-instans, lyssnar redan på %s:%s. Du måste skapa en profil till, som använder andra portar, för att kunna starta TorChat en andra gång." #warnig about unread messages D_WARN_UNREAD_TITLE = u"TorChat: Olästa meddelanden" D_WARN_UNREAD_MESSAGE = u"Det finns olästa meddelanden.\nDom kommer att förloras för alltid!\n\nVill du verkligen avsluta TorChat nu?" #warning about offline buddy D_WARN_BUDDY_OFFLINE_TITLE = u"TorChat: Kontakten är offline" D_WARN_BUDDY_OFFLINE_MESSAGE = u"Denna åtgärd fungerat inte med frånkopplade kontakter" #warning about multiple files D_WARN_FILE_ONLY_ONE_TITLE = u"TorChat: Flera filer" D_WARN_FILE_ONLY_ONE_MESSAGE = u"Du kan inte skicka flera filer i en och samma överföring. Skicka filerna en och en, eller packettera dom i en zip-fil" #warning about file save error D_WARN_FILE_SAVE_ERROR_TITLE = u"TorChat: Kan inte spara fil" D_WARN_FILE_SAVE_ERROR_MESSAGE = u"Filen '%s' kunde inte skapas.\n\n%s" #warning about file already exists D_WARN_FILE_ALREADY_EXISTS_TITLE = u"TorChat: Filen finns redan" D_WARN_FILE_ALREADY_EXISTS_MESSAGE = u"Filen '%s' finns redan.\nVill du byta ut den?" #dialog: add/edit contact DEC_TITLE_ADD = u"Lägg till ny kontakt" DEC_TITLE_EDIT = u"Redigera kontakt" DEC_TORCHAT_ID = u"TorChat-ID" DEC_DISPLAY_NAME = u"Visningsnamn" DEC_INTRODUCTION = u"Introduktion" DEC_MSG_16_CHARACTERS = u"Adressen måste vara 16 tecken lång, inte %i." DEC_MSG_ONLY_ALPANUM = u"Adressen kan bara bestå av siffror och små bokstäver" DEC_MSG_ALREADY_ON_LIST = u"%s finns redan i din lista" #dialog: edit my profile DEP_TITLE = u"Redigera min profil" DEP_NAME = u"Namn" DEP_TEXT = u"Text" DEP_SET_AVATAR = u"Ange avatar" DEP_REMOVE_AVATAR = u"Ta bort avatar" DEP_AVATAR_SELECT_PNG = u"Välj en .png-fil som din avatar (kommer att skalas om till 64x64px, får innehålla transparens)" DEP_PNG_FILES = u"PNG-filer" DEP_ALL_FILES = u"Alla filer" DEP_WARN_TITLE = u"Filen kan inte användas som avatar" DEP_WARN_IS_ALREADY = u"Den här bilden är redan din avatar" DEP_WARN_MUST_BE_PNG = u"Avataren måste vara en .png-fil" #file transfer window DFT_FILE_OPEN_TITLE = u"Sänd fil till %s" DFT_FILE_SAVE_TITLE = u"Spara fil från %s" DFT_SEND = u"Sänder %s\ntill %s\n%04.1f%% (%i av %i byte)" DFT_RECEIVE = u"Tar emot %s\nfrån %s\n%04.1f%% (%i av %i byte)" DFT_WAITING = u"väntar på anslutning" DFT_STARTING = u"startar överföring" DFT_ABORTED = u"överföring avbruten" DFT_COMPLETE = u"överföring slutförd" DFT_ERROR = u"fel" #settings dialaog DSET_TITLE = u"TorChat konfiguration" DSET_NET_TITLE = u"Nätverk" DSET_NET_ACTIVE = u"aktiv" DSET_NET_INACTIVE = u"inaktiv" DSET_NET_TOR_ADDRESS = u"Tor proxy-adress" DSET_NET_TOR_SOCKS = u"Socks-port" DSET_NET_TOR_CONTROL = u"Kontrollport" DSET_NET_OWN_HOSTNAME = u"Eget TorChat-ID" DSET_NET_LISTEN_INTERFACE = u"Lyssningsgränssnitt" DSET_NET_LISTEN_PORT = u"Lyssningsport" DSET_GUI_TITLE = u"Användargränssnitt" DSET_GUI_LANGUAGE = u"Språk" DSET_GUI_OPEN_MAIN_HIDDEN = u"Starta minimerad" DSET_GUI_OPEN_CHAT_HIDDEN = u"Öppna inte nya fönster automatiskt" DSET_GUI_NOTIFICATION_POPUP = u"Popupmeddelande" DSET_GUI_NOTIFICATION_METHOD = u"Meddelandemetod" DSET_GUI_FLASH_WINDOW = u"Blinka med fönster vid nytt meddelande" DSET_MISC_TITLE = u"Diverse" DSET_MISC_TEMP_IN_DATA = u"Lagra temporära filer i programmappen" DSET_MISC_TEMP_CUSTOM_DIR = u"Temp-mapp (lämnas tom för systemstandard)" #notices in the chat window (those in square brackets) NOTICE_DELAYED_MSG_WAITING = u"Fördröjda meddelanden som väntar på att skickas " NOTICE_DELAYED_MSG_SENT = u"fördröjda meddelanden har skickats" NOTICE_DELAYED = u"fördröjd" #messagebox for offline messages MSG_OFFLINE_TITLE = u"TorChat: köade meddelanden" MSG_OFFLINE_EMPTY = u"det finns inga (fler) köade meddelanden för %s" MSG_OFFLINE_QUEUED = u"köade offline-meddelanden för %s:\n\n%s" #buddy list mouse hover popup BPOP_BUDDY_IS_OFFLINE = u"Kontakten är offline" BPOP_CONNECTED_AWAITING_RETURN_CONN = u"Ansluten, väntar på svarsanslutning..." BPOP_CLIENT_SOFTWARE = u"Klient: %s %s" #logging of conversations to file LOG_HEADER = u"Den här loggfilen är inte signerad och har inga kända exempelfall" LOG_STARTED = u"Loggning startad" LOG_STOPPED = u"Loggning stoppad" LOG_DELETED = u"Loggfiler har tagits bort" LOG_IS_ACTIVATED = u"Loggning till fil är aktiverad:\n%s" LOG_IS_STOPPED_OLD_LOG_FOUND = u"Loggning är stoppad men gamla loggfiler finns kvar:\n%s" #about box ABOUT_TITLE = u"Om TorChat" ABOUT_TEXT = u"""TorChat %(version)s (svn: r%(svn)s) %(copyright)s Translations: %(translators)s Runtime environment: Python: %(python)s wx: %(wx)s TorChat is free software: you can redistribute it and/or \ modify it under the terms of the GNU General Public \ License as published by the Free Software Foundation, \ either version 3 of the License, or (at your option) \ any later version. TorChat is distributed in the hope that it will be useful, \ but WITHOUT ANY WARRANTY; without even the implied \ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \ See the GNU General Public License for more details. * And now for something completely different: If you happen to run a software company near Hannover, Germany and \ are in need of a new coder, feel free to regard this little program \ as my application documents and drop me a mail with your answer. """src/translations/lang_nl.py0000666000175000017500000001747211714662540015711 0ustar dererkdererk# -*- coding: UTF-8 -*- ############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # Translation file for TorChat # # # ############################################################################## LANGUAGE_CODE = u"nl" LANGUAGE_NAME = u"Nederlands" LANGUAGE_NAME_ENGLISH = u"Dutch" TRANSLATOR_NAMES = [u"2by3"] #buttons BTN_CANCEL = u"Annuleren" BTN_OK = u"Ok" BTN_SAVE_AS = u"Opslaan als..." BTN_CLOSE = u"Sluiten" #status ST_AVAILABLE = u"Aanwezig" ST_AWAY = u"Afwezig" ST_EXTENDED_AWAY = u"Langdurig afwezig" ST_OFFLINE = u"Offline" #TaskbarMenu MTB_SHOW_HIDE_TORCHAT = u"Toon/Verberg TorChat" MTB_QUIT = u"Sluiten" #popup menu MPOP_CHAT = u"Chat..." MPOP_SEND_FILE = u"Verzend bestand..." MPOP_EDIT_CONTACT = u"Bewerk contactpersoon..." MPOP_DELETE_CONTACT = u"Verwijder contact..." MPOP_SHOW_OFFLINE_MESSAGES = u"Toon Offline berichten in wacht" MPOP_CLEAR_OFFLINE_MESSAGES = u"Schoon Offline berichten in wacht" # MPOP_ACTIVATE_LOG = u"Activate logging to file" # MPOP_STOP_LOG = u"Stop logging" # MPOP_DELETE_EXISTING_LOG = u"Delete existing log file" # MPOP_DELETE_AND_STOP_LOG = u"Delete log and stop logging" MPOP_ADD_CONTACT = u"Contactpersoon toevoegen..." MPOP_ABOUT = u"Over TorChat" MPOP_ASK_AUTHOR = u"Vraag %s..." # MPOP_SETTINGS = u"Settings..." # MPOP_EDIT_MY_PROFILE = u"Edit my profile..." # #chat window popup menu # CPOP_COPY = u"Copy" #confirm delete message box D_CONFIRM_DELETE_TITLE = u"Bevestig verwijderen" D_CONFIRM_DELETE_MESSAGE = u"Weet u zeker dat u deze contactpersoon wilt verwijderen?\n(%s %s)" #warning about log D_LOG_WARNING_TITLE = u"TorChat: Logboek ingeschakeld" D_LOG_WARNING_MESSAGE = u"Logging naar bestand is geactiveerd!\n\nLog bestand: %s\n\nVergeet niet het logbestand te verwijderen na het debuggen, deze kan gevoellige informatie bevatten" # #warning about used port # D_WARN_USED_PORT_TITLE = u"TorChat: Port already in use" # D_WARN_USED_PORT_MESSAGE = u"Something, probably another TorChat instance, is already listening at %s:%s. You must create another profile using different ports to be able to start TorChat a second time." #warnig about unread messages D_WARN_UNREAD_TITLE = u"TorChat: Ongelezen berichten" D_WARN_UNREAD_MESSAGE = u"Er zijn ongelezen berichten.\nDeze zullen verloren gaan!\n\nWeet u zeker dat u TorChat wilt sluiten?" #warning about offline buddy # D_WARN_BUDDY_OFFLINE_TITLE = u"TorChat: Buddy is offline" # D_WARN_BUDDY_OFFLINE_MESSAGE = u"This operation is not possible with offline buddies" #warning about multiple files # D_WARN_FILE_ONLY_ONE_TITLE = u"TorChat: Multiple files" # D_WARN_FILE_ONLY_ONE_MESSAGE = u"You may not start multiple file transfers with one operation. Start the transfers individually or send a zip-file instead" # #warning about file save error # D_WARN_FILE_SAVE_ERROR_TITLE = u"TorChat: Error saving file" # D_WARN_FILE_SAVE_ERROR_MESSAGE = u"The file '%s' could not be created.\n\n%s" # #warning about file already exists # D_WARN_FILE_ALREADY_EXISTS_TITLE = u"TorChat: File exists" # D_WARN_FILE_ALREADY_EXISTS_MESSAGE = u"The file '%s' already exists.\nOverwrite it?" #dialog: add/edit contact DEC_TITLE_ADD = u"Contactpersoon toevoegen" DEC_TITLE_EDIT = u"Bewerk contactpersoon" DEC_TORCHAT_ID = u"TorChat ID" DEC_DISPLAY_NAME = u"Weergave naam" DEC_INTRODUCTION = u"Introductie" DEC_MSG_16_CHARACTERS = u"Het adres dient 16 karakters lang te zijn, niet %i." DEC_MSG_ONLY_ALPANUM = u"Het adres kan alleen cijfers en kleine letters bevatten." DEC_MSG_ALREADY_ON_LIST = u"%s staat al in uw lijst." # #dialog: edit my profile # DEP_TITLE = u"Edit my profile" # DEP_NAME = u"Name" # DEP_TEXT = u"Text" # DEP_SET_AVATAR = u"Set Avatar" # DEP_REMOVE_AVATAR = u"Remove Avatar" # DEP_AVATAR_SELECT_PNG = u"Select .PNG file to use as your avatar (will be scaled to 64*64, may contain transparency)" # DEP_PNG_FILES = u"PNG files" # DEP_ALL_FILES = u"All files" # DEP_WARN_TITLE = u"Avatar selection not possible" # DEP_WARN_IS_ALREADY = u"This is already the current avatar" # DEP_WARN_MUST_BE_PNG = u"The avatar must be a .png file" #file transfer window # DFT_FILE_OPEN_TITLE = u"Send file to %s" # DFT_FILE_SAVE_TITLE = u"Save file from %s" DFT_SEND = u"Verzenden %s\nnaar %s\n%04.1f%% (%i van %i bytes)" DFT_RECEIVE = u"Ontvangen %s\nvan %s\n%04.1f%% (%i van %i bytes)" # DFT_WAITING = u"waiting for connection" # DFT_STARTING = u"starting transfer" # DFT_ABORTED = u"transfer aborted" # DFT_COMPLETE = u"transfer complete" # DFT_ERROR = u"error" # #settings dialaog # DSET_TITLE = u"TorChat configuration" # DSET_NET_TITLE = u"Network" # DSET_NET_ACTIVE = u"active" # DSET_NET_INACTIVE = u"inactive" # DSET_NET_TOR_ADDRESS = u"Tor proxy address" # DSET_NET_TOR_SOCKS = u"Socks port" # DSET_NET_TOR_CONTROL = u"Control port" # DSET_NET_OWN_HOSTNAME = u"Own TorChat-ID" # DSET_NET_LISTEN_INTERFACE = u"Listen interface" # DSET_NET_LISTEN_PORT = u"Listen port" # DSET_GUI_TITLE = u"User interface" # DSET_GUI_LANGUAGE = u"Language" # DSET_GUI_OPEN_MAIN_HIDDEN = u"Start with minimized main window" # DSET_GUI_OPEN_CHAT_HIDDEN = u"Don't automatically open new windows" # DSET_GUI_NOTIFICATION_POPUP = u"Notification pop-up" # DSET_GUI_NOTIFICATION_METHOD = u"Notification method" # DSET_GUI_FLASH_WINDOW = u"Flash window title on new message" # DSET_MISC_TITLE = u"Misc" # DSET_MISC_TEMP_IN_DATA = u"Store temporary files inside data directory" # DSET_MISC_TEMP_CUSTOM_DIR = u"Temporary directory (leave empty for OS-default)" #notices in the chat window (those in square brackets) NOTICE_DELAYED_MSG_WAITING = u"vertraagde berichten, wachtend om verzonden te worden" NOTICE_DELAYED_MSG_SENT = u"vertraagde berichten zijn verzonden" NOTICE_DELAYED = u"vertraagd" # #messagebox for offline messages # MSG_OFFLINE_TITLE = u"TorChat: queued messages" # MSG_OFFLINE_EMPTY = u"there are no (more) queued messages for %s" # MSG_OFFLINE_QUEUED = u"queued offline messages for %s:\n\n%s" # #buddy list mouse hover popup # BPOP_BUDDY_IS_OFFLINE = u"Buddy is offline" # BPOP_CONNECTED_AWAITING_RETURN_CONN = u"Connected, awaiting return connection..." # BPOP_CLIENT_SOFTWARE = u"Client: %s %s" # #logging of conversations to file # LOG_HEADER = u"This log file is not signed and has no cogency of proof" # LOG_STARTED = u"Logging started" # LOG_STOPPED = u"Logging stopped" # LOG_DELETED = u"Log files have been deleted" # LOG_IS_ACTIVATED = u"Logging to file is activated:\n%s" # LOG_IS_STOPPED_OLD_LOG_FOUND = u"Logging is stopped but old log file still exists:\n%s" #about box ABOUT_TITLE = u"Over TorChat" ABOUT_TEXT = u"""TorChat %(version)s (svn: r%(svn)s) %(copyright)s Translations: %(translators)s Runtime environment: Python: %(python)s wx: %(wx)s TorChat is free software: you can redistribute it and/or \ modify it under the terms of the GNU General Public \ License as published by the Free Software Foundation, \ either version 3 of the License, or (at your option) \ any later version. TorChat is distributed in the hope that it will be useful, \ but WITHOUT ANY WARRANTY; without even the implied \ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \ See the GNU General Public License for more details. * And now for something completely different: If you happen to run a software company near Hannover, Germany and \ are in need of a new coder, feel free to regard this little program \ as my application documents and drop me a mail with your answer. """src/translations/lang_it.py0000666000175000017500000001771711714662540015716 0ustar dererkdererk# # -*- coding: UTF-8 -*- ############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # Translation file for TorChat # # # ############################################################################## LANGUAGE_CODE = u"it" LANGUAGE_NAME = u"Italiano" LANGUAGE_NAME_ENGLISH = u"Italian" TRANSLATOR_NAMES = [u"HostFat"] #buttons BTN_CANCEL = u"Annulla" BTN_OK = u"Ok" BTN_SAVE_AS = u"Salva come..." BTN_CLOSE = u"Chiudi" #status ST_AVAILABLE = u"Disponibile" ST_AWAY = u"Indisposto / lontano" ST_EXTENDED_AWAY = u"Molto indisposto / lontano" ST_OFFLINE = u"Non connesso" #TaskbarMenu MTB_SHOW_HIDE_TORCHAT = u"Mostra/Nascondi TorChat" MTB_QUIT = u"Esci" #popup menu MPOP_CHAT = u"Chat..." MPOP_SEND_FILE = u"Invia file..." MPOP_EDIT_CONTACT = u"Modifica contatto..." MPOP_DELETE_CONTACT = u"Cancella contatto..." MPOP_SHOW_OFFLINE_MESSAGES = u"Mostra i messaggi offline in attesa" MPOP_CLEAR_OFFLINE_MESSAGES = u"Cancella i messaggi offline in attesa" MPOP_ACTIVATE_LOG = u"Attiva il salvataggio log su file" MPOP_STOP_LOG = u"Ferma salvataggio log" MPOP_DELETE_EXISTING_LOG = u"Elimina file log esistente" MPOP_DELETE_AND_STOP_LOG = u"Cancella log e smetti di salvare" MPOP_ADD_CONTACT = u"Aggiungi contatto..." MPOP_ABOUT = u"About TorChat" MPOP_ASK_AUTHOR = u"Chiedi %s..." MPOP_SETTINGS = u"Impostazioni..." MPOP_EDIT_MY_PROFILE = u"Modifica il mio profilo..." #chat window popup menu CPOP_COPY = u"Copia" #confirm delete message box D_CONFIRM_DELETE_TITLE = u"Conferma cancellazione" D_CONFIRM_DELETE_MESSAGE = u"Vuoi veramente cancellare questo contatto?\n(%s %s)" #warning about log D_LOG_WARNING_TITLE = u"TorChat: Salvataggio log attivo" D_LOG_WARNING_MESSAGE = u"Salvataggio log su file attivato!\n\nLog File: %s\n\nRicordati di cancellare il file log quando hai finito il debugging il file log potrebbe contenere informazioni sensibili." #warning about used port D_WARN_USED_PORT_TITLE = u"TorChat: Porta già in uso" D_WARN_USED_PORT_MESSAGE = u"Qualcosa, probabilmente c'è un altro TorChat in esecuzione, è già in ascolto su %s:%s. Devi creare un altro profilo che usi porte differenti per poter avviare TorChat una seconda volta." #warnig about unread messages D_WARN_UNREAD_TITLE = u"TorChat: Messaggi non letti" D_WARN_UNREAD_MESSAGE = u"Sono presenti messaggi non letti.\nVerranno persi per sempre!\n\nVuoi veramente uscire ora da TorChat?" #warning about offline buddy D_WARN_BUDDY_OFFLINE_TITLE = u"TorChat: L'utente è scollegato" D_WARN_BUDDY_OFFLINE_MESSAGE = u"Questa operazione non è possibile con utenti scollegati" #warning about multiple files D_WARN_FILE_ONLY_ONE_TITLE = u"TorChat: File multipli" D_WARN_FILE_ONLY_ONE_MESSAGE = u"Non dovresti avviare trasferimenti multipli di file in un'unica operazione. Invia trasferimenti singoli individualmente oppure inviali zippati" #warning about file save error D_WARN_FILE_SAVE_ERROR_TITLE = u"TorChat: Errore salvataggio file" D_WARN_FILE_SAVE_ERROR_MESSAGE = u"Non è stato possibile creare il file '%s'.\n\n%s" #warning about file already exists D_WARN_FILE_ALREADY_EXISTS_TITLE = u"TorChat: File esistente" D_WARN_FILE_ALREADY_EXISTS_MESSAGE = u"Il file '%s' esiste già.\nSovrascriverlo?" #dialog: add/edit contact DEC_TITLE_ADD = u"Aggiungi nuovo contatto" DEC_TITLE_EDIT = u"Modifica contatto" DEC_TORCHAT_ID = u"TorChat ID" DEC_DISPLAY_NAME = u"Mostra nome" DEC_INTRODUCTION = u"Introduzione" DEC_MSG_16_CHARACTERS = u"L'indirizzo deve essere lungo 16 caratteri, non %i." DEC_MSG_ONLY_ALPANUM = u"L'indirizzo può contenere solo numeri e caratteri in minuscolo." DEC_MSG_ALREADY_ON_LIST = u"%s è già nella tua lista." #dialog: edit my profile DEP_TITLE = u"Modifca il mio profilo" DEP_NAME = u"Nome" DEP_TEXT = u"Testo" DEP_SET_AVATAR = u"Imposta Avatar" DEP_REMOVE_AVATAR = u"Rimuovi Avatar" DEP_AVATAR_SELECT_PNG = u"Seleziona file .PNG da usare come avatar (verà scalato a 64*64, può contenere trasparenze)" DEP_PNG_FILES = u"File PNG" DEP_ALL_FILES = u"Tutti i file" DEP_WARN_TITLE = u"Impossibile selezionare Avatar" DEP_WARN_IS_ALREADY = u"Questo è già l'avatar corrente" DEP_WARN_MUST_BE_PNG = u"L'avatar deve essere un file .png" #file transfer window DFT_FILE_OPEN_TITLE = u"Invia file a %s" DFT_FILE_SAVE_TITLE = u"Salva file da %s" DFT_SEND = u"Inviando %s\na %s\n%04.1f%% (%i di %i bytes)" DFT_RECEIVE = u"Ricevendo %s\nda %s\n%04.1f%% (%i di %i bytes)" DFT_WAITING = u"in attesa di connessione" DFT_STARTING = u"avvio trasferimento" DFT_ABORTED = u"trasferimento inconcluso" DFT_COMPLETE = u"trasferimento completato" DFT_ERROR = u"errore" #settings dialaog DSET_TITLE = u"Configurazione TorChat" DSET_NET_TITLE = u"Network" DSET_NET_ACTIVE = u"attivo" DSET_NET_INACTIVE = u"inattivo" DSET_NET_TOR_ADDRESS = u"Indirizzo proxy Tor" DSET_NET_TOR_SOCKS = u"Porta Socks" DSET_NET_TOR_CONTROL = u"Porta di controllo" DSET_NET_OWN_HOSTNAME = u"Il proprio TorChat-ID" DSET_NET_LISTEN_INTERFACE = u"Interfaccia in ascolto" DSET_NET_LISTEN_PORT = u"Porta in ascolto" DSET_GUI_TITLE = u"Interfaccia utente" DSET_GUI_LANGUAGE = u"Lingua" DSET_GUI_OPEN_MAIN_HIDDEN = u"Avvia con finestra minimizzata" DSET_GUI_OPEN_CHAT_HIDDEN = u"Non aprire automaticamente nuove finestre" DSET_GUI_NOTIFICATION_POPUP = u"Notifica pop-up" DSET_GUI_NOTIFICATION_METHOD = u"Metodo di notifica" DSET_GUI_FLASH_WINDOW = u"Titolo finestra lampeggiante con nuovi messaggi" DSET_MISC_TITLE = u"Varie" DSET_MISC_TEMP_IN_DATA = u"Salva file temporanei nella cartella data" DSET_MISC_TEMP_CUSTOM_DIR = u"Cartella temporanea (lascia vuoto per la default dell'OS)" #notices in the chat window (those in square brackets) NOTICE_DELAYED_MSG_WAITING = u"messaggi in ritardo in attesa di essere inviati" NOTICE_DELAYED_MSG_SENT = u"messaggi in ritardo sono stati inviati" NOTICE_DELAYED = u"ritardato" #messagebox for offline messages MSG_OFFLINE_TITLE = u"TorChat: messaggi in attesa" MSG_OFFLINE_EMPTY = u"non ci sono (ulteriori) messaggi in attesa per %s" MSG_OFFLINE_QUEUED = u"messaggi offline in attesa per %s:\n\n%s" #buddy list mouse hover popup BPOP_BUDDY_IS_OFFLINE = u"Contatto non connesso" BPOP_CONNECTED_AWAITING_RETURN_CONN = u"Collegato, in attesa di connessione di ritorno..." BPOP_CLIENT_SOFTWARE = u"Client: %s %s" #logging of conversations to file LOG_HEADER = u"Questo file log non è firmato e non è valido come prova" LOG_STARTED = u"Salvataggio log avviato" LOG_STOPPED = u"Salvataggio log fermato" LOG_DELETED = u"I file log sono stati cancellati" LOG_IS_ACTIVATED = u"Salvataggio log su file è stato attivato:\n%s" LOG_IS_STOPPED_OLD_LOG_FOUND = u"Il salvataggio è stato fermato ma il vecchio file log è ancora presente:\n%s" #about box ABOUT_TITLE = u"About TorChat" ABOUT_TEXT = u"""TorChat %(version)s (svn: r%(svn)s) %(copyright)s Translations: %(translators)s Runtime environment: Python: %(python)s wx: %(wx)s TorChat is free software: you can redistribute it and/or \ modify it under the terms of the GNU General Public \ License as published by the Free Software Foundation, \ either version 3 of the License, or (at your option) \ any later version. TorChat is distributed in the hope that it will be useful, \ but WITHOUT ANY WARRANTY; without even the implied \ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \ See the GNU General Public License for more details. * And now for something completely different: If you happen to run a software company near Hannover, Germany and \ are in need of a new coder, feel free to regard this little program \ as my application documents and drop me a mail with your answer. """src/translations/lang_de.py0000666000175000017500000002072711726674046015674 0ustar dererkdererk# -*- coding: UTF-8 -*- ############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # Translation file for TorChat # # # ############################################################################## LANGUAGE_CODE = u"de" LANGUAGE_NAME = u"Deutsch" LANGUAGE_NAME_ENGLISH = u"German" TRANSLATOR_NAMES = [u"Bernd Kreuß"] #buttons BTN_CANCEL = u"Abbrechen" BTN_OK = u"Ok" BTN_SAVE_AS = u"Speichern unter..." BTN_CLOSE = u"Schließen" #status ST_AVAILABLE = u"Verfügbar" ST_AWAY = u"Abwesend" ST_EXTENDED_AWAY = u"Nicht verfügbar" ST_OFFLINE = u"Offline" #TaskbarMenu MTB_SHOW_HIDE_TORCHAT = u"TorChat anzeigen/verstecken" MTB_QUIT = u"Beenden" #popup menu MPOP_CHAT = u"Nachricht schreiben..." MPOP_SEND_FILE = u"Datei senden..." MPOP_EDIT_CONTACT = u"Kontakt bearbeiten..." MPOP_DELETE_CONTACT = u"Kontakt löschen..." MPOP_SHOW_OFFLINE_MESSAGES = u"Nachrichten in Warteschlange anzeigen" MPOP_CLEAR_OFFLINE_MESSAGES = u"Nachrichten in Warteschlange löschen" MPOP_ACTIVATE_LOG = u"Aktiviere Mitschnitt in Datei" MPOP_STOP_LOG = u"Stoppe Mitschnitt" MPOP_DELETE_EXISTING_LOG = u"Lösche existierenden Mitschnitt" MPOP_DELETE_AND_STOP_LOG = u"Lösche Mitschnitt und stoppe Mitschneiden" MPOP_ADD_CONTACT = u"Kontakt hinzufügen..." MPOP_ABOUT = u"Über TorChat" MPOP_ASK_AUTHOR = u"%s fragen..." MPOP_SETTINGS = u"Einstellungen..." MPOP_EDIT_MY_PROFILE = u"Eigenes Profil bearbeiten..." MPOP_COPY_ID_TO_CLIPBOARD=u"ID in die Zwischenablage kopieren" #chat window popup menu CPOP_COPY = u"Kopieren" #confirm delete message box D_CONFIRM_DELETE_TITLE = u"Löschen bestätigen" D_CONFIRM_DELETE_MESSAGE = u"Soll dieser Kontakt wirklich gelöscht werden?\n(%s %s)" #warning about log D_LOG_WARNING_TITLE = u"TorChat: Logging ist aktiviert" D_LOG_WARNING_MESSAGE = u"Logging in Datei ist aktiviert!\n\nLogdatei: %s\n\nVergessen Sie nicht, die Logdatei nach Beendigung der Fehlersuche wieder zu löschen, da diese Datei vertrauliche Informationen enthalten könnte." #warning about used port D_WARN_USED_PORT_TITLE = u"TorChat: Port ist bereits belegt" D_WARN_USED_PORT_MESSAGE = u"Eine Anwendung, wahrscheinlich eine andere TorChat-Instanz, verwendet bereits den Port %s:%s. Sie müssen andere Profile mit anderen Ports verwenden, um TorChat mehrmals starten zu können." # #warnig about unread messages D_WARN_UNREAD_TITLE = u"TorChat: Ungelesene Nachrichten" D_WARN_UNREAD_MESSAGE = u"Es liegen noch ungelesene Nachrichten vor. Diese würden unwiderruflich verloren gehen!\n\nMöchten sie TorChat dennoch jetzt beenden?" #warning about offline buddy D_WARN_BUDDY_OFFLINE_TITLE = u"TorChat: Buddy ist offline" D_WARN_BUDDY_OFFLINE_MESSAGE = u"Diese Operation ist nicht möglich mit Offline-Buddies" #warning about multiple files D_WARN_FILE_ONLY_ONE_TITLE = u"TorChat: Mehrere Dateien" D_WARN_FILE_ONLY_ONE_MESSAGE = u"Sie können nicht mit einer Operation mehrere Dateitransfers gleichzeitig auslösen. Starten Sie die Transfers einzeln, oder senden Sie eine Zip-Datei." #warning about file save error D_WARN_FILE_SAVE_ERROR_TITLE = u"TorChat: Fehler beim Anlegen der Datei" D_WARN_FILE_SAVE_ERROR_MESSAGE = u"Die Datei '%s' konnte nicht erzeugt werden.\n\n%s" #warning about file already exists D_WARN_FILE_ALREADY_EXISTS_TITLE = u"TorChat: Datei existiert bereits" D_WARN_FILE_ALREADY_EXISTS_MESSAGE = u"Die Datei '%s' existiert bereits.\nÜberschreiben?" #dialog: add/edit contact DEC_TITLE_ADD = u"Neuen Kontakt anlegen" DEC_TITLE_EDIT = u"Kontakt bearbeiten" DEC_TORCHAT_ID = u"TorChat-ID" DEC_DISPLAY_NAME = u"Angezeigter Name" DEC_INTRODUCTION = u"Kurze Vorstellung" DEC_MSG_16_CHARACTERS = u"Die Adresse muss genau 16 Zeichen lang sein, nicht %i." DEC_MSG_ONLY_ALPANUM = u"Die Adresse kann nur aus Ziffern und Kleinbuchstaben ohne Umlaute bestehen." DEC_MSG_ALREADY_ON_LIST = u"%s ist bereits auf Ihrer Liste." # #dialog: edit my profile DEP_TITLE = u"Mein Profil bearbeiten" DEP_NAME = u"Name" DEP_TEXT = u"Text" DEP_SET_AVATAR = u"Bild wählen" DEP_REMOVE_AVATAR = u"Bild löschen" DEP_AVATAR_SELECT_PNG = u"Auswählen einer .png-Datei als Profilbild (wird auf 64*64 skaliert, darf Transparenz enthalten)" DEP_PNG_FILES = u"PNG-Dateien" DEP_ALL_FILES = u"Alle Dateien" DEP_WARN_TITLE = u"Auswahl nicht möglich" DEP_WARN_IS_ALREADY = u"Dies ist bereits ihr aktuelles Profilbild" DEP_WARN_MUST_BE_PNG = u"Bild muss eine .png-Datei sein" #file transfer window DFT_FILE_OPEN_TITLE = u"Sende Datei an %s" DFT_FILE_SAVE_TITLE = u"Speichere Datei von %s" DFT_SEND = u"Sende %s\nan %s\n%04.1f%% (%i von %i Bytes)" DFT_RECEIVE = u"Empfange %s\nvon %s\n%04.1f%% (%i von %i Bytes)" DFT_WAITING = u"Warte auf Verbindung" DFT_STARTING = u"Starte Transfer" DFT_ABORTED = u"Transfer abgebrochen" DFT_COMPLETE = u"Transfer vollständig" DFT_ERROR = u"Fehler" #settings dialaog DSET_TITLE = u"TorChat Konfiguration" DSET_NET_TITLE = u"Netzwerk" DSET_NET_ACTIVE = u"aktiv" DSET_NET_INACTIVE = u"inaktiv" DSET_NET_TOR_ADDRESS = u"Tor-Proxy Adresse" DSET_NET_TOR_SOCKS = u"Socks Port" DSET_NET_TOR_CONTROL = u"Control Port" DSET_NET_OWN_HOSTNAME = u"Eigene TorChat-ID" DSET_NET_LISTEN_INTERFACE = u"Binden an Adapter" DSET_NET_LISTEN_PORT = u"Binden an Port" DSET_GUI_TITLE = u"Benutzeroberfläche" DSET_GUI_LANGUAGE = u"Sprache" DSET_GUI_OPEN_MAIN_HIDDEN = u"Starte mit minimiertem Hauptfenster" DSET_GUI_OPEN_CHAT_HIDDEN = u"Öffne neue Fenster nicht automatisch" DSET_GUI_NOTIFICATION_POPUP = u"Benachrichtigungs-PopUp" DSET_GUI_NOTIFICATION_METHOD = u"Benachrichtigungsmethode" DSET_GUI_FLASH_WINDOW = u"Blinkender Fenstertitel bei neuer Nachricht" DSET_MISC_TITLE = u"Verschiedenes" DSET_MISC_TEMP_IN_DATA = u"Temporäre Dateien im Datenverzeichnis" DSET_MISC_TEMP_CUSTOM_DIR = u"Verzeichnis für temporäre Dateien (leer lassen für OS-Default)" #notices in the chat window (those in square brackets) NOTICE_DELAYED_MSG_WAITING = u"Verzögerte Nachrichten in der Sendewarteschlange" NOTICE_DELAYED_MSG_SENT = u"Verzögerte Nachrichten wurden gesendet" NOTICE_DELAYED = u"Verzögert" #messagebox for offline messages MSG_OFFLINE_TITLE = u"TorChat: Ungesendete Nachrichten" MSG_OFFLINE_EMPTY = u"Es liegen keine ungesendeten Nachrichten (mehr) für %s vor" MSG_OFFLINE_QUEUED = u"Ungesendete Nachrichten für %s:\n\n%s" #buddy list mouse hover popup BPOP_BUDDY_IS_OFFLINE = u"Buddy ist offline" BPOP_CONNECTED_AWAITING_RETURN_CONN = u"Verbunden, erwarte Rückverbindung..." BPOP_CLIENT_SOFTWARE = u"Client: %s %s" #logging of conversations to file LOG_HEADER = u"Dieser Mitschnitt ist nicht signiert und beinhaltet keine Beweiskraft" LOG_STARTED = u"Mitschneiden gestartet" LOG_STOPPED = u"Mitschneiden gestoppt" LOG_DELETED = u"Mitschnitt gelöscht" LOG_IS_ACTIVATED = u"Mitschneiden ist aktiviert:\n%s" LOG_IS_STOPPED_OLD_LOG_FOUND = u"Mitschneiden ist gestoppt aber ein alter Mitschnitt existiert noch:\n%s" #about box ABOUT_TITLE = u"Über TorChat" ABOUT_TEXT = u"""TorChat %(version)s (svn: r%(svn)s) %(copyright)s Übersetzungen: %(translators)s Laufzeitumgebung: Python: %(python)s wx: %(wx)s Dieses Programm ist freie Software. Sie können es unter den \ Bedingungen der GNU General Public License, wie von der \ Free Software Foundation veröffentlicht, weitergeben und/oder \ modifizieren, entweder gemäß Version 3 der Lizenz oder \ (nach Ihrer Option) jeder späteren Version. Die Veröffentlichung dieses Programms erfolgt in der Hoffnung, \ daß es Ihnen von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, \ sogar ohne die implizite Garantie der MARKTREIFE oder der \ VERWENDBARKEIT FÜR EINEN BESTIMMTEN ZWECK. Details finden Sie \ in der GNU General Public License. Sie sollten ein Exemplar der GNU General Public License zusammen \ mit diesem Programm erhalten haben. Falls nicht, siehe \ . * Und nun zu etwas vollkommen Anderem: Sollten Sie zufällig eine Software-Firma irgendwo in der Nähe \ von Hannover betreiben und gerade Bedarf an einem neuen Programmierer \ haben, dann betrachten Sie dieses kleine Programm einfach als meine \ Bewerbung und schicken Sie mir eine E-Mail mit Ihrer Zusage ;-) """src/translations/lang_pl.py0000666000175000017500000001752611726665376015730 0ustar dererkdererk# -*- coding: UTF-8 -*- ############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # Translation file for TorChat # # # ############################################################################## LANGUAGE_CODE = u"pl" LANGUAGE_NAME = u"Polski" LANGUAGE_NAME_ENGLISH = u"Polish" TRANSLATOR_NAMES = [u"yr3gwa7yonxrl26q", u"rmjy2avgeluvbrdq"] #buttons BTN_CANCEL = u"Anuluj" BTN_OK = u"Ok" BTN_SAVE_AS = u"Zapisz jako..." BTN_CLOSE = u"Zamknij" #status ST_AVAILABLE = u"Dostępny" ST_AWAY = u"Zaraz wracam" ST_EXTENDED_AWAY = u"Z dala od komputera" ST_OFFLINE = u"Niedostępny" #TaskbarMenu MTB_SHOW_HIDE_TORCHAT = u"Pokaż/Ukryj TorChat" MTB_QUIT = u"Zamknij" #popup menu MPOP_CHAT = u"Rozmowa..." MPOP_SEND_FILE = u"Wyślij plik..." MPOP_EDIT_CONTACT = u"Edytuj kontakt..." MPOP_DELETE_CONTACT = u"Usuń kontakt..." MPOP_SHOW_OFFLINE_MESSAGES = u"Pokaż wiadomości oczekujące" MPOP_CLEAR_OFFLINE_MESSAGES = u"Wyczyść wiadomości oczekujące" MPOP_ACTIVATE_LOG = u"Aktywuj rejestrowanie do pliku" MPOP_STOP_LOG = u"Zatrzymaj rejestrowanie" MPOP_DELETE_EXISTING_LOG = u"Usuń istniejący plik dziennika" MPOP_DELETE_AND_STOP_LOG = u"Usuń plik dziennika i zatrzymaj rejestrowanie" MPOP_ADD_CONTACT = u"Dodaj kontakt..." MPOP_ABOUT = u"O programie TorChat" MPOP_ASK_AUTHOR = u"Zapytaj %s..." MPOP_SETTINGS = u"Ustawienia..." MPOP_EDIT_MY_PROFILE = u"Edytuj mój profil..." #chat window popup menu CPOP_COPY = u"Kopiuj" #confirm delete message box D_CONFIRM_DELETE_TITLE = u"Potwierdź usunięcie" D_CONFIRM_DELETE_MESSAGE = u"Czy na pewno chcesz usunać ?\n(%s %s)" #warning about log D_LOG_WARNING_TITLE = u"TorChat: Rejestracja jest aktywna" D_LOG_WARNING_MESSAGE = u"Rejestracja została aktywowana!\n\nLog Plik: %s\n\nPamietaj usuń plik po zakończeniu pracy." #warning about used port D_WARN_USED_PORT_TITLE = u"TorChat: Port w użyciu" D_WARN_USED_PORT_MESSAGE = u"Coś lub prawdopodobnie inna kopia TorChat jest w użyciu i nasłuchuje port na %s:%s. Musisz utworzyć inny profil używający innych portów aby uruchomić drugą kopię TorChat." #warnig about unread messages D_WARN_UNREAD_TITLE = u"TorChat: Nieprzeczytane wiadomosci" D_WARN_UNREAD_MESSAGE = u"Częśc wiadomości została nieprzeczytana.\nZostana one usunięte!\n\nNaprawdę chcesz wyjść ?" # #warning about offline buddy D_WARN_BUDDY_OFFLINE_TITLE = u"TorChat: Kontakt znajduje się poza siecią" D_WARN_BUDDY_OFFLINE_MESSAGE = u"Nie można wykonac tej operacji z kontaktami pozostającymi poza siecią" #warning about multiple files D_WARN_FILE_ONLY_ONE_TITLE = u"TorChat: Kilka plików" D_WARN_FILE_ONLY_ONE_MESSAGE = u"Nie można wysłac kilku plików podczas jednej operacji. Wyślij każdy osobno lub użyj archiwum ZIP/RAR/7Z." #warning about file save error D_WARN_FILE_SAVE_ERROR_TITLE = u"TorChat: Błąd podczas zapisywania pliku" D_WARN_FILE_SAVE_ERROR_MESSAGE = u"Plik '%s' nie mógł zostać utworzony.\n\n%s" #warning about file already exists D_WARN_FILE_ALREADY_EXISTS_TITLE = u"TorChat: Plik już istnieje" D_WARN_FILE_ALREADY_EXISTS_MESSAGE = u"Plik '%s' już istnieje.\nNadpisać go?" #dialog: add/edit contact DEC_TITLE_ADD = u"Dodaj nowy kontakt" DEC_TITLE_EDIT = u"Edytuj kontakt" DEC_TORCHAT_ID = u"TorChat ID" DEC_DISPLAY_NAME = u"Pokaż nazwę" DEC_INTRODUCTION = u"Zaproszenie" DEC_MSG_16_CHARACTERS = u"Adres musi mieć 16 znaków, nie %i." DEC_MSG_ONLY_ALPANUM = u"Adres musi zawierać tylko małe litery i cyfry" DEC_MSG_ALREADY_ON_LIST = u"%s już jest na liście" #dialog: edit my profile DEP_TITLE = u"Edytuj mój profil" DEP_NAME = u"Nazwa" DEP_TEXT = u"Tekst" DEP_SET_AVATAR = u"Ustaw Avatar" DEP_REMOVE_AVATAR = u"Usuń Avatar" DEP_AVATAR_SELECT_PNG = u"Zaznać plik .PNG aby użyć go jako avatara (zostanie zmniejszony do 64*64)" DEP_PNG_FILES = u"Pliki PNG" DEP_ALL_FILES = u"Wszystkie pliki" DEP_WARN_TITLE = u"Zaznaczenie avatara nie jest możliwe" DEP_WARN_IS_ALREADY = u"To jest już aktualny avatar" DEP_WARN_MUST_BE_PNG = u"Avatar musi być plikiem .png" #file transfer window DFT_FILE_OPEN_TITLE = u"Wyślij plik do %s" DFT_FILE_SAVE_TITLE = u"Zapisz plik od %s" DFT_SEND = u"Wysłano %s\ndo %s\n%04.1f%% (%i z %i bajtów)" DFT_RECEIVE = u"Otrzymano %s\nod %s\n%04.1f%% (%i z %i bajtów)" DFT_WAITING = u"oczekiwanie na połączenie" DFT_STARTING = u"rozpoczęcie transferu" DFT_ABORTED = u"transfer przerwany" DFT_COMPLETE = u"transfer ukończony" DFT_ERROR = u"błąd" #settings dialaog DSET_TITLE = u"Konfiguracja TorChat" DSET_NET_TITLE = u"Sieć" DSET_NET_ACTIVE = u"aktywne" DSET_NET_INACTIVE = u"nieaktywne" DSET_NET_TOR_ADDRESS = u"Adres Tor proxy" DSET_NET_TOR_SOCKS = u"Socks port" DSET_NET_TOR_CONTROL = u"Control port" DSET_NET_OWN_HOSTNAME = u"Własny TorChat-ID" DSET_NET_LISTEN_INTERFACE = u"Listen interface" DSET_NET_LISTEN_PORT = u"Listen port" DSET_GUI_TITLE = u"Interfejs użytkownika" DSET_GUI_LANGUAGE = u"Język" DSET_GUI_OPEN_MAIN_HIDDEN = u"Uruchom w tle." DSET_GUI_OPEN_CHAT_HIDDEN = u"Nie otwieraj automatycznie nowych okien." DSET_GUI_NOTIFICATION_POPUP = u"Powiadamiający pop-up" DSET_GUI_NOTIFICATION_METHOD = u"Sposoby powiadomień" DSET_GUI_FLASH_WINDOW = u"Sygnalizuj nadejście nowej wiadomości" DSET_MISC_TITLE = u"Inne" DSET_MISC_TEMP_IN_DATA = u"Przechowuj pliki tymczasowe w katalogu danych" DSET_MISC_TEMP_CUSTOM_DIR = u"Tymczasowy katalog danych (zostaw puste dla domyślnego systemu operacyjnego)" #notices in the chat window (those in square brackets) NOTICE_DELAYED_MSG_WAITING = u"opóźnione wiadomości czekają w kolejce" NOTICE_DELAYED_MSG_SENT = u"opóźnione wiadomości zostały wysłane" NOTICE_DELAYED = u"opóźnione" #messagebox for offline messages MSG_OFFLINE_TITLE = u"TorChat: oczekujące wiadomości" MSG_OFFLINE_EMPTY = u"nie ma (więcej) oczekujących wiadomości dla %s" MSG_OFFLINE_QUEUED = u"oczekujące wiadomości offline dla %s:\n\n%s" #buddy list mouse hover popup BPOP_BUDDY_IS_OFFLINE = u"Znajomy jest offline" BPOP_CONNECTED_AWAITING_RETURN_CONN = u"Połączony, oczekiwanie na połączenie zwrotne..." BPOP_CLIENT_SOFTWARE = u"Klient: %s %s" #logging of conversations to file LOG_HEADER = u"Ten plik dziennika jest niepodpisany i nie stanowi żadnego dowodu" LOG_STARTED = u"Rejestrowanie rozpoczęte" LOG_STOPPED = u"Rejestrowanie zakończone" LOG_DELETED = u"Pliki dziennika zostały usunięte" LOG_IS_ACTIVATED = u"Rejestrowanie do pliku zostało aktywowane:\n%s" LOG_IS_STOPPED_OLD_LOG_FOUND = u"Rejestrowanie zostało zatrzymane ale stare pliki dziennika wciąż istnieją:\n%s" #about box ABOUT_TITLE = u"O programie TorChat" ABOUT_TEXT = u"""TorChat %(version)s (svn: r%(svn)s) %(copyright)s Translations: %(translators)s Runtime environment: Python: %(python)s wx: %(wx)s TorChat is free software: you can redistribute it and/or \ modify it under the terms of the GNU General Public \ License as published by the Free Software Foundation, \ either version 3 of the License, or (at your option) \ any later version. TorChat is distributed in the hope that it will be useful, \ but WITHOUT ANY WARRANTY; without even the implied \ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \ See the GNU General Public License for more details. * And now for something completely different: If you happen to run a software company near Hannover, Germany and \ are in need of a new coder, feel free to regard this little program \ as my application documents and drop me a mail with your answer. """src/translations/lang_zh.py0000666000175000017500000001704011714662540015710 0ustar dererkdererk# -*- coding: UTF-8 -*- ############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # Translation file for TorChat # # # ############################################################################## LANGUAGE_CODE = u"zh" LANGUAGE_NAME = u"Chinese" # <-- Please translate, this should be the word "Chinese" in Chinese LANGUAGE_NAME_ENGLISH = u"Chinese" TRANSLATOR_NAMES = [u"mickeywaley"] #buttons BTN_CANCEL = u"取消" BTN_OK = u"Ok" # <-- Please translate BTN_SAVE_AS = u"另存为..." BTN_CLOSE = u"关闭" #status ST_AVAILABLE = u"可用的" ST_AWAY = u"离去" ST_EXTENDED_AWAY = u"扩展的距离" ST_OFFLINE = u"离线" #TaskbarMenu MTB_SHOW_HIDE_TORCHAT = u"显示/隐藏TorChat" MTB_QUIT = u"退出" #popup menu MPOP_CHAT = u"聊天..." MPOP_SEND_FILE = u"发送文件..." MPOP_EDIT_CONTACT = u"编辑联络..." MPOP_DELETE_CONTACT = u"删除联系人..." MPOP_SHOW_OFFLINE_MESSAGES = u"查看离线消息队列" MPOP_CLEAR_OFFLINE_MESSAGES = u"清除排队离线消息" # MPOP_ACTIVATE_LOG = u"Activate logging to file" # MPOP_STOP_LOG = u"Stop logging" # MPOP_DELETE_EXISTING_LOG = u"Delete existing log file" # MPOP_DELETE_AND_STOP_LOG = u"Delete log and stop logging" MPOP_ADD_CONTACT = u"新增联络人..." MPOP_ABOUT = u"关于TorChat" MPOP_ASK_AUTHOR = u"询问 %s..." MPOP_SETTINGS = u"设置..." # MPOP_EDIT_MY_PROFILE = u"Edit my profile..." #chat window popup menu CPOP_COPY = u"复制" #confirm delete message box D_CONFIRM_DELETE_TITLE = u"确认删除" D_CONFIRM_DELETE_MESSAGE = u"确实要删除此联络?\n(%s %s)" #warning about log D_LOG_WARNING_TITLE = u"TorChat: 日志记录是积极的" D_LOG_WARNING_MESSAGE = u"记录到的文件被激活!\n\nLog File: %s\n\n请记住,删除日志文件如果您已经完成调试,因为日志文件可能包含敏感信息。" #warning about used port D_WARN_USED_PORT_TITLE = u"TorChat: 端口已在使用中" D_WARN_USED_PORT_MESSAGE = u"Something, 可能还有TorChat例如,已经在听 %s:%s. 您必须创建一个配置文件使用不同的端口,能够启动TorChat第二次。" #warnig about unread messages D_WARN_UNREAD_TITLE = u"TorChat: 未读消息" D_WARN_UNREAD_MESSAGE = u"有未读消息.\n他们将永远失去!\n\n你真的要退出TorChat呢?" #warning about offline buddy D_WARN_BUDDY_OFFLINE_TITLE = u"TorChat: 好友离线" D_WARN_BUDDY_OFFLINE_MESSAGE = u"此操作是不可能的离线好友" #warning about multiple files D_WARN_FILE_ONLY_ONE_TITLE = u"TorChat: 多个文件" D_WARN_FILE_ONLY_ONE_MESSAGE = u"您可能无法启动一个操作多个文件传输。开始转让单独或发送一个zip文件,而不是" #warning about file save error D_WARN_FILE_SAVE_ERROR_TITLE = u"TorChat: 错误保存文件" D_WARN_FILE_SAVE_ERROR_MESSAGE = u"该文件 '%s' 不能创建.\n\n%s" #warning about file already exists D_WARN_FILE_ALREADY_EXISTS_TITLE = u"TorChat: 文件存在" D_WARN_FILE_ALREADY_EXISTS_MESSAGE = u"该文件 '%s' 已存在.\n覆盖它?" #dialog: add/edit contact DEC_TITLE_ADD = u"添加新的联系人" DEC_TITLE_EDIT = u"编辑联络人" DEC_TORCHAT_ID = u"TorChat ID" DEC_DISPLAY_NAME = u"显示名称" DEC_INTRODUCTION = u"导言" DEC_MSG_16_CHARACTERS = u"该地址必须是16个字符长, 不 %i." DEC_MSG_ONLY_ALPANUM = u"该地址必须只包含数字和小写字母" DEC_MSG_ALREADY_ON_LIST = u"%s 已在您的名单" # #dialog: edit my profile # DEP_TITLE = u"Edit my profile" # DEP_NAME = u"Name" # DEP_TEXT = u"Text" # DEP_SET_AVATAR = u"Set Avatar" # DEP_REMOVE_AVATAR = u"Remove Avatar" # DEP_AVATAR_SELECT_PNG = u"Select .PNG file to use as your avatar (will be scaled to 64*64, may contain transparency)" # DEP_PNG_FILES = u"PNG files" # DEP_ALL_FILES = u"All files" # DEP_WARN_TITLE = u"Avatar selection not possible" # DEP_WARN_IS_ALREADY = u"This is already the current avatar" # DEP_WARN_MUST_BE_PNG = u"The avatar must be a .png file" #file transfer window DFT_FILE_OPEN_TITLE = u"发送文件 %s" DFT_FILE_SAVE_TITLE = u"从保存文件 %s" DFT_SEND = u"发送 %s\nto %s\n%04.1f%% (%i of %i bytes)" DFT_RECEIVE = u"接收 %s\nfrom %s\n%04.1f%% (%i of %i bytes)" # DFT_WAITING = u"waiting for connection" # DFT_STARTING = u"starting transfer" # DFT_ABORTED = u"transfer aborted" # DFT_COMPLETE = u"transfer complete" # DFT_ERROR = u"error" #settings dialaog DSET_TITLE = u"TorChat配置" DSET_NET_TITLE = u"网络" DSET_NET_ACTIVE = u"活跃" DSET_NET_INACTIVE = u"无效" DSET_NET_TOR_ADDRESS = u"Tor的代理地址" DSET_NET_TOR_SOCKS = u"Socks 端口" DSET_NET_TOR_CONTROL = u"控制端口" DSET_NET_OWN_HOSTNAME = u"自己的 TorChat-ID" DSET_NET_LISTEN_INTERFACE = u"听接口" DSET_NET_LISTEN_PORT = u"监听端口" DSET_GUI_TITLE = u"用户界面" DSET_GUI_LANGUAGE = u"语言" DSET_GUI_OPEN_MAIN_HIDDEN = u"首先,最小化主窗口" DSET_GUI_OPEN_CHAT_HIDDEN = u"不要自动打开新窗" DSET_GUI_NOTIFICATION_POPUP = u"通知弹出" # DSET_GUI_NOTIFICATION_METHOD = u"Notification method" DSET_GUI_FLASH_WINDOW = u"闪光的新消息窗口的标题" DSET_MISC_TITLE = u"临时目录" DSET_MISC_TEMP_IN_DATA = u"内部数据存储临时文件的目录" DSET_MISC_TEMP_CUSTOM_DIR = u"临时目录(保留为空操作系统默认)" #notices in the chat window (those in square brackets) NOTICE_DELAYED_MSG_WAITING = u"轮候时间将邮件发送" NOTICE_DELAYED_MSG_SENT = u"拖延已发送的邮件" NOTICE_DELAYED = u"延迟" #messagebox for offline messages MSG_OFFLINE_TITLE = u"TorChat:排队的消息" MSG_OFFLINE_EMPTY = u"没有(更多)排队的消息的 %s" MSG_OFFLINE_QUEUED = u"排队离线消息 %s:\n\n%s" # #buddy list mouse hover popup # BPOP_BUDDY_IS_OFFLINE = u"Buddy is offline" # BPOP_CONNECTED_AWAITING_RETURN_CONN = u"Connected, awaiting return connection..." # BPOP_CLIENT_SOFTWARE = u"Client: %s %s" # #logging of conversations to file # LOG_HEADER = u"This log file is not signed and has no cogency of proof" # LOG_STARTED = u"Logging started" # LOG_STOPPED = u"Logging stopped" # LOG_DELETED = u"Log files have been deleted" # LOG_IS_ACTIVATED = u"Logging to file is activated:\n%s" # LOG_IS_STOPPED_OLD_LOG_FOUND = u"Logging is stopped but old log file still exists:\n%s" #about box ABOUT_TITLE = u"关于TorChat" ABOUT_TEXT = u"""TorChat %(version)s (svn: r%(svn)s) %(copyright)s Translations: %(translators)s Runtime environment: Python: %(python)s wx: %(wx)s TorChat is free software: you can redistribute it and/or \ modify it under the terms of the GNU General Public \ License as published by the Free Software Foundation, \ either version 3 of the License, or (at your option) \ any later version. TorChat is distributed in the hope that it will be useful, \ but WITHOUT ANY WARRANTY; without even the implied \ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \ See the GNU General Public License for more details. * And now for something completely different: If you happen to run a software company near Hannover, Germany and \ are in need of a new coder, feel free to regard this little program \ as my application documents and drop me a mail with your answer. """src/translations/__init__.py0000666000175000017500000000030011714662540016014 0ustar dererkdererkimport lang_en import lang_bg import lang_de import lang_fr import lang_hu import lang_it import lang_nl import lang_pl import lang_pt import lang_ru import lang_sv import lang_zh src/translations/lang_bg.py0000666000175000017500000002407411714662540015664 0ustar dererkdererk# -*- coding: UTF-8 -*- ############################################################################## # # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # Translation file for TorChat # # # ############################################################################## LANGUAGE_CODE = u"bg" LANGUAGE_NAME = u"Български" LANGUAGE_NAME_ENGLISH = u"Bulgarian" TRANSLATOR_NAMES = [u"Asen Anastassov smaragdus@gmail.com"] #buttons BTN_CANCEL = u"Отмяна" BTN_OK = u"Добре" BTN_SAVE_AS = u"Запазване като..." BTN_CLOSE = u"Затваряне" #status ST_AVAILABLE = u"на линия" ST_AWAY = u"отсъстващ" ST_EXTENDED_AWAY = u"недостъпен" ST_OFFLINE = u"извън линия" #TaskbarMenu MTB_SHOW_HIDE_TORCHAT = u"Показване/Скриване на TorChat" MTB_QUIT = u"Напускане" #popup menu MPOP_CHAT = u"Чат..." MPOP_SEND_FILE = u"Изпращане на файл..." MPOP_EDIT_CONTACT = u"Редактиране на контакт..." MPOP_DELETE_CONTACT = u"Изтриване на контакт..." MPOP_SHOW_OFFLINE_MESSAGES = u"Показване на неизпратени офлайн съобщения" MPOP_CLEAR_OFFLINE_MESSAGES = u"Премахване на неизпратени офлайн съобщения" # MPOP_ACTIVATE_LOG = u"Activate logging to file" # MPOP_STOP_LOG = u"Stop logging" # MPOP_DELETE_EXISTING_LOG = u"Delete existing log file" # MPOP_DELETE_AND_STOP_LOG = u"Delete log and stop logging" MPOP_ADD_CONTACT = u"Прибавяне на контакт..." MPOP_ABOUT = u"Относно TorChat" MPOP_ASK_AUTHOR = u"Попитайте %s..." MPOP_SETTINGS = u"Настройки..." # MPOP_EDIT_MY_PROFILE = u"Edit my profile..." #chat window popup menu CPOP_COPY = u"Копиране" #confirm delete message box D_CONFIRM_DELETE_TITLE = u"Потвърждаване на изтриване" D_CONFIRM_DELETE_MESSAGE = u"Наистина ли желаете да изтриете този контакт?\n(%s %s)" #warning about log D_LOG_WARNING_TITLE = u"TorChat: Дневник активен" D_LOG_WARNING_MESSAGE = u"Запазване на дневник във файл активирано!\n\nLog File: %s\n\nНе забравяйте да изтриете файла с дневника след като приключите анализа на грешките, защото той може да съдържа поверителна информация." #warning about used port D_WARN_USED_PORT_TITLE = u"TorChat: Портът е вече в употреба" D_WARN_USED_PORT_MESSAGE = u"Нещо, вероятно второ копие на TorChat вече ползва %s:%s. Трябва да създадете нов профил ползващ други портове, за да можете да стартирате второ копие на TorChat." #warnig about unread messages D_WARN_UNREAD_TITLE = u"TorChat: Непрочетени съобщения" D_WARN_UNREAD_MESSAGE = u"Има непрочетени съобщения.\nТе ще бъдат загубени безвъзвратно!\n\nНаистина ли желаете да напуснете TorChat сега?" #warning about offline buddy D_WARN_BUDDY_OFFLINE_TITLE = u"TorChat: Контактът не е на линия" D_WARN_BUDDY_OFFLINE_MESSAGE = u"Тази операция не е възможна с контакти извън линия" #warning about multiple files D_WARN_FILE_ONLY_ONE_TITLE = u"TorChat: Няколко файла" D_WARN_FILE_ONLY_ONE_MESSAGE = u"Не можете да изпратите няколко файла едновременно. Изпратете ги поотделно или като zip-файл." #warning about file save error D_WARN_FILE_SAVE_ERROR_TITLE = u"TorChat: Грешка при запазване на файла" D_WARN_FILE_SAVE_ERROR_MESSAGE = u"Файлът '%s' не може да бъде създаден.\n\n%s" #warning about file already exists D_WARN_FILE_ALREADY_EXISTS_TITLE = u"TorChat: Файлът съществува" D_WARN_FILE_ALREADY_EXISTS_MESSAGE = u"Файлът '%s' вече съществува.\nЖелаете ли да го замените?" #dialog: add/edit contact DEC_TITLE_ADD = u"Добавяне на нов контакт" DEC_TITLE_EDIT = u"Редактиране на контакт" DEC_TORCHAT_ID = u"TorChat ID" DEC_DISPLAY_NAME = u"Име" DEC_INTRODUCTION = u"Въведение" DEC_MSG_16_CHARACTERS = u"Адресът трябва да се състои от 16 символа, не %i." DEC_MSG_ONLY_ALPANUM = u"Адресът трябва да се състои единствено от цифри и малки букви." DEC_MSG_ALREADY_ON_LIST = u"%s е вече във вашия списък" # #dialog: edit my profile # DEP_TITLE = u"Edit my profile" # DEP_NAME = u"Name" # DEP_TEXT = u"Text" # DEP_SET_AVATAR = u"Set Avatar" # DEP_REMOVE_AVATAR = u"Remove Avatar" # DEP_AVATAR_SELECT_PNG = u"Select .PNG file to use as your avatar (will be scaled to 64*64, may contain transparency)" # DEP_PNG_FILES = u"PNG files" # DEP_ALL_FILES = u"All files" # DEP_WARN_TITLE = u"Avatar selection not possible" # DEP_WARN_IS_ALREADY = u"This is already the current avatar" # DEP_WARN_MUST_BE_PNG = u"The avatar must be a .png file" #file transfer window DFT_FILE_OPEN_TITLE = u"Изпращане на файл до %s" DFT_FILE_SAVE_TITLE = u"Запазване на файл от %s" DFT_SEND = u"Изпращане на %s\nto %s\n%04.1f%% (%i of %i байта)" DFT_RECEIVE = u"Получаване на %s\nfrom %s\n%04.1f%% (%i of %i байта)" # DFT_WAITING = u"waiting for connection" # DFT_STARTING = u"starting transfer" # DFT_ABORTED = u"transfer aborted" # DFT_COMPLETE = u"transfer complete" # DFT_ERROR = u"error" #settings dialaog DSET_TITLE = u"Конфигуриране на TorChat" DSET_NET_TITLE = u"Мрежа" DSET_NET_ACTIVE = u"Активна" DSET_NET_INACTIVE = u"Неактивна" DSET_NET_TOR_ADDRESS = u"Адрес на Tor прокси" DSET_NET_TOR_SOCKS = u"Socks порт" DSET_NET_TOR_CONTROL = u"Контролен порт" DSET_NET_OWN_HOSTNAME = u"Собствено TorChat-ID" DSET_NET_LISTEN_INTERFACE = u"Интерфейс за прослушване" DSET_NET_LISTEN_PORT = u"Порт за прослушване" DSET_GUI_TITLE = u"Потребителски интерфейс" DSET_GUI_LANGUAGE = u"Език" DSET_GUI_OPEN_MAIN_HIDDEN = u"Стартиране с минимизиран главен прозорец" DSET_GUI_OPEN_CHAT_HIDDEN = u"Нови прозорци не се отварят автоматично" DSET_GUI_NOTIFICATION_POPUP = u"Изскачащо известяване" # DSET_GUI_NOTIFICATION_METHOD = u"Notification method" DSET_GUI_FLASH_WINDOW = u"Пробягващ прозорец при получаване на ново съобщение" DSET_MISC_TITLE = u"Разни" DSET_MISC_TEMP_IN_DATA = u"Съхраняване на временни файлове в директория с данни" DSET_MISC_TEMP_CUSTOM_DIR = u"Временна директория (празна по подразбиране за ОС)" #notices in the chat window (those in square brackets) NOTICE_DELAYED_MSG_WAITING = u"забавени съобщения, чакащи да бъдат изпратени" NOTICE_DELAYED_MSG_SENT = u"забавени съобщения изпратени" NOTICE_DELAYED = u"забавени" #messagebox for offline messages MSG_OFFLINE_TITLE = u"TorChat: съобщения на опашка" MSG_OFFLINE_EMPTY = u"няма (повече) съобщения на опашка за %s" MSG_OFFLINE_QUEUED = u"офлайн съобщения на опашка за %s:\n\n%s" # #buddy list mouse hover popup # BPOP_BUDDY_IS_OFFLINE = u"Buddy is offline" # BPOP_CONNECTED_AWAITING_RETURN_CONN = u"Connected, awaiting return connection..." # BPOP_CLIENT_SOFTWARE = u"Client: %s %s" # #logging of conversations to file # LOG_HEADER = u"This log file is not signed and has no cogency of proof" # LOG_STARTED = u"Logging started" # LOG_STOPPED = u"Logging stopped" # LOG_DELETED = u"Log files have been deleted" # LOG_IS_ACTIVATED = u"Logging to file is activated:\n%s" # LOG_IS_STOPPED_OLD_LOG_FOUND = u"Logging is stopped but old log file still exists:\n%s" #about box ABOUT_TITLE = u"Относно TorChat" ABOUT_TEXT = u"""TorChat %(version)s (svn: r%(svn)s) %(copyright)s Превод: %(translators)s Runtime environment: Python: %(python)s wx: %(wx)s TorChat е свободен софтуер: можете да го разпространявате и / или \ модифицирате при условията на GNU General Public License както е публикуван от Free Software Foundation, \ или версия 3, или (по ваш избор) \ която и да е следваща версия. TorChat се разпространява с надеждата, че ще бъде от полза, \ но БЕЗ НИКАКВИ ГАРАНЦИИ; без дори косвена \ гаранция за ПРИГОДНОСТ ЗА ОПРЕДЕЛЕНА ЦЕЛ. \ Вижте GNU General Public License за повече подробности. * И сега за нещо съвсем различно: Ако случайно управлявате софтуерна компания в района на Хановер, Германия и \ се нуждаете от нов програмист, приемете тази малка програма \ като моите документи за кандидатстване и ми пратете е-мейл с вашия отговор. """src/translations/lang_hu.py0000666000175000017500000001766511714662540015720 0ustar dererkdererk# -*- coding: UTF-8 -*- ############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # Translation file for TorChat # # # ############################################################################## LANGUAGE_CODE = u"hu" LANGUAGE_NAME = u"Magyar" LANGUAGE_NAME_ENGLISH = u"Hungarian" TRANSLATOR_NAMES = [u"d4n3sz"] #buttons BTN_CANCEL = u"Mégse" BTN_OK = u"Ok" BTN_SAVE_AS = u"Mentés másként..." BTN_CLOSE = u"Bezár" #status ST_AVAILABLE = u"Elérhető" ST_AWAY = u"Rögtön jövök" ST_EXTENDED_AWAY = u"Nincs a gépnél" ST_OFFLINE = u"Kapcsolat nélkül" #TaskbarMenu MTB_SHOW_HIDE_TORCHAT = u"Mutat/Rejt TorChat" MTB_QUIT = u"Kilépés" #popup menu MPOP_CHAT = u"Chat..." MPOP_SEND_FILE = u"Fájl küldés..." MPOP_EDIT_CONTACT = u"Partner szerkesztése..." MPOP_DELETE_CONTACT = u"Partner törlése..." MPOP_SHOW_OFFLINE_MESSAGES = u"Offline ki küldött üzenetek mutatása" MPOP_CLEAR_OFFLINE_MESSAGES = u"Offline kiküldött üzenetek törlése" # MPOP_ACTIVATE_LOG = u"Activate logging to file" # MPOP_STOP_LOG = u"Stop logging" # MPOP_DELETE_EXISTING_LOG = u"Delete existing log file" # MPOP_DELETE_AND_STOP_LOG = u"Delete log and stop logging" MPOP_ADD_CONTACT = u"Partner hozzáadása..." MPOP_ABOUT = u"A TorChat-ról" MPOP_ASK_AUTHOR = u"Kérdezd %s..." MPOP_SETTINGS = u"Beállítások..." # MPOP_EDIT_MY_PROFILE = u"Edit my profile..." #chat window popup menu CPOP_COPY = u"Másolás" #confirm delete message box D_CONFIRM_DELETE_TITLE = u"Törlés megerősítése" D_CONFIRM_DELETE_MESSAGE = u"Valóban törölni akarod?\n(%s %s)" #warning about log D_LOG_WARNING_TITLE = u"TorChat: Logolás aktív" D_LOG_WARNING_MESSAGE = u"Logolás mentése fájlba bekapcsolva!\n\nLog Fájl: %s\n\nNe felejtsd el törölni a log fájlt, ha befejezted a hibakeresést,mert személyes információkat is tartalmazhat." #warning about used port D_WARN_USED_PORT_TITLE = u"TorChat: A port már használatban van" D_WARN_USED_PORT_MESSAGE = u"Valószínűleg már egy másik TorChat fut itt: %s:%s. Csinálj egy másik profilt más porttal, hogy el tudj indítani egy másik TorChat-et!" #warnig about unread messages D_WARN_UNREAD_TITLE = u"TorChat: Olvasatlan üzenet" D_WARN_UNREAD_MESSAGE = u"Olvasatlan üzeneted van.\nEl fog veszni véglegesen!\n\nBiztosan ki akarsz lépni a TorChat-ból?" #warning about offline buddy D_WARN_BUDDY_OFFLINE_TITLE = u"TorChat: Partner nincs kapcsolódva" D_WARN_BUDDY_OFFLINE_MESSAGE = u"Ezt a műveleted nem lehet végrehajtani kapcsolat nélküli partnerrel" #warning about multiple files D_WARN_FILE_ONLY_ONE_TITLE = u"TorChat: Sok fájl" D_WARN_FILE_ONLY_ONE_MESSAGE = u"Nem tudsz egyszerre több fájlt küldeni. Küldd el a fájlokat egyenként, vagy használj tömörítést (pl. zip)" #warning about file save error D_WARN_FILE_SAVE_ERROR_TITLE = u"TorChat: Hiba a fájl mentése közben" D_WARN_FILE_SAVE_ERROR_MESSAGE = u"A '%s' fájl létrehozása sikertelen.\n\n%s" #warning about file already exists D_WARN_FILE_ALREADY_EXISTS_TITLE = u"TorChat: A fájl már létezik" D_WARN_FILE_ALREADY_EXISTS_MESSAGE = u"A '%s' már létezik.\nFelülírod?" #dialog: add/edit contact DEC_TITLE_ADD = u"Új partner hozzáadása" DEC_TITLE_EDIT = u"Partner szerkesztése" DEC_TORCHAT_ID = u"TorChat azonosító" DEC_DISPLAY_NAME = u"Megjelenített név" DEC_INTRODUCTION = u"Bemutatkozás" DEC_MSG_16_CHARACTERS = u"Az azonosító 16 karakter hosszú lehet, nem %i." DEC_MSG_ONLY_ALPANUM = u"Az azonosító csak számokat és az angol abc betüit tartalmazhatja" DEC_MSG_ALREADY_ON_LIST = u"%s már a listádban van" # #dialog: edit my profile # DEP_TITLE = u"Edit my profile" # DEP_NAME = u"Name" # DEP_TEXT = u"Text" # DEP_SET_AVATAR = u"Set Avatar" # DEP_REMOVE_AVATAR = u"Remove Avatar" # DEP_AVATAR_SELECT_PNG = u"Select .PNG file to use as your avatar (will be scaled to 64*64, may contain transparency)" # DEP_PNG_FILES = u"PNG files" # DEP_ALL_FILES = u"All files" # DEP_WARN_TITLE = u"Avatar selection not possible" # DEP_WARN_IS_ALREADY = u"This is already the current avatar" # DEP_WARN_MUST_BE_PNG = u"The avatar must be a .png file" #file transfer window DFT_FILE_OPEN_TITLE = u"Fájl küldése %s számára" DFT_FILE_SAVE_TITLE = u"Fájl mentése %s-től" DFT_SEND = u"Külédes %s\n %s-nak\n%04.1f%% (%i kész %i bájtból)" DFT_RECEIVE = u"Fogadás %s\n %s-től\n%04.1f%% (%i kész %i bájtból)" # DFT_WAITING = u"waiting for connection" # DFT_STARTING = u"starting transfer" # DFT_ABORTED = u"transfer aborted" # DFT_COMPLETE = u"transfer complete" # DFT_ERROR = u"error" #settings dialaog DSET_TITLE = u"TorChat beállítások" DSET_NET_TITLE = u"Hálózat" DSET_NET_ACTIVE = u"aktív" DSET_NET_INACTIVE = u"inaktív" DSET_NET_TOR_ADDRESS = u"Tor proxy cím" DSET_NET_TOR_SOCKS = u"Socks port" DSET_NET_TOR_CONTROL = u"Control port" DSET_NET_OWN_HOSTNAME = u"Saját TorChat-azonosító" DSET_NET_LISTEN_INTERFACE = u"Figyelő cím" DSET_NET_LISTEN_PORT = u"Figyelő port" DSET_GUI_TITLE = u"Felhasználói felület" DSET_GUI_LANGUAGE = u"Nyelv" DSET_GUI_OPEN_MAIN_HIDDEN = u"Indítás minimalizált ablakkal" DSET_GUI_OPEN_CHAT_HIDDEN = u"Ne nyisson automatikusan új ablakokat" DSET_GUI_NOTIFICATION_POPUP = u"Felugró figyelmeztetések" # DSET_GUI_NOTIFICATION_METHOD = u"Notification method" DSET_GUI_FLASH_WINDOW = u"Ablak címének villogtatása új üzenet érkezésekor" DSET_MISC_TITLE = u"Egyebek" DSET_MISC_TEMP_IN_DATA = u"Ideiglenes fájlok tárolása a saját könyvtárban" DSET_MISC_TEMP_CUSTOM_DIR = u"Ideiglenes könyvtár (ha üres, akkor az op.rendszer alapértelmezett könyvtára)" #notices in the chat window (those in square brackets) NOTICE_DELAYED_MSG_WAITING = u"várakozó üzenetek küldése" NOTICE_DELAYED_MSG_SENT = u"várakozó üzenetek elküldve" NOTICE_DELAYED = u"várakozik/késleltetett" #messagebox for offline messages MSG_OFFLINE_TITLE = u"TorChat: várakozó üzenetek" MSG_OFFLINE_EMPTY = u"nincs (több) várakozó üzenet %s felöl" MSG_OFFLINE_QUEUED = u"várakozó offline üzenet %s felöl:\n\n%s" # #buddy list mouse hover popup # BPOP_BUDDY_IS_OFFLINE = u"Buddy is offline" # BPOP_CONNECTED_AWAITING_RETURN_CONN = u"Connected, awaiting return connection..." # BPOP_CLIENT_SOFTWARE = u"Client: %s %s" # #logging of conversations to file # LOG_HEADER = u"This log file is not signed and has no cogency of proof" # LOG_STARTED = u"Logging started" # LOG_STOPPED = u"Logging stopped" # LOG_DELETED = u"Log files have been deleted" # LOG_IS_ACTIVATED = u"Logging to file is activated:\n%s" # LOG_IS_STOPPED_OLD_LOG_FOUND = u"Logging is stopped but old log file still exists:\n%s" #about box ABOUT_TITLE = u"A TorChat-ról" ABOUT_TEXT = u"""TorChat %(version)s (svn: r%(svn)s) %(copyright)s Translations: %(translators)s Runtime environment: Python: %(python)s wx: %(wx)s TorChat is free software: you can redistribute it and/or \ modify it under the terms of the GNU General Public \ License as published by the Free Software Foundation, \ either version 3 of the License, or (at your option) \ any later version. TorChat is distributed in the hope that it will be useful, \ but WITHOUT ANY WARRANTY; without even the implied \ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \ See the GNU General Public License for more details. * And now for something completely different: If you happen to run a software company near Hannover, Germany and \ are in need of a new coder, feel free to regard this little program \ as my application documents and drop me a mail with your answer. """src/translations/lang_en.py0000666000175000017500000001710411726674046015701 0ustar dererkdererk# -*- coding: UTF-8 -*- ############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # Translation file for TorChat # # # ############################################################################## LANGUAGE_CODE = u"en" LANGUAGE_NAME = u"English" LANGUAGE_NAME_ENGLISH = u"English" TRANSLATOR_NAMES = [] #buttons BTN_CANCEL = u"Cancel" BTN_OK = u"Ok" BTN_SAVE_AS = u"Save as..." BTN_CLOSE = u"Close" #status ST_AVAILABLE = u"Available" ST_AWAY = u"Away" ST_EXTENDED_AWAY = u"Extended away" ST_OFFLINE = u"Offline" #TaskbarMenu MTB_SHOW_HIDE_TORCHAT = u"Show/Hide TorChat" MTB_QUIT = u"Quit" #popup menu MPOP_CHAT = u"Chat..." MPOP_SEND_FILE = u"Send file..." MPOP_EDIT_CONTACT = u"Edit contact..." MPOP_DELETE_CONTACT = u"Delete contact..." MPOP_SHOW_OFFLINE_MESSAGES = u"Show queued offline messages" MPOP_CLEAR_OFFLINE_MESSAGES = u"Clear queued offline messages" MPOP_ACTIVATE_LOG = u"Activate logging to file" MPOP_STOP_LOG = u"Stop logging" MPOP_DELETE_EXISTING_LOG = u"Delete existing log file" MPOP_DELETE_AND_STOP_LOG = u"Delete log and stop logging" MPOP_ADD_CONTACT = u"Add contact..." MPOP_ABOUT = u"About TorChat" MPOP_ASK_AUTHOR = u"Ask %s..." MPOP_SETTINGS = u"Settings..." MPOP_EDIT_MY_PROFILE = u"Edit my profile..." MPOP_COPY_ID_TO_CLIPBOARD=u"Copy ID to clipboard" #chat window popup menu CPOP_COPY = u"Copy" #confirm delete message box D_CONFIRM_DELETE_TITLE = u"Confirm deletion" D_CONFIRM_DELETE_MESSAGE = u"Really delete this contact?\n(%s %s)" #warning about log D_LOG_WARNING_TITLE = u"TorChat: Logging is active" D_LOG_WARNING_MESSAGE = u"Logging to file is activated!\n\nLog File: %s\n\nRemember to delete the log file if you have finished debugging because the log file may contain sensitive information." #warning about used port D_WARN_USED_PORT_TITLE = u"TorChat: Port already in use" D_WARN_USED_PORT_MESSAGE = u"Something, probably another TorChat instance, is already listening at %s:%s. You must create another profile using different ports to be able to start TorChat a second time." #warnig about unread messages D_WARN_UNREAD_TITLE = u"TorChat: Unread messages" D_WARN_UNREAD_MESSAGE = u"There are unread messages.\nThey will be lost forever!\n\nDo you really want to exit TorChat now?" #warning about offline buddy D_WARN_BUDDY_OFFLINE_TITLE = u"TorChat: Buddy is offline" D_WARN_BUDDY_OFFLINE_MESSAGE = u"This operation is not possible with offline buddies" #warning about multiple files D_WARN_FILE_ONLY_ONE_TITLE = u"TorChat: Multiple files" D_WARN_FILE_ONLY_ONE_MESSAGE = u"You may not start multiple file transfers with one operation. Start the transfers individually or send a zip-file instead" #warning about file save error D_WARN_FILE_SAVE_ERROR_TITLE = u"TorChat: Error saving file" D_WARN_FILE_SAVE_ERROR_MESSAGE = u"The file '%s' could not be created.\n\n%s" #warning about file already exists D_WARN_FILE_ALREADY_EXISTS_TITLE = u"TorChat: File exists" D_WARN_FILE_ALREADY_EXISTS_MESSAGE = u"The file '%s' already exists.\nOverwrite it?" #dialog: add/edit contact DEC_TITLE_ADD = u"Add new contact" DEC_TITLE_EDIT = u"Edit contact" DEC_TORCHAT_ID = u"TorChat ID" DEC_DISPLAY_NAME = u"Display name" DEC_INTRODUCTION = u"Introduction" DEC_MSG_16_CHARACTERS = u"The address must be 16 characters long, not %i." DEC_MSG_ONLY_ALPANUM = u"The address must only contain numbers and lowercase letters" DEC_MSG_ALREADY_ON_LIST = u"%s is already on your list" #dialog: edit my profile DEP_TITLE = u"Edit my profile" DEP_NAME = u"Name" DEP_TEXT = u"Text" DEP_SET_AVATAR = u"Set Avatar" DEP_REMOVE_AVATAR = u"Remove Avatar" DEP_AVATAR_SELECT_PNG = u"Select .PNG file to use as your avatar (will be scaled to 64*64, may contain transparency)" DEP_PNG_FILES = u"PNG files" DEP_ALL_FILES = u"All files" DEP_WARN_TITLE = u"Avatar selection not possible" DEP_WARN_IS_ALREADY = u"This is already the current avatar" DEP_WARN_MUST_BE_PNG = u"The avatar must be a .png file" #file transfer window DFT_FILE_OPEN_TITLE = u"Send file to %s" DFT_FILE_SAVE_TITLE = u"Save file from %s" DFT_SEND = u"Sending %s\nto %s\n%04.1f%% (%i of %i bytes)" DFT_RECEIVE = u"Receiving %s\nfrom %s\n%04.1f%% (%i of %i bytes)" DFT_WAITING = u"waiting for connection" DFT_STARTING = u"starting transfer" DFT_ABORTED = u"transfer aborted" DFT_COMPLETE = u"transfer complete" DFT_ERROR = u"error" #settings dialaog DSET_TITLE = u"TorChat configuration" DSET_NET_TITLE = u"Network" DSET_NET_ACTIVE = u"active" DSET_NET_INACTIVE = u"inactive" DSET_NET_TOR_ADDRESS = u"Tor proxy address" DSET_NET_TOR_SOCKS = u"Socks port" DSET_NET_TOR_CONTROL = u"Control port" DSET_NET_OWN_HOSTNAME = u"Own TorChat-ID" DSET_NET_LISTEN_INTERFACE = u"Listen interface" DSET_NET_LISTEN_PORT = u"Listen port" DSET_GUI_TITLE = u"User interface" DSET_GUI_LANGUAGE = u"Language" DSET_GUI_OPEN_MAIN_HIDDEN = u"Start with minimized main window" DSET_GUI_OPEN_CHAT_HIDDEN = u"Don't automatically open new windows" DSET_GUI_NOTIFICATION_POPUP = u"Notification pop-up" DSET_GUI_NOTIFICATION_METHOD = u"Notification method" DSET_GUI_FLASH_WINDOW = u"Flash window title on new message" DSET_MISC_TITLE = u"Misc" DSET_MISC_TEMP_IN_DATA = u"Store temporary files inside data directory" DSET_MISC_TEMP_CUSTOM_DIR = u"Temporary directory (leave empty for OS-default)" #notices in the chat window (those in square brackets) NOTICE_DELAYED_MSG_WAITING = u"delayed messages waiting to be sent" NOTICE_DELAYED_MSG_SENT = u"delayed messages have been sent" NOTICE_DELAYED = u"delayed" #messagebox for offline messages MSG_OFFLINE_TITLE = u"TorChat: queued messages" MSG_OFFLINE_EMPTY = u"there are no (more) queued messages for %s" MSG_OFFLINE_QUEUED = u"queued offline messages for %s:\n\n%s" #buddy list mouse hover popup BPOP_BUDDY_IS_OFFLINE = u"Buddy is offline" BPOP_CONNECTED_AWAITING_RETURN_CONN = u"Connected, awaiting return connection..." BPOP_CLIENT_SOFTWARE = u"Client: %s %s" #logging of conversations to file LOG_HEADER = u"This log file is not signed and has no cogency of proof" LOG_STARTED = u"Logging started" LOG_STOPPED = u"Logging stopped" LOG_DELETED = u"Log files have been deleted" LOG_IS_ACTIVATED = u"Logging to file is activated:\n%s" LOG_IS_STOPPED_OLD_LOG_FOUND = u"Logging is stopped but old log file still exists:\n%s" #about box ABOUT_TITLE = u"About TorChat" ABOUT_TEXT = u"""TorChat %(version)s (svn: r%(svn)s) %(copyright)s Translations: %(translators)s Runtime environment: Python: %(python)s wx: %(wx)s TorChat is free software: you can redistribute it and/or \ modify it under the terms of the GNU General Public \ License as published by the Free Software Foundation, \ either version 3 of the License, or (at your option) \ any later version. TorChat is distributed in the hope that it will be useful, \ but WITHOUT ANY WARRANTY; without even the implied \ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \ See the GNU General Public License for more details. * And now for something completely different: If you happen to run a software company near Hannover, Germany and \ are in need of a new coder, feel free to regard this little program \ as my application documents and drop me a mail with your answer. """ src/translations/insert_missing.py0000666000175000017500000000612011714662540017320 0ustar dererkdererk#!/usr/bin/python import os import sys import shutil msg = """This little script will insert the missing strings into all incomplete translation files. It will create backup files with _ at the beginning. If for example lang_en.py has the definition FOO_BAR = u"foo bar" and that definition is missing in lang_de.py because lang_de.py is older then it will insert the missing definition into lang_de.py but it will be commented out, so that you can better find it: # FOO_BAR = u"foo bar" As a translator you now just open your language file, find all such missing translations, remove the # and translate them. Continue? (y/n) """ c = raw_input(msg) if c != "y": sys.exit() def readFile(filename): lines1 = [] f = open(filename) lines = f.readlines() f.close() #combine lines with \ at the end not_at_end = False for line in lines: line=line.rstrip() if not_at_end: last = len(lines1)-1 lines1[last] = lines1[last] + "\r\n" + line else: lines1.append(line) if line [-1:] == "\\": not_at_end = True else: not_at_end = False lines2 = [] #combine multiline strings literals with """ in_string = False for line in lines1: if in_string: last = len(lines2)-1 lines2[last] = lines2[last] + "\r\n" + line else: lines2.append(line) if ' = u"""' in line: in_string = True if ' = """' in line: in_string = True #the closing """ must be at the end of the line if line[-3:] == '"""': in_string = False return lines2 def updateTranslation(filename): print "*** updating %s" % filename cnt = 0 lang_xx_new = [] lang_xx = readFile(filename) for line_en in lang_en: def_en = line_en.split(" = ")[0] found = False for line_xx in lang_xx: def_xx = line_xx.split(" = ")[0] if def_xx == def_en: found = True break if def_xx == "# " + def_en or def_xx == "#" + def_en: #also find already inserted and commented out definitions found = True break if not found: # no translation found, use the version # from lang_en and insert a # before lang_xx_new.append("# " + line_en) print "inserting %s" % def_en cnt += 1 else: # use the already translated version lang_xx_new.append(line_xx) if cnt: shutil.move(filename, "_" + filename) f = open(filename, "w") f.write("\r\n".join(lang_xx_new)) f.close #load the english reference file lang_en = readFile("lang_en.py") #update all files in current directory filenames = os.listdir(".") for filename in filenames: if filename[:5] == "lang_" and filename[-3:] == ".py" and filename != "lang_en.py": updateTranslation(filename) src/translations/lang_ru.py0000666000175000017500000002432111714662540015715 0ustar dererkdererk# -*- coding: UTF-8 -*- ############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # Translation file for TorChat # # # ############################################################################## LANGUAGE_CODE = u"ru" LANGUAGE_NAME = u"Русский" LANGUAGE_NAME_ENGLISH = u"Russian" TRANSLATOR_NAMES = [u"SB14.org, RusInfo.cc"] #buttons BTN_CANCEL = u"Отмена" BTN_OK = u"Да" BTN_SAVE_AS = u"Сохранить как..." BTN_CLOSE = u"Закрыть" #status ST_AVAILABLE = u"В сети" ST_AWAY = u"Отсутствую" ST_EXTENDED_AWAY = u"Недоступен" ST_OFFLINE = u"Отключен" #TaskbarMenu MTB_SHOW_HIDE_TORCHAT = u"Показать/Скрыть TorChat" MTB_QUIT = u"Выход" #popup menu MPOP_CHAT = u"Чат..." MPOP_SEND_FILE = u"Послать файл..." MPOP_EDIT_CONTACT = u"Редактировать контакт..." MPOP_DELETE_CONTACT = u"Удалить контакт..." MPOP_SHOW_OFFLINE_MESSAGES = u"Показать очередь оффлайн сообщений" MPOP_CLEAR_OFFLINE_MESSAGES = u"Очистить очередь оффлайн сообщений" MPOP_ACTIVATE_LOG = u"Задействовать ведение лога" MPOP_STOP_LOG = u"Остановить ведение лога" MPOP_DELETE_EXISTING_LOG = u"Удалить существующий лог-файл" MPOP_DELETE_AND_STOP_LOG = u"Удалить лог и остановить логгирование" MPOP_ADD_CONTACT = u"Добавить контакт" MPOP_ABOUT = u"О программе TorChat" MPOP_ASK_AUTHOR = u"Спросить %s..." MPOP_SETTINGS = u"Установки..." MPOP_EDIT_MY_PROFILE = u"Редактировать мой профиль..." #chat window popup menu CPOP_COPY = u"Копировать" #confirm delete message box D_CONFIRM_DELETE_TITLE = u"Подтвердить удаление" D_CONFIRM_DELETE_MESSAGE = u"Действительно удалить этот контакт?\n(%s %s)" #warning about log D_LOG_WARNING_TITLE = u"Ведение лога TorChat активно" D_LOG_WARNING_MESSAGE = u"Запись лога в файл включена!\n\nLog File: %s\n\nПомните, что нужно удалить лог-файл, когда вы закончите отладку. Этот файл может содержать потенциально опасную важную информацию." #warning about used port D_WARN_USED_PORT_TITLE = u"TorChat: Порт занят" D_WARN_USED_PORT_MESSAGE = u"Какое-то приложение, скорее всего другой экземпляр TorChat, уже использует %s:%s. Вы должны создать еще один профиль с использованием других портов, чтобы запускать несколько экземпляров TorChat одновременно." #warnig about unread messages D_WARN_UNREAD_TITLE = u"TorChat: Непрочитанные сообщения" D_WARN_UNREAD_MESSAGE = u"У вас есть непрочитанные сообщения.\nОни будут утеряны навсегда!\n\nВы действительно хотите выйти из TorChat сейчас?" #warning about offline buddy D_WARN_BUDDY_OFFLINE_TITLE = u"TorChat: Контакт не в сети" D_WARN_BUDDY_OFFLINE_MESSAGE = u"Это операция невозможна, если контакт не в сети" #warning about multiple files D_WARN_FILE_ONLY_ONE_TITLE = u"TorChat: Несколько файлов" D_WARN_FILE_ONLY_ONE_MESSAGE = u"Вы не можете передавать несколько файлов одновременно. Посылайте файлы по одному или используйте архивы." #warning about file save error D_WARN_FILE_SAVE_ERROR_TITLE = u"TorChat: Невозможно сохранить файл" D_WARN_FILE_SAVE_ERROR_MESSAGE = u"Файл '%s' не может быть создан.\n\n%s" #warning about file already exists D_WARN_FILE_ALREADY_EXISTS_TITLE = u"TorChat: Файл существует" D_WARN_FILE_ALREADY_EXISTS_MESSAGE = u"Файл '%s' уже есть.\nПерезаписать?" #dialog: add/edit contact DEC_TITLE_ADD = u"Добавить контакт" DEC_TITLE_EDIT = u"Редактировать контакт" DEC_TORCHAT_ID = u"TorChat ID" DEC_DISPLAY_NAME = u"Отображаемое имя" DEC_INTRODUCTION = u"Текст приветствия" DEC_MSG_16_CHARACTERS = u"Адрес должен быть длиной 16 символов, а не %i." DEC_MSG_ONLY_ALPANUM = u"Адрес может содержать только цифры и буквы в нижнем регистре" DEC_MSG_ALREADY_ON_LIST = u"%s уже в списке" #dialog: edit my profile DEP_TITLE = u"Редактировать профиль" DEP_NAME = u"Имя" DEP_TEXT = u"Текст" DEP_SET_AVATAR = u"Установить аватар" DEP_REMOVE_AVATAR = u"Убрать аватар" DEP_AVATAR_SELECT_PNG = u"Выберите .PNG файл для аватара. Изображение будет отмасштабировано до 64*64, может содержать прозрачность" DEP_PNG_FILES = u"PNG файлы" DEP_ALL_FILES = u"Все файлы" DEP_WARN_TITLE = u"Выбор аватара невозможен" DEP_WARN_IS_ALREADY = u"Этот аватар уже используется" DEP_WARN_MUST_BE_PNG = u"Аватар должен быть .png файлом" #file transfer window DFT_FILE_OPEN_TITLE = u"Послать файл %s" DFT_FILE_SAVE_TITLE = u"Принять файл от %s" DFT_SEND = u"Отправка %s\n %s\n%04.1f%% (%i из %i байт(-а))" DFT_RECEIVE = u"Получение %s\n от %s\n%04.1f%% (%i из %i байт(-а))" DFT_WAITING = u"ожидание подключения" DFT_STARTING = u"запуск передачи" DFT_ABORTED = u"передача прервана" DFT_COMPLETE = u"передача завершена" DFT_ERROR = u"ошибка" #settings dialaog DSET_TITLE = u"Конфигурация TorChat" DSET_NET_TITLE = u"Сеть" DSET_NET_ACTIVE = u"активно" DSET_NET_INACTIVE = u"неактивно" DSET_NET_TOR_ADDRESS = u"Tor прокси адрес" DSET_NET_TOR_SOCKS = u"Socks порт" DSET_NET_TOR_CONTROL = u"Порт контроллера" DSET_NET_OWN_HOSTNAME = u"Собственный TorChat-ID" DSET_NET_LISTEN_INTERFACE = u"Интерфейс" DSET_NET_LISTEN_PORT = u"Порт" DSET_GUI_TITLE = u"Внешний вид" DSET_GUI_LANGUAGE = u"Язык" DSET_GUI_OPEN_MAIN_HIDDEN = u"Запускать со свернутым главным окном" DSET_GUI_OPEN_CHAT_HIDDEN = u"Не открывать автоматически новые окна" DSET_GUI_NOTIFICATION_POPUP = u"Всплывающие подсказки" DSET_GUI_NOTIFICATION_METHOD = u"Вид подсказок" DSET_GUI_FLASH_WINDOW = u"Мигать заголовком окна при получении нового сообщения" DSET_MISC_TITLE = u"Разное" DSET_MISC_TEMP_IN_DATA = u"Хранить временные файлы внутри папки с программой" DSET_MISC_TEMP_CUSTOM_DIR = u"Папка для временных файлов (оставьте пустой для папки по-умолчанию)" #notices in the chat window (those in square brackets) NOTICE_DELAYED_MSG_WAITING = u"отложенные сообщения ждут отправки" NOTICE_DELAYED_MSG_SENT = u"отложенные сообщения отправлены" NOTICE_DELAYED = u"отложено" #messagebox for offline messages MSG_OFFLINE_TITLE = u"TorChat: сообщения в очереди" MSG_OFFLINE_EMPTY = u"(больше) нет сообщений в очереди для %s" MSG_OFFLINE_QUEUED = u"сообщения в очереди для %s:\n\n%s" #buddy list mouse hover popup BPOP_BUDDY_IS_OFFLINE = u"Контакт не в сети" BPOP_CONNECTED_AWAITING_RETURN_CONN = u"Соединено, ожидаем взаимного соединения..." BPOP_CLIENT_SOFTWARE = u"Клиент: %s %s" #logging of conversations to file LOG_HEADER = u"Этот лог файл не подписан и не является неоспоримым доказательством" LOG_STARTED = u"Запись начата" LOG_STOPPED = u"Запись закончена" LOG_DELETED = u"Лог-файлы удалены" LOG_IS_ACTIVATED = u"Запись лог-файла включена:\n%s" LOG_IS_STOPPED_OLD_LOG_FOUND = u"Логгирование выключено, но старый лог-файл все еще существует:\n%s" #about box ABOUT_TITLE = u"О программе TorChat" ABOUT_TEXT = u"""TorChat %(version)s (svn: r%(svn)s) %(copyright)s Переводы: %(translators)s Среды запуска: Python: %(python)s wx: %(wx)s TorChat - свободное ПО: вы можете распространять его и/или \ изменять в соответствии с условиями лицензии GNU General Public \ License в том виде, в котором она опубликована Free Software Foundation, \ 3 версии или (на ваш выбор) любой другой последующей TorChat is distributed in the hope that it will be useful, \ but WITHOUT ANY WARRANTY; without even the implied \ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \ See the GNU General Public License for more details. * And now for something completely different: If you happen to run a software company near Hannover, Germany and \ are in need of a new coder, feel free to regard this little program \ as my application documents and drop me a mail with your answer. """ src/translations/lang_fr.py0000666000175000017500000002016711714662540015702 0ustar dererkdererk# -*- coding: UTF-8 -*- ############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # Translation file for TorChat # # # ############################################################################## LANGUAGE_CODE = u"fr" LANGUAGE_NAME = u"Français" LANGUAGE_NAME_ENGLISH = u"French" TRANSLATOR_NAMES = [u"vitisch", u"Pierre Abbat"] #buttons BTN_CANCEL = u"Annuler" BTN_OK = u"Ok" BTN_SAVE_AS = u"Save as..." BTN_CLOSE = u"Fermer" #status ST_AVAILABLE = u"Disponible" ST_AWAY = u"Absent" ST_EXTENDED_AWAY = u"Absent pour longtemps" ST_OFFLINE = u"Déconnecté" #TaskbarMenu MTB_SHOW_HIDE_TORCHAT = u"Montrer/Cacher TorChat" MTB_QUIT = u"Arrêtez" #popup menu MPOP_CHAT = u"Chat..." MPOP_SEND_FILE = u"Envoyer un fichier..." MPOP_EDIT_CONTACT = u"Rediger contact..." MPOP_DELETE_CONTACT = u"Supprimer contact..." MPOP_SHOW_OFFLINE_MESSAGES = u"Montrer les messages hors-ligne" MPOP_CLEAR_OFFLINE_MESSAGES = u"Effacer les messages hors-ligne" MPOP_ACTIVATE_LOG = u"Activer le fichier d'archivage" MPOP_STOP_LOG = u"Désactiver l'archivage" MPOP_DELETE_EXISTING_LOG = u"Supprimer le fichier d'archivage" MPOP_DELETE_AND_STOP_LOG = u"Cesser d'archiver et supprimer le fichier" MPOP_ADD_CONTACT = u"Ajouter un contact..." MPOP_ABOUT = u"À propos..." MPOP_ASK_AUTHOR = u"Demandez %s..." MPOP_SETTINGS = u"Paramètres..." MPOP_EDIT_MY_PROFILE = u"Modifier mon profil..." # #chat window popup menu CPOP_COPY = u"Copier" #confirm delete message box D_CONFIRM_DELETE_TITLE = u"Confirmez la supression" D_CONFIRM_DELETE_MESSAGE = u"Êtes-vous sûr de vouloir supprimer le contact?\n(%s %s)" #warning about log D_LOG_WARNING_TITLE = u"TorChat: Archivage est actif" D_LOG_WARNING_MESSAGE = u"L'archivage au fichier est activé!!\n\nFicher d'archivage: %s\n\nRappelez-vous de supprimer le ficher d'archivage si vous avez fini la correction parce que le ficher d'archivage peut contenir l'information sensible." # #warning about used port D_WARN_USED_PORT_TITLE = u"TorChat: Port déjà occupé" D_WARN_USED_PORT_MESSAGE = u"Quelque chose, probablement une autre instance de TorChat, écoute déjà à %s:%s. Vous devez créer un autre profil qui utilise des autres ports pour pouvoir commencer TorChat une autre fois." #warnig about unread messages D_WARN_UNREAD_TITLE = u"TorChat: Messages non lus" D_WARN_UNREAD_MESSAGE = u"Il y a des messages non lus.\nIls seront perdus pour toujours!\n\nVoulez-vous vraiment sortir maintenant?" #warning about offline buddy D_WARN_BUDDY_OFFLINE_TITLE = u"TorChat: Copain hors ligne" D_WARN_BUDDY_OFFLINE_MESSAGE = u"Cette opération n'est pas possible quand le copain est hors ligne" #warning about multiple files D_WARN_FILE_ONLY_ONE_TITLE = u"TorChat: Plusieurs fichiers" D_WARN_FILE_ONLY_ONE_MESSAGE = u"On ne peut pas transférer plusieurs fichiers en une seule opération. Commencez les transferts individualement ou envoyez un fichier zip ou tar" # #warning about file save error D_WARN_FILE_SAVE_ERROR_TITLE = u"TorChat: Erreur sauvant fichier" D_WARN_FILE_SAVE_ERROR_MESSAGE = u"Le fichier '%s' ne peut pas être créé.\n\n%s" # #warning about file already exists D_WARN_FILE_ALREADY_EXISTS_TITLE = u"TorChat: Fichier existe" D_WARN_FILE_ALREADY_EXISTS_MESSAGE = u"Le fichier '%s' existe déjà.\nSurécrire?" #dialog: add/edit contact DEC_TITLE_ADD = u"Ajouter un nouveau contact" DEC_TITLE_EDIT = u"Modifier le contact" DEC_TORCHAT_ID = u"TorChat ID" DEC_DISPLAY_NAME = u"Nom d'utilisateur" DEC_INTRODUCTION = u"Introduction" DEC_MSG_16_CHARACTERS = u"L'adresse doit avoir 16 caractères, pas %i." DEC_MSG_ONLY_ALPANUM = u"L'adresse doit seulement contenir des nombres et des lettres minuscule." DEC_MSG_ALREADY_ON_LIST = u"%s est déjà sur votre liste." # #dialog: edit my profile DEP_TITLE = u"Modifier mon profil" DEP_NAME = u"Nom" DEP_TEXT = u"Texte" # DEP_SET_AVATAR = u"Set Avatar" # DEP_REMOVE_AVATAR = u"Remove Avatar" DEP_AVATAR_SELECT_PNG = u"Sélectionner fichier .PNG pour votre avatar (agrandi ou réduit à 64*64, peut contenir transparence)" DEP_PNG_FILES = u"Fichiers PNG" DEP_ALL_FILES = u"Tous fichiers" DEP_WARN_TITLE = u"Sélection d'avatar impossible" DEP_WARN_IS_ALREADY = u"C'est déjá l'avatar actuel" DEP_WARN_MUST_BE_PNG = u"L'avatar doit être un fichier .png" #file transfer window DFT_FILE_OPEN_TITLE = u"Envoyer fichier à %s" DFT_FILE_SAVE_TITLE = u"Sauver fichier de %s" DFT_SEND = u"Envoyer %s\nà %s\n%04.1f%% (%i de %i octets)" DFT_RECEIVE = u"Recevoir %s\nde %s\n%04.1f%% (%i de %i octets)" DFT_WAITING = u"attendant connexion" DFT_STARTING = u"commençant transfert" DFT_ABORTED = u"transfert avorté" DFT_COMPLETE = u"transfert complet" DFT_ERROR = u"erreur" #settings dialaog DSET_TITLE = u"Configuration de TorChat" DSET_NET_TITLE = u"Réseau" DSET_NET_ACTIVE = u"actif" DSET_NET_INACTIVE = u"inactif" DSET_NET_TOR_ADDRESS = u"Adresse de procuration pour Tor" DSET_NET_TOR_SOCKS = u"Port de SOCKS" DSET_NET_TOR_CONTROL = u"Port de commande" DSET_NET_OWN_HOSTNAME = u"Mon TorChat ID" DSET_NET_LISTEN_INTERFACE = u"Interface d'écouter" DSET_NET_LISTEN_PORT = u"Port d'écouter" DSET_GUI_TITLE = u"Interface d'utilisateur" DSET_GUI_LANGUAGE = u"Langue" DSET_GUI_OPEN_MAIN_HIDDEN = u"Commencer avec fenêtre principale minimalisée" DSET_GUI_OPEN_CHAT_HIDDEN = u"Ne pas ouvrir automatiquement des nouvelles fenêtres" DSET_GUI_NOTIFICATION_POPUP = u"Notification surgissante" # DSET_GUI_NOTIFICATION_METHOD = u"Notification method" DSET_GUI_FLASH_WINDOW = u"Clignoter titre de fenêtre à un nouveau message" DSET_MISC_TITLE = u"Misc" DSET_MISC_TEMP_IN_DATA = u"Cacher fichiers temporaires dans le directoir de données" DSET_MISC_TEMP_CUSTOM_DIR = u"Directoire temporaire (laissez vide pour défaut de SE)" #notices in the chat window (those in square brackets) NOTICE_DELAYED_MSG_WAITING = u"messages retardés attendant pour être envoyé" NOTICE_DELAYED_MSG_SENT = u"messages retardés ont été envoyés" NOTICE_DELAYED = u"retardé" # #messagebox for offline messages MSG_OFFLINE_TITLE = u"TorChat: messages en queue" MSG_OFFLINE_EMPTY = u"pas de messages en queue pour %s" MSG_OFFLINE_QUEUED = u"messages en queue pour %s hors ligne:\n\n%s" # #buddy list mouse hover popup BPOP_BUDDY_IS_OFFLINE = u"Copain est hors ligne" BPOP_CONNECTED_AWAITING_RETURN_CONN = u"Connexion aller, attendant connexion retour..." BPOP_CLIENT_SOFTWARE = u"Client: %s %s" # #logging of conversations to file LOG_HEADER = u"Ce fichier d'archive n'es pas signé et n'a pas de cogence de preuve." LOG_STARTED = u"Commence à archiver" LOG_STOPPED = u"Cesse d'archiver" LOG_DELETED = u"Supprime les fichiers d'archive" LOG_IS_ACTIVATED = u"Active l'archive à fichier:\n%s" LOG_IS_STOPPED_OLD_LOG_FOUND = u"Désactive l'archive mais le fichier existe encore:\n%s" #about box ABOUT_TITLE = u"À propos de TorChat" ABOUT_TEXT = u"""TorChat %(version)s (svn: r%(svn)s) %(copyright)s Traductions: %(translators)s Environnement de marche: Python: %(python)s wx: %(wx)s TorChat est un logiciel libre: vous pouvez le redistribuer et/ou \ modifier sous les termes de la GNU General Public \ License publié par la Free Software Foundation, \ soit version 3 de la License, ou (à votre option) \ une version postérieure. TorChat est distribué en espérant qu'il soit utile, \ mais SANS AUCUNE GARANTIE; ni même la garantie \ implicite de MARCHANTABILITÉ or APTITUDE À PROPOS PARTICULIER. \ Voir la GNU General Public License pour plus de détails. * Et maintenant, une chose complètement différente: Si par chance vous gérez une compagnie de logiciel près de Hannover, Allemagne et \ avez besoin d'un codeur, sentez-vous libre de considérer ce petit programme \ comme mes documents d'application et m'envoyer un courriel avec votre réponse. """src/make_release_zip.py0000666000175000017500000001331311714662540015043 0ustar dererkdererk# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # !!! !!! # !!! THIS SCRIPT WILL DELETE THE BIN FOLDER !!! # !!! !!! # !!! and all its contents and then it will !!! # !!! create a new one from scratch. !!! # !!! You have been warned. !!! # !!! !!! # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # this is RUN ON WINDOWS and # needs some tools installed: # # python 2.7.x # wxpython 2.8 (the unicode version) # upx.exe (must be in the PATH) # pythonwin extensions (needed by pyinstaller) # pyinstaller latest trunk (in c:\pyinst\) # # also put a copy of tor.exe into src/Tor # # run make_windows_binary.py from within the src directory and # you should end up with the zip files in the ../release folder # and a fresh bin folder to test the newly created torchat.exe import version import os import sys import shutil import zlib import zipfile import glob # pyinstaller must have been configured aleady PYINSTALLER_PATH = "c:\\pyinst" # ---------------------------------------------------- # first some useful helpers to zip, copy, delete files # ---------------------------------------------------- class MyZip(zipfile.ZipFile): def add(self, pattern): for name in glob.glob(pattern): print "adding %s" % name self.write(name, name, zipfile.ZIP_DEFLATED) def unlink(patterns): """delete files. takes a list of names or patterns""" for pattern in patterns: print "trying to unlink %s" % pattern for name in glob.glob(pattern): try: os.unlink(name) print "unlinked %s" % name except: print "could not unlink %s" % name def copy(patterns): """copy files. takes a list of tuples of which the first element is a name or pattern and the second one is is the destination directory""" for pattern, dest_dir in patterns: print "trying to copy %s to %s" % (pattern, dest_dir) for name in glob.glob(pattern): try: shutil.copy(name, dest_dir) print "copied %s" % name except: print "could not copy %s" % name def zip(zipfile_name, patterns): """add files to the archive zipfile_name. Takes a list of filenames or wildcard patterns""" print "\nopening %s" % zipfile_name archive = MyZip(zipfile_name, "a") zlib.Z_DEFAULT_COMPRESSION = zlib.Z_BEST_COMPRESSION for pattern in patterns: archive.add(pattern) print "closing %s" % zipfile_name archive.close() def zipSrc(zipfile_name): zip(zipfile_name, [ "doc\\*", "src\\*.py", "src\\*.spec", "src\\*.bat", "src\\portable.txt", "src\\changelog.txt", "src\\LICENSE", "src\\translations\\*.txt", "src\\translations\\lang_*.py", "src\\translations\\insert_missing.py", "src\\translations\\__init__.py", "src\\SocksiPy\\*.py", "src\\SocksiPy\\BUGS", "src\\SocksiPy\\LICENSE", "src\\SocksiPy\\README", "src\\icons\\*.png", "src\\icons\\*.ico", "src\\Tor\\tor.sh", "src\\Tor\\torrc.txt" ]) def zipBin(zipfile_name): zip(zipfile_name, [ "bin\\*", "bin\\Tor\\*", "bin\\icons\\*" ]) def clean(folder): print "\ncleaning %s" % folder unlink([ "%s\\*.pyo" % folder, "%s\\*.pyc" % folder, "%s\\*.log" % folder, "%s\\*.tmp" % folder, "%s\\*~" % folder, "%s\\*offline*" % folder, "%s\\*incoming*" % folder, "%s\\DEADJOE" % folder ]) def cleanSrc(): clean(".") clean("translations") clean("SocksiPy") # ------------------ # and here it begins # ------------------ try: os.mkdir("..\\release") except: pass if not os.path.exists("Tor\\tor.exe"): print "!!! need a copy of tor.exe in the src\\Tor folder" sys.exit() # clean up the src directory cleanSrc() os.system("rmdir /S /Q dist") os.system("rmdir /S /Q build") # build the .exe with pyinstaller # the following will result in a command line like this:: # "c:\Python27\python.exe c:\pyinst\Build.py torchat_windows.spec" cmd = sys.executable \ + " " + os.path.join(PYINSTALLER_PATH, 'Build.py') \ + " torchat_windows.spec" print "\n\n" + cmd os.system(cmd) # check for success if not os.path.exists("dist\\torchat.exe"): print "!!! pyinstaller did not run properly" sys.exit() # now we have all files we need. We now put together # the contents of the bin folder exactly as it will be # in the final zip file. First make an empty bin folder. print "\n\nputting together the contents of the bin folder" os.system("rmdir /S /Q ..\\bin") os.system("mkdir ..\\bin") os.system("mkdir ..\\bin\\icons") os.system("mkdir ..\\bin\\Tor") #now copy the needed files to bin copy([ ("dist\\torchat.exe", "..\\bin"), ("portable.txt", "..\\bin"), ("Tor\\tor.exe", "..\\bin\\Tor"), ("Tor\\torrc.txt", "..\\bin\\Tor"), ("icons\\*.png", "..\\bin\\icons"), ("icons\\*.ico", "..\\bin\\icons"), ]) print "\n\ncreating the zip files" os.chdir("..") bin_zip_filename = "release\\torchat-windows-%s.zip" % version.VERSION src_zip_filename = "release\\torchat-source-%s.zip" % version.VERSION unlink([bin_zip_filename, src_zip_filename]) # torchat-windows-x.x.x.x.zip zipBin(bin_zip_filename) zipSrc(bin_zip_filename) # torchat-source-x.x.x.x.zip zipSrc(src_zip_filename) src/torchat_linux.spec0000666000175000017500000000110511714662540014725 0ustar dererkdererk# -*- mode: python -*- # this is the spec file for pyinstaller # which is used in make_debian_package.py # to freeze torchat.py into a one-file executable a = Analysis([os.path.join(HOMEPATH,'support/_mountzlib.py'), os.path.join(HOMEPATH,'support/useUnicode.py'), 'torchat.py'], pathex=['.']) pyz = PYZ(a.pure) exe = EXE( pyz, a.scripts, a.binaries, a.zipfiles, a.datas, name=os.path.join('dist', 'torchat'), debug=False, strip=True, upx=True, console=1 ) src/icons/0000755000175000017500000000000012074647461012305 5ustar dererkdererksrc/icons/event.png0000666000175000017500000000103511714662540014132 0ustar dererkdererkPNG  IHDRasBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8œj`LdfƑ:҈tV"C;F@\.D\JEsfa4V@2;&:J/yrNƉ`޹zqMey=Zq8em}8T狽gH-q89r,ۢ1K0 ( IӔh}ʲdRLQC%zG v?`vF$BKU\ʏ66&ibY6;[%hPUZ$Ix<˰l:!@QJܼqfg\p:UUEQlzZt:D*պO|'Ft_qG[^6ݣn|uޣLu&˲>gy1(%&IENDB`src/icons/offline.png0000666000175000017500000000144711714662540014442 0ustar dererkdererkPNG  IHDRasRGBbKGD pHYs  tIME 7yIDAT8˅[KTQ{s8EGz " lR/ HAA)CY~h] -:33gl{`Q ߂:R=wMk/\)ѩZV H&s3o`Do߿ӂ+Ձz^MY歮X#+Fp<1,vZ y^<cv`.ŘVtf Ps8 H$+[- Jkl{]zH$-u555':"r-| ۅǚ+e;Sӓ̑dnL_< jbt1 P%29?Zk|VݾsvsM)B.w ?!C DJOF"sa(@+Ҁe}BJ 0@)r PXYQ#)%qGF:ڽo{OuJ)ҕX cO&&q\.'LDb 9V fj^,VM" @@v m>HjMKZ8Mz}\R3NI1*1Bj!<=Ɩ?PWy\)EDAbx /Bɽ{~6UۺiIENDB`src/icons/online.png0000666000175000017500000000151111714662540014274 0ustar dererkdererkPNG  IHDRasBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8}oeع`.BP!(MJĂұ $6$*6@[.rC$%1&|{"Hy~z9*3îyL8ecx{2 Zr艳}䫂QDoi`͓-tnG'7h"{{\;p,<#9+5~gs" p\)A +mJ2پ6@zO`CΪ7F}\zhʍqqċ>Iz2:W:ayƾ +֪\Pouy}x7/x}Rj1W_hfPX(3E30S4rGO_2֯*_ Nw|V9{R/OI{RNb0>7"Hze.V/;NIbU)prx4EO8QW,EJO(        "##$%%&''''''''''''&%$$#"!    "$%'(*+-./122445556666666655543210/-,+*'&$#   "$&)+-/24689<=>@ABCDFFFFGHIIHHGGFFEEDCBA?=<;97531.,*(%#   "%),0269<=@BEGIJLNPPQSTUVVWWWXXXXXXWWWVUTSRQPNMKJHFDA?=:752.+($!  #(,048<@CFILNPSUVY[[]^_`abbcdeeeeeeeeeeeddcba`__]\ZYXVTRPMJHEB?;73/,'"  &,27<AEILPSVXZ\^`bdfghijklmnnopppqqqqqqqqpoonnmlkjihgfeca`^[YWUROKGC?;60*%  #+3:AGKPTXZ]`bdfhjkmopprsstuvwwwxxyyyzzzzyyxxwwvvutssrqoonljigeca_\YVSOKF@92*"  $-8AIOUZ]adfiklopqstvwwxyzz{|||}}}~~~~~~~}}}|||{zyyxwwutsrpomkjgec`]XTNG@6,#   +7BLU[aehknorstvwxyz{||}}~~~  '''---222555888::9;;9<<:==;==<<<;786,.+01/00/**)%%$ ~}}}||{zxxwvusrpnljgc`YSKA5)  $0=HS\cilpqtuwxyz{|}}~!')%HIFfga~~zđϟ٪ᴴ꺺񾿻ľ𥩢饧ׅ{{xeecEED***$#$~}|{{zyxwutspnkga[RG;." %2>JU^fknrtwwyz{|}~--,[_UpxcĆyף軿ƼȼɿȽĹƽ曙Ԁ[[[(((~}||{zywvusqmid]SI<0#  $0<HS[bhkpqtvwyz{| ??;suoӴǿŹȻʻ̽̾ʺɼ蕕qqp673 ~|{zywvtrpmjg`ZPF;-"   +7ALSZ`dhknprtvz~()%jlcӶƺ̺˼ȿ슏p`dL!!}zvuspnlifc_YRI?4( %-7@HOTZ_afgknxGJDaj\m}d甡ǷȶλɼpxonmR:;, vmkifd_\XSLF>5+"  $,3:AGMQVZ]n&/DRuySspMLL175 6172"C  &&%#yzt^xmTcGzħǯʷyVlYv{ǮʯǿƾObFK]Bokew_yynmhbbx^m}qWh\l}ltcqR~j]cIekFiiGTS=94!8.7,4.Q  %%$'qsmkzWlK|nɺηĠȧĥȸɽzwxvnng|gɯȯŵȾ9L76K2dw]j}flmxzomxplYnRduc_o`dyfzz̼ǻewVGW7ZiJmmvaOX7_`A_]CG@(D8!?19/5) ]  01/)uyruryhjZUlFϾ{zhxfL\J&A+PjSġåȸĹźĴ}EWG4I8/C0^q^~|tmMcF8M3J\Gvzns~|ql~^\kN\jO\mRarVwFP2SU8VT8HC(F=%A5A6!<.8( e "  HHF+{~sgzWuat]mrŲǰ͹¯{y4K8!5&';/N_Qǵ˿ó`ph@SJMbTvxivyoThKSgMooYk\j|gocw{nhatXwj|lU]AKO3[]@OP4??#A>"UP6ME.<26+(l$  JJF)ڇ|fxXi}Volu;¥[sXHeL:&iylʻ˵ʴǴİë~wsnrwdp_h}T|f~q|c>P6\oVRfPUkXCXCyq~pdz̾\qSDU3RZ;\`ELT9eoOZcBEL,SX9mpSbcHA?&>7";/+o "  @A9#~wi\nJ`uNuanlyd{k|̺θ}PiRvnvn}v[u\ŲɼŹrfRjIKcA[oNn{]ny\DU7YkNK]C8G5AP>RaJZlTAT;bqTujXgMAL0U[?hnP_iJZdEIQ5T[?fmQNU:JL2?=&?8$;.6&. m    swހvauQavOr`n]WiFbsRO_BET;ȴ{yʾȲǼǸȼedkhz±ǻxvTmP`wXtgykReFTkJZqSkzg7C3@K8amVix_\lTtkblUAG/IN5KT8\iJerQcmL_iOT^Gpz`OZ=IU6GK/?;$6.6)=-@1!(!f ipWmwݓ{qxg\mIFV5qbZoNYnMskRiMupøfk¸yumktkf^`_x`ReR:I7M[AJW>]kZcnbDL:01:7 DG-P[>gvVbpOyҶkx_6B(Q\=PZ;HN49;'55%HE5SNbuVLbCCX9Ͽǯqb=Q6k{jͺ}öøʻ³ȴih\y_TnQth~w`q^qtjTpO]w[;R6@R:O[EVaI2>)ZgX]h\=D3>A*IJ3@C+?F+q|ao}_kwVA(mnQor\<  LS;*wXaqTi|VyuratWasRuiawe/C1|yIWAq|e{`pWxsùĺĺƹz}rveljtr~mvxgqgkLgQMdQexfih[sV^qSS`H-9(EQ@q~lyy9K7@H0rϰԺȧڳ~p{q~c3=)5<&[bD沲xxr$ jqSltMjuKoXe\ssjk~bxZPgJqmqt~÷jyf>M6jta~|as^ƶ¿ƽqƾDfL2O>>XKnwnuB[I/C5;L?QhTXsZOgNCWA:N8BVB;N=GVF8D0JR8CJ.[jMI]Ady_`qY4?(;C,mu_|XlS_jPřǦwhzUTeFM_@crRŶܟr V[I\r|\yaarJk~Wg|Zg`mj}zwWqU?Z?RkSƽMYFHUA[fTyyŷľSqcc~iPmT9S<7L8K\Kat`d{b^vYbz\f}``x`RkY_uXx{k~fPhKKbEriizf:J3?L55=&CH2BH0GP5CN3VdHre~}NbLDVAP]HclRǰǽĽFM:)cjXgqZAK0V_B`jM[gIXjI\nN`qSZmPKcHJfMjmsut~gQXC:A,HO;FO=1<-*5(O^O~~|z~}pf\pTZnXauam}iŶ>SKS9CS7]oT_rYRfOXmW|}orBL<08$25%44$=?-HO>ƶiiqqĿ̷brPHM8@   $#1fj\P^BR[AbmSaqW}~RiVsyJUG%-"'10$52$=?/U]LDM<,2!27'4>-EXDJfNtwøɼpqOdOGYDES>GQ=8@,?D/GL6HQ8BS8MaE~vps6L7NcIȶ̸YsTMeJPcQmzmuu\iFy_KN?  ,*hBF7|xƼRkXd|jan`&/"%*"%89+68)5;,bl^WbR/7&5;*4=*5F/VlSȴyeype}bxq{DWC>M;8C239*=?/8:(:=)@A-EJ4P]Ak{_jmOiRMhLhd̦ɳ|ndw\IYEIUD_iUyi¦m[N[;pwYڈsS  +* ;BC25<.XaU{Ƹ_uedn'.!#%'%%&JO>>,?@/AD/S]@wggdxr[tYxxǪӿʱ~jp_]oR9I2?G4dgRŬP]?LV:\aDkGK<(  bdQopvfIQDai[kp_IP>^dUnsfqwUlaIcWPf[fxkosip[bY #*&)"53$diSCK8-5$u~nbp_?M<9H4K\A}OiT.G49O?4G9#7+=TIyyhzegqQLW:FK945(,,/.9;'>A+@F-OX=sxptjYo[jrZO^:FT4UcD]iJSX=HH/vCH.ZZBGD)z{\ݛZ()# *(UGyƯf\hM9B,<@+IL3KR4YbDvukriuk{Wu[xr~t_i}Sr\^pKEQ4EJ/OO3IE,>:#prY?E)JH0A; ~z^LLF*  :3"kMG6^[GacJOR;;>+>B2PVELQ@PVCMU@ZfRxv~vvi~mtVbV"*()'1(7+ 0&,(,,:>(blPl{^jz_uuVt\MkU]y`}LfRMcHcvUN`F5E3+:-+=.OeP¶ºpjYlOvuaMW6!on[AH/96$LH+[ڪU3326E<%QI0WT8_aEpɴ]kXNbPksw}-5*)(+$+#5(9)/"-%2.VW>krSlyWapO]pLrcwspvSy]]{c[{Wd`NeM7F3>N5=M71A0/@04H3SlP`|UOlBxeu~[V]C89#0/26&5<-FK:S\HWjT`v[gy[ì|LeF˲\nTJJ3VM6L@+B9%v66!6- LE,bcB999&"WD:!E:!idHqyȺ˸LTEEQCg}lykwWk[DN>43&0&6'6)1%/!7(@8)KK4U[;]gB]iD\kChzNn]um¯LeD9N2;L58I42C/:K8[mV~w˷shAV5arUhqW@C(>@$SU>EE4('&(JWAjcj|ZsmM\I>:'>.=.B=(rv{a=3 ?4"C>&bbI==+G;'G;)9-3&6(3, 43 AE*QV:UZ@W]@[dDS_ASeHXmRfhjq(;*,:),:+1E6RjOsµ¼mu3J57C*BE,EF.B@,40!($-(89&IW>1F;$A=$liiZH@6 WJ0yWcWS4fcAm~uP_J4<*9A0m{hwbf|ZfGI,HG1F?(L?+D3 @1 7/74BC(PV7T[=HO69@*2:%6=);D/FQ;UeOCZD?XB>XA4N6+E+WsVȷ˼ZnZS[HjjlNHH-ED,FD074 1.@D+OT7XX8jtPduPeuSl_XmO^vXuowHM@@1#F4"@2K@%e]?c[?;,;0F?(WT=665(LE1q;.B2RE+kbGUR3Z^;f;B6/:(WcQĢtjzZ_jM~PN992 B6&=1 =0G;&PG0JC-?='DG0MU>LYAGV@CN;:?-8<*4>*.:',FB1;6!<5JD,UU;[^CWX&`U8jaFND.=*<0WQ=ýehM^[A@5"Z  II6-`X=B1J7!N@'^T:ojOknRrLPCPSJQWK;B57@1{qku_nz[s|_rw]BC-:7#A9%<4:1:1=4#<4#3/DF4go\|HP@5<,3>.K^L>VBJ]K|{ź{|`~ZLe>m_MW@1.0(0';/F<%GC*XZ?chJ]cEmuakvYW`F/EJ2)4(8)?/F:$IE,MO5HN4R[@vlbqVOZDUYDBF2|qʻp{lC@0@0!F1 M7$N7!M6N6!J/D)=*TK*95 9:(hoaϻϻl|YP^;\hGmvVkkK\Y>D=':0!;.#:/%5-!0*/+.. -7(>OBaph~˽Ƚ@ZG7O9J^GI\CGZ<_oPVbD\dJKK4:4 2%2#6&B0J;%JC)HG.BE.;C-DO7PY@SY@XaHZaKYYFVYF|TSG=,C*L5!T>&T:"N3J/G,D+A2}8/#B1M6"J/0W53!SM/h]>iY=M; G8I?&]Y@poUUT8=>)u|mžxxcGK2AA,1/.)/),*./"7:-8=/6G=*:-7'B8'\UBPG2RI3ZV=\]C[]CJO6OW>]aLNN9@>'MH2;7#abOpxgORD<0#B(J,L2P7U6T5P6K4 B/kbHYRK7'F3Q;#N3>" ><';c\9wlHxjIWJ,K>#G:!PE,\W=rrW|ʿõϽ|QUA:=*gjXfgVghW`dTekYu|i}t|o{[qdmqƾ~j{`vAA.0'B3!C4#A1!>.NB1f_LMF1E?*MJ4WU>_]E\ZBmmVjhSXS>RG0WN6IF.qs^w{gPI9?-F)M+N/N0U5aD,_G0H4B2{B2+>%B*Q9"O4B$.84"WpiIwnJgZ9YL.TI,j`?riFZW7uȹϹǶhlYRUByrx|ſĽr{aiYya-I77R?]w_^ue@WECVB[jWhucxqoxfPVCW]Jrxfno]E<+:+3$7&>+@*F1"K7'G5"G8#QG.UK2N@,M>+TE2M?+N?+XF.WJ0\U=b\FaVCN<,D+J*Q.P0U>&gT:lW>[D.@/TH5žQNDB&H'D$Q1M.A"E82"svoQwnN\N/WG,neGo_^`<ʼz~ilp_ghWbbORO>PM-69'38#9@+AE3>;-71$86'EH5LK7B5#?.5%9$>$B$C$>"H.O7!WD)U@'H-F*A&?%H.T;$P:"Q>'G2@'?$F(U3 U6!T?)d[ClfNZJ3K5 WI6v<- D$M(J#L$H#@ [ E:%eX;l^@[K.ZL0d~{yTlnOu}yWbQ\hU`mUZhLalNehKWS;PH3@7$80?1#A4%8,6+82!CG0`fP\dU;RL1Z[XpNrdHiRKhMOiLwoXgSO^KRbKAL6MP=38%;A-PV@>>,;6&=6&<5&:1"9+@0"LB.\X?b[D<-:&;'C)D&H%I&H(H)G)F)J+R/X4"R0J*P2aC-W8"K-I*I(F&N.X8]E*j_EhfPLG4@3aQ>A3'D-H0K+I&O*K%A *w  9/#QB%YJ,j\@cW:\S5{xWd}_qjmKv}Vs{XksWwhfpZR\GU\INS>RT?[\DPO7GC+J>*SA1H8(A2#G5(D4&?2#@4%B9*JD4>B01C67\XDw}fd{XuaH^F@O6^lPjw[T`Jxo|p6<';5'<8(FC0hfQEB.:3#<2#?2#A2#A/!E1!M>(WM3`T85)?'hT4qeDL7E.]@)S1A A"&6.:YO3aY=upUzuZ]V9NI+hiKxrtpHz|RilKDG.qv`mtYjtrpU\X=YQ8OF.L@*K:(J5%F1#C/"C0$C1%A4%F<,IC2CD2ANH/CO5^hPtLQ?99(C=+B=+GC0VS?B<)B5&C3$C2#F3%H3%H2"J7$Q@+XE0S<+M5#N6$U=+J/F'C%F,L3!J1F*G&K)S2!W9'Q1 J(K(Q+S)Q'Q)O.V<&eP5dS7M;$?-[M9]^O4&J3f}aR6G4X=&R0C E#*.LF7O{fwu\_\@WO3PC'I<#`Y>uqTunP^R3aV8UL5XP?spmXe\CXJ2L=(F6%C3%G5&O:(Q<*J4&H0$G0&C/'C3)B9*ID3LK8KSCizohE{0rveXdWv1NE8J;KWBP\B[gKckPOT;;=)DA.KC.LD/MD0MB/E9&H6'H3%F/!F.!J1#L4$M4$P6&K1!M2!R4#W9)kUB^H6N2 H-^I3wfPo]GW>(H+S8&kTC^G5E)L)L*Q,U+S-P/M5!p^Gl\CG8!I;(wjYν`\J7+M;#cV/_uYN6L,O)G!C!& @a]QbpԔ}hfZ;bN/`L/XH,fX=gV=Q8!R6M2Q6'J1"F2 K5%M5'L4&M4&N6'N7'N8&K6%H3%K5(Q;0J<.G=-A>*QS<{ltw#S`/dpPj`]w9VKDYKaq\grV]bG=?*AA.IH2HH0IH2RL7MB/I:(J9(I6'G3%D. D,J0"O3$N2!M0!H,F)N,P/H,T8'V4%Q2 bL8gU@\H4S9%P1U8'[C1R8'N0 N*O+R,Q*I*L6#l]Gm_KN?.?2unSȶSS:>2E0ylJYtlAuhLL1P,P)F#?!"P7,tZM:ދuyfS"P,R)L%N,T9 1"^. I/H4!H5"N4R1Q.O1O5bB,iC,aD(U9[>$Y;%Z<+Y:+X:+V:,U;,S;,N9+H8)G7)M=/M>/M>/NB2MG4FH68K?X2u(f/euiiwPsnHia?[Q8OD:I>AF7JH3NJ4RQ8[bFζ|RI4M>+L9'P<)Q;+Q8(X@+cM2`I/Q8$P4%N0 U8"P0Q0!R/ T-V-T. O,L*M+N,O,P,P+T.[3!f;)Z4U4bH2wcP[L:>6"}{hu|ZOB%L>!aV1]yQOCkV5bE)Q.W.R)K%J(cH,E8'k9+I3=)F7aQ5cM1L2N>"ZS2XL/J0V: aF+W<$T8!Z=*Y;/T9/H7+D;*JB0RJ7[WB_ZFIA/H<-K?2D@2DD46?0k{sol<5~BU`^GzvjW~y6UP)E>3HA8G=?F7HG3NL8UY?\hJq]`FQL5QG3UG3YH2U@.S<+YB-_H0cK3cJ5X=+Q3"]>(c@-d@0]8'V0W/X1!X3"[6$^9'Y7%U5"\;&fC,hC-b9&e;(^:$_A-vbM[L9@3"sj[plV`Q7ZF-UA(hZ<̣mQC%W="V1M&R(P'I#D" Y<#>0"v?6*O?-[M6vpTmeIO;#WD,hvwYbZI\I1YB)Y?&]A+eH3^C2WF4ws]sxwXu{~ipq^PSABG5IG6FSFyLt}EwSIAEPteM}}=`X2SI@XNAODDK=MN=TT?Y]CalNl[^@[Y@VP8WL6WG3VD/T@,S<+R8*T8*[>.]B/U<)T7$]9'_:+X5&W4%S0!R0"V3"b=)i@,kB/kH4nO9uV>uR<_<)X5#X4$S3$W4&Z9)W<*^L7wRJ4D/J/^H0x[yr{_TB&S4R+K#M#K#U0O.G*) *&OG1wYVB?2g]Bɺ[V:MB(XH0^I3^N7bY@jȫ˻xZzofrN4fr;tSPASc_L|?e\OsiSnd=PDBN?LR?TVAZ\B^eGejK_^B_Z@XN6VG2VC/WA-W>,W<,V9+U7)Z?.iR>kWCW?+Y:(Z8(W6'V4$S1"U4$Y6$b;)g=*i@-fB.bC.dD1_?-Q5#M5$WA2cN;dJ6oO;]A,YC,rlhPcS;M0!D&\I0ac[>i`D[j]:ZE(J(L!O M#\9#U:"H2(HH5efK|}QO<@8!\V:vǹxkeMWSZM8VG5WE4XB0Y@/X>.Y<-X;,X>.bJ;eN=W<,X9+_=.dB2];+W6&V7'T9(W<,Y9([7&Z7&W8&U9)ZC5pbRxin[DgK:Y>+U@*~ziXO>cP;eK4P1L/r^DbH8`N/TwPgI-T,V'Q"J! M-N4J4)TUCq|np]LJ3OI-[V8ecHԵǣxrhѲpK>t7l~5k:r>zBILFCKKz}?eg9[Y;_ZLsk?g^Z~vYwm>VL;MAK\J_nVblT^bH`_EbaE^\C[T=ZN:[J9\G8[E4ZC2Y@0Z@/Z>.V<.X=0[>1Y:-Y:-\<.cF4`G4cN;iVCbWExm]iXHZC1dM:{hWzouvrgZjUCaG3cF5YB/cU@sgaLVE/fK5oP8dC*X8bJ.m[>P;ZA#pV0lN/W1S(T(O$O.]G2O<'A)& WXEmo^IG1VQ4`]:YV7^[DpìǤvir|ռԺ`G~?sx:n};o>uB|CBIKD|@vxU=lI/[9T8iQ3w_AW:\9T.M#N#R'Q%T1ZC.K3B!' Y[G}rWYCkjIniEWM0F8$D8)YSCjhMrnOleEukNzjQxlSz_`nԴڶЯ^sOEvBpxAq~DwJLHFHKHIN=mu?eh=_]:\W>_[=YTC\SRl_TpaJeULcSPeSRaL^cL^_F\\C^ZC_TA_N=aM=`L;_I8^G8\D7ZG:XPCSUIQRHQK@XG9W=-Y>/aK:q`OsfTeUD]H7\C3_C4cE6eG7dF6_A2X;,[=.bD4gK6z`Dz[uXm|oXt^GtT=yS=vO9kD-`8\:tZ=|`CQ.X0e<#T(T%Y)T&S,Q1G(C 'Y\JuzfuzY^^/[A2W?/Y>.[>.]?/a@1d@3d@1d@/dA/bB/dF4jN;~lOvgoY?x^|bv\DmJ5rJ5sK6oF0b9"^@&lP}cIN)T.jD'^4^0\,S)S1[>%V:"H+$NRD򴶳u~d^fL[[FPD2I7#G3N1N2!^H8gQAjSBkRAgQ@_O?c[KecT^_NjnYt|f\bPhvhU|xIsqFruP}PI{CyLOOQSjgEy>fjBefAeaCd_D`ZH`WHaV\yi}v{Tk^PaV\fS^aHa`GfbJe[Fj]IeUBcO=fKZNBV[QTeaNhgIc_M_UgjYdWEhO@dG8cD4bE6hJ:mM;oN?lL>fF9dD7hI:mN>pR?w^FtYybr]IqT?qU?nUwaMkQ?kL9zXA^FwR:_;%X8kO5eE,W1Y1U.]6_8Y2Q*F$V?%dT3Q>$! rKMD}㯯·]gUKR>WUA]Q?lVFrZHqXGlTEiSCgTChWGfYJ`TG[XK`ukm]mM}}jpp_fkpdh\W{rQmdMe]Me]Mg^Wrejte|j]kWhjSgeNfgPggNolS|x`nfPhWBiQAbM@]UH[bXVidQjiKfaVg]y}mlbPePAeJ;fH:gL=qUEsSDlN?dI:bJ"eG*Y9V0Z2X1S-P)U/Q,C#U@'aS4O?%4)fcc\mۯzpwr}jidSo`N{iSraMjXHkWGnXHmYJjZLdWKaaUlp^mVx_hǿstSy~\~OsjMkdNhaPhaPg`Pf]XmagzjnyekjUlgRllUy{]o~vt^h^IiTCdPBaYN^f\YldWnjQjf^pgmVH;dL>pSEmUEkTDiRBfSAaTBneU|mxfvmWw`q^JpRCnPAlVuZtYqYqYAlUeNvT>uN:xS=sS8hK,iO/R5W4X4T1Q.P.P/K-G1UG.RH-@4WODY]]T[Ѥwyguuclws`h_Pi[Kq`NoaOh\Lc[Mbh[odMpiFnl]xbR}|^|ʺϾȻdqzǸdYuX|r[ypZqiUg^Xi^^m`fn\jiVmhTkiQknzs\tbNlXIdYM`dXaqg^voVplZpgWPBiSGw\OkSFgWF}s]or~rzlwi\gPD|iUnwgSrTDsQ?xVBvT@uQ=vR>yXBvX>v[={cEM1V5S5aE(Z?#]E+^G.M7_N5fYAI=&8*YPEJ-,!GQQCrsh}|bjI`gQnmgUiaQnhWsp^mlZq{l_IkaU|tV{tRwoQunPtm]yĴlXyiuhbyWocWi]csden\ggSrmYnkTmkVrq\uv`xw_h}oYn^LeUGa[OeoeczsZspSi_wpb`MjWIjRGhUJ~pι{zi`ZMaXJ{pqf[thX|ѽzwhdQAwUB~XB|XA|YBbKcKx[CoR:cI-^E(N2W7\<qY9n[;h[9,;7,:9+WZCx_{ruTA<"74bbHqs^sccUvthrjvi~RwmvaZxnawfjumxȼ̾ŹyfSnb]sc{xwo\bPhjXop[ljUhbOlbOrhUukXueUp]OhWKc[PdmaeypZpjOe]TfWjgVHhTGzq_xvydjlXhjWmkYsiWscRq_N~m]qok^pSFwS@]IzXD{YD`K}\GwVBnO:`C+eI/W9Q.Q-M.S:!YG-_P7H6#G5#@0:*7)VND'41$94"-%/$5&9,A<(ON;MM:61?2G6E8!|xcqv`tǴѸnl`b\Pyyczrnk[|rYxl]~qw~~Y~s\wj[zn_~lmq{wksapu_yyenlXmfRpgUlaPk]Nj]ObYLhj\~zWqiQe`ZibcbQlcTnhVghp±ĵwi\IlZGs`OqaOpjcZw\RzZLz]I|_JaL|_Jz]H|`KoU@YA(\F*cH-P/O,I)Q3F+<# A*I5!E4 =/;1YUIIJBij]HF76/G>(LE,@<$[YC}dRJ.TE'ZL.ogPpo_rq_keWxwd^~sutnb{U|p]v|{giwdlz|tofq]rxdus`qjZofUnbRpaRl_Rb]Qvpi|Wmh\khzϽ~ovxtjXs]M{bSt^NxhVvkYufVl[iTfQhScP}_L}_LfPwfLldEwuUYQ4Q?$D+F*B&I)M*F&@&<*:1[XKj}}|GJBh؎caVOK:d^ITN5[U<}~bkkK¢jmmZq{|lñ°wdu{ɽwkys|y}~tqjuarubro^mgVmdSvgYwj]kh[~s\wn`rm̸ɱuvsa}ulYxdS|dTr[KrZJ{aQkY~fRlWnXkVfRbOeQlWmSrS_\Q4]M3^P7RG.ZL5M5 G(A"@(=-94\[OSLOGLotjw{skkaDB2EA,OE.G:#ibKmrWfoRȪغ|orc}qv}pxq{ysnɽҿʻ~vzvyomq|ijm[ihUmhVuk[uk^hhZ{{`sjzvydtsd˿yyxgzsbtjYxjYp_q[KuZKwZKx]Kz_LgRlXkVhTjWiVkVzeMfQ6\K1RG.ulqG;%;'<&B1>3<7"^^S<ch^.`fXPRH?=394";0@/B0TJ8]\I?:(dcF~kqqaxxiqmlpwteonav|pyɹϿx}|~tug}i}yujk\qp_xtdzvgopbuqgrwqquaxzz|hsm\wqanp|iiWy^N{`OhUiTmVoZs_mYjVjWnZydMY?&H1]Q9ghVMP<[\F]W?F9"<->1>5!=8%^]S$_dXW]Lnpghh_GD1:1A2N<(L?-G?,A1 C9hɨk|ze~imjzgzvfssd|uоɽyt~qstivuiyyju|ysxtxp|}{j{tdw|gxezdTx`Qn]o\jUkVr_t`p[p\uaxeNT@&H7OC+bXCJA.oq^eoYms[QM6>4<3=8$;9&n\\R qsnUXL`cf[}wko]MH1=0F4E4 D6"D5 B9buqto~k}}lvwgxqϿǽǻŷƹ¹{˸μtzpqsgy}nyryo{|nywhvl_rcyoxot_QhZiZeUgUucs`o\ubt`wgPlaHd]FD:$F4!J7$~zb`lOtW[F830*;7$UTHKrrnWTJ>@>.TVF_`NOI48+A/R?)PA*D5 E?#evqrol{}kuxjϽo~~ķ~ƹĴqzo|u}}{xitl`rg\wh\~n^ucmrxwxzgXeVfXfXhWo]n[sa{h{fitor]ID/ZJ4I5!VK0[\<{fQWB97#1.87#bbZ0WSG6/92@8%?4:+B1VG.UK0D6IB%qs{yl|xmzyjy{j}rz}˾´îκ¸ƾƴʰwyytn|k}qdyl`tfra|iYqcxjxjue|jtan\lZjXmZp]tawe|jrtheiQQK3_N5K9!?1PI.SQ8GI2@B*<>'>B,xdf\ig_HB0`9.:+;+?/H;!VK0OE)C3LC&fzwzzlsv~v~̷dz̶˷ļħ¦ñҿv~nu}mzjrctf|mvfm^|mtq`tbr`wdmxds^jnnzizii{uVhiGddEN@&S:#UB(J<%A8"A>&XY>PV;HN4V\JKrtn\WM99.<+<+@4VN4^U:E9@1RH-a^?RW=ryhw~qǮɵɺŸȴ̹ò͹ʺ;©Ͼҽ˳wwuzlseug{m{nqdpcw}|jp{ir`txy}s}l~k{nXf\>qmHqmIRC'M5 S?(N?*=3!JH1x{afmR]dKrul+if_I?.<,;,>5TP7QJ0B7A6XR7VU5OQ5fjW~v~̿ķɷƴIJŲĭиѽƷ~vrwkth{o{othnatgusziust^ou~mm~uZmeEunLibA`V;B5 >+>-2)@>)su]mrYszgj}yb]UF'RE1G9%;&4","?>)_dJioVy{s2b^W&:1 8/C<'YW?D@'D=#@9$GE-KN1ZaHƹȸȱ¼÷~wxwysrxosksixk~p}oxjxjq{sqwersqsynvtXacCHD+A5#D2!I5 I5<.2+``O|pku`wzsdb[ =7'T81B=(ZW@ML5ikVjkZ;?,18"SYK}wu~ù~yzym|o}n{l{l{mzl}ptvpzlykzjzi{jvlifLTP6G@*=4!;0M@'PE,D<$fcPak^?quphd^)=5#<8#UT>orayEQ=?J;ƿ¼ùzǼ|xxƽtvztqstxkzl{n{nxk|msyutmYTM5@:"EA-^ZI@8%I?)gdK88"stdcbZ 52S75"FF2lmWinTFUA~}ETD»r{µĻp~Ϲ̶źļ¶l|ƽzrvwzmykykymzn{mztZ[DQT5qvS{eafQ==)73bcHIM3IO:ajWkrc>{}ydd]%42:7$9:#9@$@N5bp\p|kDRAyxź´°r}ȿŽnyξvstxs~q~±wemW9>)14FK0}mYePXcNwzuklf @C.HHI5LO:T\FNW>OW@>G3BM:IUDaqc|Ƶ;IJ̳ƽ½yɻοòƶſyzw||yx|Ȳνvr}gajTu{i^j]3=,4pro||{hjbFK7?E1>F3?G-AH.9A)4='8C.;H6[kXǵ˺Ⱥ¸|wxw|wvϿпø|yM_JFS@LVDozd}]i[slok||{eg_207"CJ6djUM=8?,?F1ZcI[fNuxs~~opm*0c>D2quijtaAO8ZiUxwJXI=N<ľƾ¼úƹ˽ƹpw9G6JQ=@J2>D,PWBQ}}|yzxX[S"/4%OWIp}gZkOdx_qs~g~kToWtu³ҼĮ˽ʾjymXeUen[EP:14#npi~~{{zVYR52;*S`JYjP^tX`y_ltpylsgmxεǰľúļƹɽrsw{Yf[OZL:A3\]W)z{z*1"[5>/:G6EW@SjNbepvbgGhLC`KqyǺн̵ԽǿſľȹɼɹʹĻ}V`Y7?536*10$O|}|NQJ(.$}'/#1=-7G3McLb{`ToS9Q9,B0J^Tʳ|t}[j_CNC*0$&&3/"oSPIJNH)*2&*3&*4'4B1AR=J\EDV@2C2->2L]TðѽϷ׾ĭǾǾŽȾ~}wt~gwn}JVK*2$''(#3,SOH#JOH9-4)(0$)2&*5'/=,;I8:H8,:,,;.EQGq{tʝȴŭ÷źzjk[Z\J]aOwqn~nFRB+,'!)!2*TPH1JOJF,4,&/%%0$$4')9,-:/,7-,8-7A8S\Tw{̺ʶҾǴȵŵʷĶto`C=+4+@;(HJ6=@0*)&* 2+UQI;;GAO$3(%5(#7+%9.'8.(8.*;0/=2:E;WbY{~Ǻ÷ǼͿ;vQM95*:+=6!>9%6,1$1$0%LG=BGWQ.B8T+A5)A5$=1#:.&;/(<1):0,:/;I=Zf[Ǿûɾö˺~sYWBD?(5.F>(YU@C=)/$. 0$2)FQMDM\[1JFS.JE.KE,F?)?7(<3&;1&;0.B58K>]h_Ǻöƾʿ{lbZFE=%ZR<>8"F@*B:(1%-2$5*DVQHWll7[YK/TQ,NJ(HC#C=#B:%B9-H=,D98I=Xf[õƹƸ̿ʼĶyiaVBC:#2(2(3)7.1&*.1%nvGv{?lo3ce2ae@fkYtxvyxsb_ZHG?-3(4*4,8/ + .!) U]WQzyx{~q}}l}~@Py{Ly}IzOQDy9r}:r~Cr}Pt}g}yob]TFG@0;7$:3!2(*!*$2.A<,b^Y3d_[zyy|j|}.NwzqGv}Mz~TSE{;w:t:lyEo{\oſ~uihZLN?0=0 1)-(2+0'0&;6&LL>glke%~~~}i{|ey|AItwIvxKy~Gz;w6r5n{8o|AuNbw}yplbVUG9D2#7&3%3+6273 .(83#gf^~FANfz{qoi]WQMD:>2&4%.--* *+#??0e[\R.ZZSRbgC[g75_on+^r(Yr"Ur#\x6pG<}5{BO[cmxkausN_]9B>() &(&&() 9,#gIC:1][U `tx Kmw/Gjxa3_tWr)bx;s:u-n.n/r6y?|=pJv]jrzsbPw{LuyLuzClp7[Z$:6%0)'/'#&62+B:3ZC92(a\Xdu{?gvI7eu|+bt-dv/gz0j~0m0n.k}']s0by8i}ArM{Zadgr{~{ysumw|t}wk|{hY~MotBjn;kp=jr9cl8ej5\_6WWF^[uBQMClpnjvz:al7_kN:es|1et3lx1ky/fu,^n;jx=n|4hu2er2cn+Wa!FL$CB=UOO^V6@7 "* 0B97TO$EE8MOjstp\{|Yx{b|~_z}Fms*[e-Ze-S`7Wav;[aHIgkv{|8cn lv_:fs:co5bm6ft/^l*Va/V^6Y^-MN84(6-)/$*0%&",!)91(A<%CDDG6WZ[pqbzzRtvCio@goEkt<+.(CI(JQ.S[=^dFejx@dkZ0\e8Gel??????????????????(0` %   !%(*,----,*($!  (19@GLPSVXZ[ZZXVSOKF?80' 3COX_dimprtuvwwvutqolhd^WNB3 6Tdnswz|~)*'RROgffrrpuvsturdgcYZVEEC }{xvrmcS58Ufpuy NPKҬ¹˾ʾ¼vwu23){xsneT7$9IW t>H9y񶽫yfRW=?@6 eTG7"  1,2%P_C铢Ǿͼle˽ì{kqY^>&&c'  DF??XbKDžyȿ˻vn˹ijskxlet_unwZpxTedC2/   NPLSzl̶xwǮžXkUgyb}|eya]o_[jK[]?@7!3)   oqjiznhĪsoGYKënssdsYlR_q`xm~cpSW]@JM0UR85, , KPBYo]fwTm}`żĸ}uqgyZTiRM\Fdr\U[EOXGR=WgUDJ7X`Hq}^fsZMV?prZ nyUi}Wxud|_sqýLZE~{ſnuelF68F2ļŻ|y-DH3`oSYrWű}_o[teoPgiXW\LIN>kpcZm`e{mpvkuk)&HG6EL:tpZjSu{:Q<*=0najO7:'JO6wm||l~WLW:PP7x~bWT:lm]Z 4VP8~m`sbs{00%2'1&OQ8cqPwklp~|F[B=M7FXDtyfNT:GJ6Z`Pmd{LO:KA-npZJE.80d[?mnKxR[Hr|YTS:D8%=0 ?@(MU;DM5KZCMdP8N8PU?CA*=:'RY=u`m{aunF>.PD,WN6ZS="7L='UI/YYAMO@T]LkTV;D?'>5$;6'V^MIUEBTBvwd|\ix[60>2RS8foRmy\IN7|MO=I2!R>%D0 x[XH?/1.FaS5K>%c`GtƻMN8FA2EF7PUGyzwlOT*=0PF1VS;NQ:OM8SQ;ehXC)P5U9"RA+B/J/  ?:(xgZ;xpOwwXuweWUDbbPtr~xek[u^RgQj{eDSAGM:OO@RTAG<*9%D(G1O=%K3"O8$SB+K4#P1^O8VC-`UJH$H% #ZN2e[?olM^lqOmt]`cMTQ:K?*G5&C3&C:*GQB[\tDT=_kRY`LA<+NI6@2$D1"QA+L8%M4"H'N0 K)W6$Q0Q+N*_H-RE0zxlm[:WC)Q.) M|vbmaG[G-`M3S;$XC1Q;+M6'M7'N:-I?0gnZR~uqZ|qTdRQS;HH1SM7K<*G2$M4$N2"K-Q3$O/ \E2O1V9)O*P+]I7\P;qbS:yPfO4N(* lK6!YG-XA(cO6[@&Z>)X?1\P=`YERH8FE4yDV@`Y:K@ML7qy]xy_QC0S>,\D.W=*X8%X4$V0 Y4#Y8%`;'^7$aG3dXFymR`Q5oXA$R+K&9(jfPebN{at\c]Ej;n~EWZKphBUITYDadH]W>WG3W?-V9+bJ9Z;+Z8)V6%a<*_?,cJ:xgVdI6u_xrbS8%p`EqeEfL.P#P/+^]H_Z;oltĩ۸ӹX0eP=shVgTDs\LraT_F8sZByckQ:nJ1aF)^?"T+R&S9$( 򏓄abIG7#O8&hRAeRAmkYyj}~T}{M|G}P]NAdcEaZYteb{iZcOc_GeWDcKlRBkTCwfXwhSrXFzgO{eM`JxT=dG)W3T0P.SB)G>0wYVIwymshxxrl\tzkgfYxy||azarcikXsr[{ycwhUc]Q]tmzxj\Lzn^uqbxjve|wVC{YDzZDdI.T4`I,ZI0QC.TK?ZB@5E=/MH2_YBh^C|ol\Żr}}lkt|pvboiWn`Rtyjsi{smrcQwdT|n_dQcNdOk\?T>#K1E'?/gd\0UYQ\VVKE;&`YDj}sz}mȶ~qqotcvp`{vyúǶ|move{eT}bPlVkWmX]H.{v_a_HA/>5 rrnklf gi]E;%I9$RI/tnyzj̿¹z}q~pte{qfXgVs`vbg`GI:&nrXLL7A>-wvs>6">0RF+UL0xu˷ïïʺɾ˺øźwsesd|lwexeyc}j|gjjKTA)H?'QT:Y\MWZSHY>4HB(NH-fkQµȹƿɻ{nwlqe}oqrv~u[d]?G8"8-gkS~| omi @:%_^I^`O}xȽ»{}p~nqo|mrmhPE>*M@*ZVDzuIH9hMP9\iUfrcvyrt}mJM6]fQtwptupDJ7GN7EP;SbP̽ùǾ}|Ľk{jR[FlthqXZR8ZeRi|ffk¼ƿƼcpdEM;xyv9@4};J7]y^:S?Ǿp|s69.ZYS/xyx9@7)5(2@27D9µïĵ}zlOM;RYJ*$WSLGjom *@7'>4);1APEŽǾǽǹ|PJ5E>)1%<3&`oww C_^*OM)F=@QH~ʾǽ~pL>+3(2%QI@P{~~Nqs};ce9cd:_^qûľuG=,4*0"RJB?i|}8P{I}:rT}{_RC5,2+D@3wwts|}Ehph-bu)_xF\{ZSJ<.#.,$ZZP;||{ny| MkxY5hx/k}3s6,! ,IZelquz  ~xtpkdYH+ AcrxSTQհ瀀~BC@wpb?$= hFP?ɺirWNPA X;"  ?F7z}r°İǹtmrzY\_>Srzitʻfxf¨ar_|z}]q[xj_dHA9" r {ql[ovin~aPcMq~f_hP`iK\eIA>(&wWaB{ph`s\ƾ^w`la\mWCP8UdOLT@iuZS\CWXMW26-Q]iJatVkkºQYF]j[spl~hAN6HS8l}cWhPɿ cg[ׇ}w|38+EK;EN=xs}t:B0=@,vkqm`mVs[`G($cmpZ|pxqmrMUJ1(EE1paqpqtAT0Y`Tyx_kQHB-F;(OP7`dL]_KUJ;P6N9%zC-.)\g[=~}\wjgUTM=dhTre}dRdOYcOAD2ID3OE2@'H,O5"P6"Q9$P3[L6rWC2J(LG9dX=i\@[L4_Q=N<*L7)I@0zndN[ENP:NF3G5%L4$M2"Q4$T:(Q3"P.Q._N9|mdPuPM,C6+ZJ2s\^H/^H6zt^ytdWbU_U]~xBNAchNeaIT@-[B.X:(V3#\6$`>*[9'^F2dS;~]U9O)"\\]N`]E}fȬ@vEKMuwIkdK`P]bI\S>\E5YC4X@3gP>cN=jSCr`Qp[EsbMcC*hO1[3Q/ ede^icQVE3iTClgUswW\VYIib^yi[gUgaKeQ@V\SZaUaE6fH8gH9u]FkSvZDkG/cC([3U8<3*ZKJC~r|tpgWi~fn¸Zvkjp]||cthUaf\qtjXI}jyscrbxd{ZEsS8%zzx|{zB7$K@'^[?{IJ˺ɾwiug}lkox]WJ1LF/`dS[VLYOL6UXBʾ{m~nrtfaHJ=(\YHy{v vvtHK6O[F˿|xV]Gem^`b[@UbL_s`ǻHQ?xzvDJ@FZDK^NʿļNRHXWQG|||3C:)<1GUKƺQK7:3!JD9ex||Hcc.OKF[TúOC12&TMD[}cz{YJx|Cs}oý}tgG@/:4$d`[3p{}Bht/f|LmsDC;0#OKAevus t{~SpxREny4bp8Y^ALE=LGQklUuzHip`pr>z{{??(  @$.22-#222 FjNPKijhffdJKHiE ?2p WO5uB=+bl\OM9X]CfjVO<'d[L:lcF~kcZH`aQUcMLI6L<+K0P3!T:&zp]\C, $"RsjT}qXkQhS^J\N:Y@/_B1fJ9{jWmY9sK%+:0%,LjI/N^ӷ*ufvcWRwmڒnU[Gmth۷NfOlFsᄔhD!,ʬmVXK m-"XJR\85-iGuY:4˹2 CCh$uE)c+zw c Kag[SkEDIBc4nDq{.k+v7}1L[$ah [pKJjһYFw[/]8u]4%]Y͗{1[]aO^{[^6#E \)$_̧,]un}IENDB`src/icons/xa.png0000666000175000017500000000147511714662540013431 0ustar dererkdererkPNG  IHDRasBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8}Ohe?}vYMƦV^t(L!; de C2x27OE80;Ńd`lnvZFMy~e/n灇*qS `kn6ޮe+ؕ>*:gue|Fl^ovM/D='D9l}De<>?q]ok\3 00x驀l^YknO;S3"CwֵOeNUv[ _O6#2Խ)ߘ^Z=,}-..$p4mv |KcT7{w;k+op*sTmJwJ|| <2:btjFapbbvɓcc۷i_I&94Ofdy;~]uN=%/RӮN-t+WaP=H3"g2͡E8kLNV.W7_?LTB-kAVQUs* ݀{r9pۀss T{OxSuREFFxyXŐA*Xϩ<؎ZJP:KhCX|rqQTxBXV^#X_><b0IENDB`src/icons/torchat.png0000666000175000017500000000555011714662540014463 0ustar dererkdererkPNG  IHDR szzsRGBbKGD pHYs  tIME)Ĉ IDATXÝy}?s.$eUNjFTM*A^@GmmѠQhEQ U7vWe]]i\䐜gJX(l<~7O7^j=/Xs xАSUwHlyVr{[n~y{$ʿ=PbQr :(7xznqll௏N7h6(XM;=Io0ZS@%ꆅ+ӎYhk&KkInL߲kjuɉqH5x*3YX Av" ׃/t!qؘ6趓T֤#ʾ!am+33[O?'x?yc+=W<{%|mmNa ZӢ\o4%lOw&Rύ'$TvNNI^0 .gla/fD|~ci+KqG ]#[S|A/A"KadC{h}wo//Q_k9щc<^ۢި1roAGzNgG70Pbn5FއahĂAR?6{R٬qjpoLe(,G[[Q(s8DɁem3VhIYXJ1a آDR9Y<~t_xy4 0-EbP#K2ɝ5zbBW!f,eYLF%L%DEXPUlܽMRIW  dJHv}F Eqrp$vyr:RɥRUj$K줪z CoV tvy0zw.իp歧5twG{8$YD|D:Q(V=̇lHi4TfovPý$6In֛H.? %Ԛ02@0vN &ܚY ,($h\xaN׮{T_$=!n5ЁnzPȋp ^YݙBeHʀyyBሄ.xWD:v#ps+,pe E[cc]'wR,m" oiRU5.7łCQ_z쁒yz8RsWǢ,{?Sظ}|AD!ʣaj ԊݲؖCqZTJE.)TK͆O([G)Nns|.wy>}4! VrZw($;(U,AAmJjF 3,1zh$ jqNGNBmR Z)_ds-CYՈt;؎ /6RrNPVԛ&b7AM5XMl+gN5:v"}=llo sjZʉCϰohmn/BWU>7ᰟt*ï<>'pf\W `vվC#Sck.ܞ͋ϾHKgoǏ$T2$K$3 Zu*HT"G8։VL&rWݸu x|ewqb0@[z]Cp$iR,_} =lzdyq޽aϭ>{v'/$!VZGwɑaAr8*mn^od ?Nzým92 deFFFfi>QY]z!}@4͜3]7ʪuz'VjԸ2{CP)s|(Jo ʺ](wwꟼpI7 37%v}]]O I#R00 AD>wfcHTeZ]䲕䕫W?i x7~hPY5Q%eaV܍ssW-`P (X% z. w]a Mߛ~:Dݶݾ;{kO{m֓nk&)3IENDB`src/icons/away.png0000666000175000017500000000147611714662540013763 0ustar dererkdererkPNG  IHDRasBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT8ukTgϽw>1HZcblFA$Pꪔ.,B+ƕtםŅta u•J II5|u2Ӆq?QUjo_z\Ve#z2YJm`|Env7}-jJ/T /+Nm̩U)l+Y P˺ƖM 1$>كZ Kbǫ ,P6է .5huʪ? UÕș@#݄L06u×+컣q|FLl鎝;l>7sIݻ %>ǎ^Hvnw>ֲJl ~~֮,}FǦxT<=L5vѺx̣_-ςkc9ѧDkHvz+3܉6wlnJuG[{^ BXkpJ0?JdҳIk cvxOɶt~1` b&͔itN@:SpaZc 4 _A%¢g9r0i_EDFշ-kqAK/{sj$(,h$:!ԫGb՘cJ 霚IհTI I6R,?0Dbˉ76aZoufIENDB`src/Tor/0000755000175000017500000000000012074647461011736 5ustar dererkdererksrc/Tor/tor.sh0000666000175000017500000000016311714662540013075 0ustar dererkdererk#!/bin/sh trap 'kill -15 `cat tor.pid`' 15 export PATH=$PATH:/usr/sbin tor -f torrc.txt --PidFile tor.pid & wait src/Tor/torrc.txt0000666000175000017500000000364211714662540013634 0ustar dererkdererk## torrc.txt ## ## This is the configuration file for the portable instance of Tor. ## You will only have to make changes here if you want to run a second ## instance of TorChat on the same machine. See the HowTo. ## ## If you want to run multiple instances, change SocksPort ## and the second (ONLY THE SECOND) port in HiddenServicePort below ## to something like (for example) this: ## ## SocksPort 22209 ## HiddenServicePort 11009 127.0.0.1:22009 ## ## Remember to change these same numbers in torchat.ini in the sections ## [tor_portable] and [client] also. There also exists a more detailed HowTo. ## IMPORTANT: NEVER change the FIRST 11009 in HiddenServicePort, this is the ## port INSIDE the tunnel. This number is hardcoded, but since it is inside ## the tunnel it cannot collide, no matter how many instances you run. You ## must change only the second number, the forwarding target, as shown above. ############################################################################# SocksPort 11109 ## we don't use the control port currently, so leave this alone # ControlPort 11119 ## INCOMING connections for the hidden service arrive at 11009 ## and will be forwarded to TorChat at 127.0.0.1:11009 HiddenServiceDir hidden_service HiddenServicePort 11009 127.0.0.1:11009 ## where should tor store it's cache files DataDirectory tor_data ## some tuning AvoidDiskWrites 1 LongLivedPorts 11009 FetchDirInfoEarly 1 CircuitBuildTimeout 30 NumEntryGuards 6 ## You can uncomment the lines below to log Tor's activity to the ## console or to a log file. Use this only during debugging! ## Turning off SaveLogging will leave sensitive information on your disk, ## the built in default is save logging turned on (set to 1). ## so don't remove the # from that line unless you need it ## and remember to put it in again, after you are done. #Log info File tor.log #Log info stdout #SafeLogging 0 src/make_debian_package.py0000666000175000017500000001552711714662540015447 0ustar dererkdererk#!/usr/bin/python import os import version TMP_ROOT = "debroot" version = version.VERSION_ONLY deb_name = "torchat-%s.deb" % version control_file = """Package: torchat Version: %s Section: internet Priority: optional Architecture: all Essential: no Depends: tor, python (>= 2.5), python (<< 3.0), python-wxgtk2.8 Maintainer: Bernd Kreuss Provides: torchat Description: Instant Messenger for Tor """ % version copyright="""TorChat is copyright (C) 2007, 2010 Bernd Kreuss TorChat is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. TorChat is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA On Debian systems, the complete text of the GNU General Public License, version 3, can be found in /usr/share/common-licenses/GPL-3. -- The files in /usr/lib/torchat/SocksiPy are Copyright 2006 Dan-Haim. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of Dan Haim nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY DAN HAIM "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAN HAIM OR HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMANGE. -- The files in /usr/share/pixmaps/torchat are partially derived from the gajim buddy status icons (c) The Gajim Team (GNU-GPL) """ dirs = ["DEBIAN", "usr", "usr/bin", "usr/share", "usr/share/doc", "usr/share/doc/torchat", "usr/share/doc/torchat/html", "usr/share/applications", "usr/share/pixmaps", "usr/share/pixmaps/torchat", "usr/lib", "usr/lib/torchat", "usr/lib/torchat/SocksiPy", "usr/lib/torchat/translations", "usr/lib/torchat/Tor", ] files = [("translations/*.py", "usr/lib/torchat/translations"), ("translations/*.txt", "usr/lib/torchat/translations"), ("icons/*", "usr/share/pixmaps/torchat"), ("SocksiPy/__init__.py", "usr/lib/torchat/SocksiPy"), ("SocksiPy/socks.py", "usr/lib/torchat/SocksiPy"), ("SocksiPy/BUGS", "usr/lib/torchat/SocksiPy"), ("SocksiPy/LICENSE", "usr/lib/torchat/SocksiPy"), ("SocksiPy/README", "usr/lib/torchat/SocksiPy"), ("Tor/tor.sh", "usr/lib/torchat/Tor"), ("Tor/torrc.txt", "usr/lib/torchat/Tor"), ("torchat.py", "usr/lib/torchat"), ("config.py", "usr/lib/torchat"), ("version*.py", "usr/lib/torchat"), ("tc_*.py", "usr/lib/torchat"), ("dlg*.py", "usr/lib/torchat"), ("LICENSE", "usr/share/doc/torchat"), ("changelog.txt", "usr/share/doc/torchat"), ("../doc/howto_second_instance.html", "usr/share/doc/torchat/html"), ] postinst = """#!/bin/sh cd /usr/lib/torchat echo creating symbolic links... ln -s /usr/share/pixmaps/torchat icons #echo compiling to bytecode... #python2.5 -OOc "import torchat" echo TorChat installed. """ prerm = """#!/bin/sh rm -rf /usr/lib/torchat """ start_script = """#!/bin/sh tryStartWith(){ echo "searching for "$1 if [ -f /usr/bin/$1 ] then echo "starting torchat with "$1 echo "command line arguments: "$args cd /usr/lib/torchat /usr/bin/$1 torchat.py $args exit fi } args=$* echo "trying to find suitable python version" tryStartWith "python2" tryStartWith "python2.7" tryStartWith "python2.6" tryStartWith "python2.5" echo "no suitable python version found, you need one of them listed above" """ desktop = """[Desktop Entry] Categories=Network;InstantMessaging; Name=TorChat Instant Messenger Comment=Anonymous Instant Messenger for Tor Version=%s Exec=/usr/bin/torchat Path=/usr/lib/torchat/ Icon=/usr/share/pixmaps/torchat/torchat.png StartupNotify=true StartupWMClass=TorChat Terminal=false Type=Application """ % version def chmod(mode, dest): dest_full = os.path.join(TMP_ROOT, dest) os.system("chmod %s %s" % (mode, dest_full)) def mkdir(dir): print "creating directory %s" % dir path = os.path.join(TMP_ROOT, dir) os.system("mkdir %s" % path) chmod(755, dir) def copy(file, dest): print "copying %s to %s" % (file, dest) dest_full = os.path.join(TMP_ROOT, dest) os.system("cp %s %s" % (file, dest_full)) chmod(644, os.path.join(dest, os.path.basename(file))) def create(content, dest): print "creating file %s" % (dest) dest_full = os.path.join(TMP_ROOT, dest) os.system("echo '%s' > %s" % (content, dest_full)) chmod(644, dest) print "creating temporary root dir" os.system("rm -rf %s" % TMP_ROOT) mkdir("") #create empty TMP_ROOT for dir in dirs: mkdir(dir) for file, dest in files: copy(file, dest) create(control_file, "DEBIAN/control") create(copyright, "DEBIAN/copyright") create(copyright, "usr/share/doc/torchat/copyright") create(postinst, "DEBIAN/postinst") chmod(755, "DEBIAN/postinst") create(prerm, "DEBIAN/prerm") chmod(755, "DEBIAN/prerm") create(desktop, "usr/share/applications/torchat.desktop") create(start_script, "usr/bin/torchat") chmod(755, "usr/bin/torchat") chmod(755, "usr/lib/torchat/torchat.py") chmod(755, "usr/lib/torchat/Tor/tor.sh") #now build the package using dpkg -b os.system("fakeroot dpkg -b %s %s" % (TMP_ROOT, deb_name)) os.system("mv %s ../release" % deb_name) os.system("rm -rf %s" % TMP_ROOT) print "done." src/portable.txt0000666000175000017500000000135211714662540013543 0ustar dererkdererkThis file (portable.txt) is used to indicate that TorChat is running in portable mode. If this file is found in this folder, all config and data will be stored in the program folder itself, rather than in the users home directory. If you delete this file, then TorChat will create a folder ~/.torchat (or %AppData%\torchat on w32) on the computer's harddisk and store it's configuration and data there, so if you plan to run the program from a removable media, leave this file where it is. Distributors and packagers remove this file if a fixed installation of TorChat is desired. The contents of this file are irrelevant. It could also be completely empty. It is only checked if there is a file "portable.txt" or not.src/config.py0000666000175000017500000004342211775422222013013 0ustar dererkdererk# -*- coding: UTF-8 -*- ############################################################################## # # # Copyright (c) 2007-2010 Bernd Kreuss # # # # This program is licensed under the GNU General Public License V3, # # the full source code is included in the binary distribution. # # # # Included in the distribution are files from other open source projects: # # - TOR Onion Router (c) The Tor Project, 3-clause-BSD # # - SocksiPy (c) Dan Haim, BSD Style License # # - Gajim buddy status icons (c) The Gajim Team, GNU GPL # # # ############################################################################## import sys, os import locale import ConfigParser import traceback import inspect import translations import shutil def isWindows(): return sys.platform.startswith("win") if isWindows(): import ctypes config_defaults = { ("tor", "tor_server") : "127.0.0.1", ("tor", "tor_server_socks_port") : 9050, ("tor", "tor_server_control_port") : 9051, ("tor_portable", "tor_server") : "127.0.0.1", ("tor_portable", "tor_server_socks_port") : 11109, ("tor_portable", "tor_server_control_port") : 11119, ("client", "own_hostname") : "0000000000000000", ("client", "listen_interface") : "127.0.0.1", ("client", "listen_port") : 11009, ("logging", "log_file") : "", ("logging", "log_level") : 0, ("files", "temp_files_in_data_dir") : 1, ("files", "temp_files_custom_dir") : "", ("gui", "language") : "en", ("gui", "notification_popup") : 1, ("gui", "notification_method") : "generic", ("gui", "notification_flash_window") : 1, ("gui", "open_main_window_hidden") : 0, ("gui", "open_chat_window_hidden") : 0, ("gui", "time_stamp_format") : "(%H:%M:%S)", ("gui", "color_time_stamp") : "#808080", ("gui", "color_nick_myself") : "#0000c0", ("gui", "color_nick_buddy") : "#c00000", ("gui", "color_text_back") : "#ffffff", ("gui", "color_text_fore") : "#000000", ("gui", "color_text_use_system_colors") : 1, ("gui", "chat_font_name") : "Arial", ("gui", "chat_font_size") : 10, ("gui", "chat_window_width") : 400, ("gui", "chat_window_height") : 400, ("gui", "chat_window_height_lower") : 50, ("gui", "main_window_width") : 260, ("gui", "main_window_height") : 350, ("branding", "support_id") : "utvrla6mjdypbyw6", ("branding", "support_name") : "Bernd, author of TorChat", ("profile", "name") : "", ("profile", "text") : "", } LOCALE_ENC = locale.getpreferredencoding() try: CONSOLE_ENC = sys.stdout.encoding except: CONSOLE_ENC = None def toUnicode(unknownstr): # some things like sys.argv[] and also functions from os.path # return bytestrings. Since I don't know if this might change # eventually in some future Python version I need something to # decode them only if needed. (I try to decode everything as # soon as possible and only work with unicode everywhere) # Note: it seems none of these strings I have come across so far # was ever encoded in the console encoding, they all seem to use # the locale encoding. if isinstance(unknownstr, str): return unknownstr.decode(LOCALE_ENC) else: return unknownstr COPYRIGHT = u"Copyright (c) 2007-2011 Bernd Kreuß " DEAD_CONNECTION_TIMEOUT = 240 KEEPALIVE_INTERVAL = 120 MAX_UNANSWERED_PINGS = 4 SCRIPT_DIR = os.path.abspath(os.path.dirname(toUnicode(sys.argv[0]))) ICON_DIR = os.path.join(SCRIPT_DIR, "icons") log_writer = None cached_data_dir = None def isWindows98(): if isWindows(): return sys.getwindowsversion()[0] == 4 #@UndefinedVariable (make PyDev happy) else: return False def isMac(): return sys.platform == 'darwin' def killProcess(pid): try: if isWindows(): PROCESS_TERMINATE = 1 handle = ctypes.windll.kernel32.OpenProcess(PROCESS_TERMINATE, #@UndefinedVariable False, pid) print handle ctypes.windll.kernel32.TerminateProcess(handle, -1) #@UndefinedVariable ctypes.windll.kernel32.CloseHandle(handle) #@UndefinedVariable else: os.kill(pid, 15) except: print "(1) could not kill process %i" % pid tb() def isPortable(): #if the file portable.txt exists in the same directory #then we know that we are running in portable mode. dir = SCRIPT_DIR try: f = open(os.path.join(dir, "portable.txt"), "r") f.close() return True except: return False def getHomeDir(): if isWindows(): CSIDL_PERSONAL = 0x0005 buf = ctypes.create_unicode_buffer(256) ctypes.windll.shell32.SHGetSpecialFolderPathW(None, buf, CSIDL_PERSONAL, 0) return buf.value else: return toUnicode(os.path.expanduser("~")) def getDataDir(): global cached_data_dir if isPortable(): return SCRIPT_DIR if cached_data_dir: return cached_data_dir if isWindows(): CSIDL_APPDATA = 0x001a buf = ctypes.create_unicode_buffer(256) ctypes.windll.shell32.SHGetSpecialFolderPathW(None, buf, CSIDL_APPDATA, 0) appdata = buf.value data_dir = os.path.join(appdata, "torchat") else: home = toUnicode(os.path.expanduser("~")) data_dir = os.path.join(home, ".torchat") #test for optional profile name in command line try: data_dir += "_" + toUnicode(sys.argv[1]) except: pass #create it if necessary if not os.path.exists(data_dir): os.mkdir(data_dir) #and create the folder 'Tor' with tor.exe and torrc.txt in it if necessary data_dir_tor = os.path.join(data_dir, "Tor") if isWindows(): tor_exe = "tor.exe" else: tor_exe = "tor.sh" if not os.path.exists(data_dir_tor): os.mkdir(data_dir_tor) shutil.copy(os.path.join("Tor", tor_exe), data_dir_tor) shutil.copy(os.path.join("Tor", "torrc.txt"), data_dir_tor) #fix permissions for filename in os.listdir(data_dir): if os.path.isfile(filename): # old log files still lying around in the data folder os.chmod(os.path.join(data_dir, filename), 0600) os.chmod(data_dir, 0700) os.chmod(data_dir_tor, 0700) os.chmod(os.path.join(data_dir_tor, tor_exe), 0700) os.chmod(os.path.join(data_dir_tor, "torrc.txt"), 0600) cached_data_dir = data_dir return data_dir def getProfileLongName(): try: return "%s - %s" % (toUnicode(sys.argv[1]), get("client", "own_hostname")) except: return get("client", "own_hostname") class OrderedRawConfigParser(ConfigParser.RawConfigParser): def __init__(self, defaults = None): ConfigParser.RawConfigParser.__init__(self, defaults = None) def write(self, fp): """Write an .ini-format representation of the configuration state.""" if self._defaults: fp.write("[%s]\n" % ConfigParser.DEFAULTSECT) for key in sorted(self._defaults): fp.write( "%s = %s\n" % (key, str(self._defaults[key]).replace('\n', '\n\t'))) fp.write("\n") for section in sorted(self._sections): fp.write("[%s]\n" % section) for key in sorted(self._sections[section]): if key != "__name__": fp.write("%s = %s\n" % (key, str(self._sections[section][key]).replace('\n', '\n\t'))) fp.write("\n") def readConfig(): global file_name global config dir = getDataDir() if not os.path.isdir(dir): os.mkdir(dir) file_name = dir + "/torchat.ini" config = OrderedRawConfigParser() #remove the BOM (notepad saves with BOM) if os.path.exists(file_name): f = file(file_name,'r+b') try: header = f.read(3) if header == "\xef\xbb\xbf": print "found UTF8 BOM in torchat.ini, removing it" f.seek(0) f.write("\x20\x0d\x0a") except: pass f.close() try: config.read(file_name) except ConfigParser.MissingSectionHeaderError: print "" print "*** torchat.ini must be saved as UTF-8 ***" sys.exit() #try to read all known options once. This will add #all the missing options to the config file for section, option in config_defaults: get(section, option) def writeConfig(): fp = open(file_name, "w") os.chmod(file_name, 0600) config.write(fp) fp.close() def get(section, option): if not config.has_section(section): config.add_section(section) if not config.has_option(section, option): value = config_defaults[section, option] set(section, option, value) value = config.get(section, option) if type(value) == str: try: value = value.decode("UTF-8") value = value.rstrip(" \"'").lstrip(" \"'") except: print "*** config file torchat.ini is not UTF-8 ***" print "*** this will most likely break things ***" elif type(value) == int: value = str(value) elif type(value) == float: value = str(value) return value # this should now be a unicode string def getint(section, option): value = get(section, option).lower() if value in ["yes", "on", "true"]: return 1 if value in ["no", "off", "false"]: return 0 try: return int(value) except: return 0 def set(section, option, value): if not config.has_section(section): config.add_section(section) if type(value) == bool: value = int(value) if type(value) == unicode: value = value.encode("UTF-8") config.set(section, option, value) writeConfig() def tb(level=0): print "(%i) ----- start traceback -----\n%s ----- end traceback -----\n" % (level, traceback.format_exc()) def tb1(): print "---- BEGIN DEBUG CALLSTACK" traceback.print_stack() print "---- END DEBUG CALLSTACK" def getTranslators(): translators = [] for mname in translations.__dict__: #@UndefinedVariable if mname[:5] == "lang_": m = translations.__dict__[mname] #@UndefinedVariable try: lcode = m.LANGUAGE_CODE lname = m.LANGUAGE_NAME ltrans = m.TRANSLATOR_NAMES for person in ltrans: new_entry = "%s (%s [%s])" % (person, lname, lcode) if not new_entry in translators: translators.append(new_entry) except: pass return ", ".join(translators) def importLanguage(): """switch the language by redefining all the variables that will be available in the lang.* namespace, using the namespace __dict__ and making use of the wonderful dynamic nature of the Python language""" # (The many undefinedvariable comments below are there to make # the code analysis of Eclipse-PyDev happy, which would not be able # to recognize that these are perfectly valid at *runtime*) #if the strings in the language module have already been changed then if translations.lang_en.LANGUAGE_CODE != "en": #restore the original values from our backup to have #all strings reset to english. This helps when switching #between incomplete translations. for key in standard_dict: translations.lang_en.__dict__[key] = standard_dict[key] #@UndefinedVariable lang_xx = "lang_" + get("gui", "language") if lang_xx == "lang_en": #lang_en is the standard translation. nothing to replace. return if not SCRIPT_DIR in sys.path: #make sure that script dir is in sys.path (py2exe etc.) print "(1) putting script directory into module search path" sys.path.insert(0, SCRIPT_DIR) dict_std = translations.lang_en.__dict__ #@UndefinedVariable print "(1) trying to import language module %s" % lang_xx try: #first we try to find a language module in the script dir dict_trans = __import__(lang_xx).__dict__ print "(1) found custom language module %s.py" % lang_xx except: #nothing found, so we try the built in translations if lang_xx in translations.__dict__: #@UndefinedVariable print "(1) found built in language module %s" % lang_xx dict_trans = translations.__dict__[lang_xx].__dict__ else: print "(0) translation module %s not found" dict_trans = None if dict_trans: #dict_std is the __dict__ of the standard lang module #dict_trans is the __dict__ of the translation #find missing translations and report them in the log for key in dict_std: if not key in dict_trans: print "(2) %s is missing translation for %s" % (lang_xx, key) #replace the bindings in lang_en with those from lang_xx for key in dict_trans: if not key in dict_std: print "(2) unused %s in %s" % (key, lang_xx) else: dict_std[key] = dict_trans[key] class LogWriter: def __init__(self): old_dir = os.getcwd() os.chdir(getDataDir()) self.encoding = LOCALE_ENC #if log_file is a relative path then let it be relative to DataDir() self.file_name = os.path.abspath(get("logging", "log_file")) os.chdir(old_dir) self.stdout = sys.stdout sys.stdout = self sys.stderr = self self.level = getint("logging", "log_level") if self.level and get("logging", "log_file"): try: self.logfile = open(self.file_name, 'w') os.chmod(self.file_name, 0600) print "(0) started logging to file '%s'" % self.file_name print "(0) logging to file might leave sensitive information on disk" except: self.logfile = None print "(0) could not open logfile '%s'" % self.file_name print "(0) logging only to stdout" else: self.logfile = None print "(1) logging to file is disabled" print "(1) current log level is %i" % self.level print "(1) locale encoding is %s" % LOCALE_ENC print "(1) console encoding is %s" % CONSOLE_ENC print "(1) LogWriter initialized" def write(self, text): text = text.rstrip() if text == "": return # If something prints a string that is not unicode then we simply # assume it is encoded in the encoding of the current locale. if isinstance(text, str): text = text.decode(self.encoding, 'replace') text += "\n" try: x = text[0] y = text[2] if x == "(" and y == ")": level = int(text[1]) else: text = "(0) " + text level = 0 except: text = "(0) " + text level = 0 if level <= self.level: try: frame = inspect.getframeinfo(inspect.currentframe(1)) module = os.path.basename(frame[0]) module = module.split(".")[0] line = frame[1] func = frame[2] pos = "[%s,%i,%s]" % (module, line, func) text = text[0:4] + pos + text[3:] except: pass if CONSOLE_ENC: self.stdout.write(text.encode(CONSOLE_ENC, 'replace')) self.stdout.flush() if self.logfile: # logfile like all other TorChat related files always UTF-8 self.logfile.write(text.encode("UTF-8")) self.logfile.flush() def close(self): self.stdout.close() self.logfile.close() def main(): global standard_dict global log_writer #many things are relative to the script directory, so set is as the cwd os.chdir(SCRIPT_DIR) readConfig() log_writer = LogWriter() print "(0) python version %s" % sys.version.replace("\n", "").replace("\r", "") if isPortable(): print "(0) running in portable mode, all data is kept inside the bin folder." if (len(sys.argv) > 1): print "(0) ignoring requested profile '%s' because profiles do not exist in portable mode" % toUnicode(sys.argv[1]) print "(0) script directory is %s" % SCRIPT_DIR print "(0) data directory is %s" % getDataDir() #make a backup of all strings that are in the standard language file #because we could need them when switching between incomplete languages standard_dict = {} for key in translations.lang_en.__dict__: #@UndefinedVariable standard_dict[key] = translations.lang_en.__dict__[key] #@UndefinedVariable #now switch to the configured translation importLanguage() main()