Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
25222d3
move some global members of tc_client to BuddyList
bit-fag Oct 26, 2013
b4117bf
listen on random free port if port=0
bit-fag Oct 31, 2013
916e7f9
check existance of wx_ctrl in Control.setEnabled
bit-fag Oct 31, 2013
18db80a
add config item turning account into chat room
bit-fag Oct 31, 2013
26d3c7f
remove debugging print
bit-fag Oct 31, 2013
082426d
do not allow nicks looking like addresses in chats
bit-fag Oct 31, 2013
2cf5320
reported user agent can be changed in preferences
bit-fag Nov 1, 2013
3909f2e
plugin loading
bit-fag Nov 1, 2013
dd692f6
test plugin sendin 'test' instead of any message
bit-fag Nov 1, 2013
29fea2c
change translation rules for plugins
bit-fag Nov 2, 2013
e49f2b3
add Plugins tab to Preferences, a plugin is Check
bit-fag Nov 2, 2013
b2f549a
plugins replace methods not classes
bit-fag Nov 2, 2013
78528db
load plugins from torchat.main
bit-fag Nov 2, 2013
52f2615
import plugins without imp module
bit-fag Nov 2, 2013
76e7807
feature test_plugin
bit-fag Nov 2, 2013
5d885ac
show plugin name if no description available
bit-fag Nov 2, 2013
964e454
conference features as a plugin
bit-fag Nov 2, 2013
e3e3265
import tranlation after plugin import
bit-fag Nov 2, 2013
bd36d99
russian translate tab title Plugins
bit-fag Nov 2, 2013
024df10
Check conference.no_gui
bit-fag Nov 2, 2013
520b2a7
conference !list command
bit-fag Nov 2, 2013
99d6442
fix update of other buddy's avatar to no avatar
bit-fag Nov 2, 2013
cf1ef60
many commands in conference plugin
bit-fag Nov 2, 2013
4b0e934
each conference command lives in own function
bit-fag Nov 2, 2013
e6deb93
fix conference.ignore, address in place of buddy
bit-fag Nov 2, 2013
f8ceeb3
conference members can not ignore moderators
bit-fag Nov 2, 2013
6afbc98
conference doesn't resend messages starting with [
bit-fag Nov 2, 2013
6a06012
conference recognizes nicks with @/% or by part
bit-fag Nov 3, 2013
7fb4c95
notes in conference help
bit-fag Nov 3, 2013
c1317b6
implement conference admin commands
bit-fag Nov 3, 2013
26d20ca
start conference help message with [help]
bit-fag Nov 3, 2013
08c5fa8
conference responds with Unknown command
bit-fag Nov 3, 2013
3214ffa
conference welcome to new users implemented
bit-fag Nov 3, 2013
0ae66ba
conference says welcome to user one time
bit-fag Nov 3, 2013
e2e2eb2
show topic and description in conference help
bit-fag Nov 3, 2013
fa22551
conference ban is just another role
bit-fag Nov 3, 2013
fcb5440
conference default_mode can be banned
bit-fag Nov 3, 2013
68b8b03
conference password
bit-fag Nov 3, 2013
4aa1dc5
conference announce with [admin] and [user]
bit-fag Nov 3, 2013
e565c4e
conference error with list_role fixed
bit-fag Nov 3, 2013
df76cf1
conference shows user's role in !list
bit-fag Nov 3, 2013
d131625
remove conference role list_for_moder, not used
bit-fag Nov 3, 2013
0d358c8
conference announce when user left room
bit-fag Nov 3, 2013
5432ec5
add plugins to make_*.py
bit-fag Nov 3, 2013
4d17607
conference gui preferences
bit-fag Nov 3, 2013
60ca212
save outer_sizer in self object (dlg_settings)
bit-fag Nov 3, 2013
0b0e20f
conference preferences fit tab p3
bit-fag Nov 3, 2013
6db1578
conference preferences in Conference tab
bit-fag Nov 3, 2013
32293ae
conference option receiver_status
bit-fag Nov 3, 2013
2eb6af4
conference GUI option password
bit-fag Nov 3, 2013
e7bc968
conference expand text preferences
bit-fag Nov 3, 2013
37e073c
conference set role of invited user to user
bit-fag Nov 3, 2013
71835bf
move password feature from to add_password plugin
bit-fag Nov 3, 2013
ce8a7f5
import version in torchat.py
bit-fag Nov 3, 2013
665021e
fake_user_agent plugin
bit-fag Nov 3, 2013
49a9eb6
disable_echo plugin
bit-fag Nov 3, 2013
b712876
conference shows status and role only in !list
bit-fag Nov 3, 2013
475e49d
allow multiple ping/pong on one connection
bit-fag Nov 3, 2013
431bf6f
ping plugin
bit-fag Nov 3, 2013
49f651c
global variable in disable_echo moved to global ns
bit-fag Nov 3, 2013
bec68dc
ping plugin calls GUI via CallAfter
bit-fag Nov 4, 2013
4faa976
plugin rock-paper-scissors
bit-fag Nov 4, 2013
719b46c
update ping plugin name from button to popup menu
bit-fag Nov 4, 2013
6d584d6
sort list of plugins in preferences
bit-fag Nov 4, 2013
07407dc
see popup menu in name of rps plugin
bit-fag Nov 4, 2013
b69465f
tc_client uses socks5 instead of socks4
bit-fag Nov 4, 2013
34ea697
plugins add preferences through addPluginSettings
bit-fag Nov 5, 2013
98c2878
rps fix attribute error
bit-fag Nov 5, 2013
1bd0d24
rps remove "see popup menu" from popup menu
bit-fag Nov 5, 2013
66c50e6
conference announce buddy entered room
bit-fag Nov 5, 2013
221149c
conference list members not currently in room
bit-fag Nov 5, 2013
d38d51b
update user name
bit-fag Nov 7, 2013
fe43c02
add () after method call
bit-fag Nov 7, 2013
9d95584
move buddy-list from buddy-list.txt to torchat.ini
bit-fag Nov 7, 2013
4f1406b
show local name or remote profile_name or address
bit-fag Nov 7, 2013
3f34068
sanitize profile_name prior to using it in GUI
bit-fag Nov 7, 2013
f8b2478
no add \n for empty name or profile_name in tip
bit-fag Nov 7, 2013
31cff97
conference sends sane profile_name of other users
bit-fag Nov 7, 2013
1161138
bind any port is specified port is in use
bit-fag Nov 7, 2013
0d8c275
update howto_second_instance
bit-fag Nov 7, 2013
8fe79ad
log socks proxy address and port
bit-fag Apr 13, 2014
b237a2c
config item client.tor_config -> tor_portable/tor
bit-fag Apr 13, 2014
02ba5a4
dlg_settings checkbox for client.tor_config
bit-fag Apr 13, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions torchat/doc/howto_second_instance.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
<h1>
How to run more than on instance of TorChat
</h1>
<p>
<span style="color: darkgreen">
For <b>torchat_py</b> versions <b>above 0.9.9.553</b>
this works out of box.
To start second account, add account's name to command line.
If you run portable torchat (Windows case), copy distribution
to another dir. Make sure not to copy Tor/hidden_service/ directory.
</span>
</p>
<hr/>
<p>
<span style="color: #ff0000">This howto will <b>not</b> work with versions <b>below 0.9.9.260</b></span>
</p>
Expand Down
2 changes: 1 addition & 1 deletion torchat/src/Tor/tor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
trap 'kill -15 `cat tor.pid`' 15

export PATH=$PATH:/usr/sbin
tor -f torrc.txt --PidFile tor.pid &
tor -f torrc.temp.txt --PidFile tor.pid &
wait
30 changes: 28 additions & 2 deletions torchat/src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import inspect
import translations
import shutil
import json

def isWindows():
return sys.platform.startswith("win")
Expand All @@ -29,15 +30,17 @@ def isWindows():
import ctypes

config_defaults = {
("client", "tor_config") : "tor_portable",
("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_socks_port") : 0,
("tor_portable", "tor_server_control_port") : 11119,
("client", "own_hostname") : "0000000000000000",
("client", "listen_interface") : "127.0.0.1",
("client", "listen_port") : 11009,
("client", "listen_port") : 0,
("client", "buddy-list") : '[]',
("logging", "log_file") : "",
("logging", "log_level") : 0,
("files", "temp_files_in_data_dir") : 1,
Expand Down Expand Up @@ -66,6 +69,7 @@ def isWindows():
("branding", "support_name") : "Bernd, author of TorChat",
("profile", "name") : "",
("profile", "text") : "",
("plugin", "enabled_plugins") : '',
}

LOCALE_ENC = locale.getpreferredencoding()
Expand Down Expand Up @@ -493,4 +497,26 @@ def main():
#now switch to the configured translation
importLanguage()

if not json.loads(get('client', 'buddy-list')):
# backward compatibility with buddy-list.txt
filename = os.path.join(getDataDir(), "buddy-list.txt")

if os.path.exists(filename):
f = open(filename)
buddy_list = []
for line in f:
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 = {'address': address,
'name': name.encode("UTF-8"),
'profile_name': ''}
buddy_list.append(buddy)
f.close()
set('client', 'buddy-list', json.dumps(buddy_list))

main()
3 changes: 2 additions & 1 deletion torchat/src/dlg.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def getDefault(self, default):
return default

def setEnabled(self, enabled):
self.wx_label.Enable(enabled)
if hasattr(self, 'wx_label'):
self.wx_label.Enable(enabled)
if self.wx_ctrl:
self.wx_ctrl.Enable(enabled)

Expand Down
54 changes: 43 additions & 11 deletions torchat/src/dlg_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import wx
import dlg
import config
import tc_client
import translations
lang = translations.lang_en

Expand All @@ -29,16 +28,16 @@ def __init__(self, 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)
self.outer_sizer = wx.BoxSizer(wx.VERTICAL)
self.outer_panel.SetSizer(self.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)
self.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)
self.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)
Expand All @@ -57,6 +56,9 @@ def __init__(self, main_window):
self.p1 = dlg.Panel(self.notebook)
self.notebook.AddPage(self.p1, lang.DSET_NET_TITLE)

portable = (self.mw.buddy_list.tor_config == "tor_portable")
self.tor_portable = dlg.Check(self.p1, lang.DSET_GUI_TOR_PORTABLE, int(portable))

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"))
Expand All @@ -69,9 +71,7 @@ def __init__(self, main_window):
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:
Expand All @@ -96,20 +96,52 @@ def __init__(self, main_window):
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)


#3.4 plugins
self.p4 = dlg.Panel(self.notebook)
self.notebook.AddPage(self.p4, lang.DSET_PLUGINS_TITLE)
self.plugins = {}
enabled_plugins = set(config.get('plugin', 'enabled_plugins').split(','))
import torchat
for plugin_name in sorted(torchat.PLUGINS.keys()):
plugin_dscr = getattr(lang, 'DSET_PLUGIN_' + plugin_name.upper(), plugin_name)
enabled = int(bool(plugin_name in enabled_plugins))
self.plugins[plugin_name] = dlg.Check(self.p4, plugin_dscr, enabled)

# add plugins' settings
self.addPluginSettings(main_window)

#4 fit the sizers
outer_sizer.Fit(self)

self.p1.fit()
self.p2.fit()
self.p3.fit()
self.p4.fit()
self.outer_sizer.Fit(self)

def addPluginSettings(self, main_window):
pass

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()
#enabled_plugins = set(config.get('plugin', 'enabled_plugins').split(','))
import torchat
if self.tor_portable.getValue() == 1:
config.set('client', 'tor_config', 'tor_portable')
else:
config.set('client', 'tor_config', 'tor')
enabled_plugins = []
for plugin_name in torchat.PLUGINS:
if self.plugins[plugin_name].getValue():
enabled_plugins.append(plugin_name)
config.set('plugin', 'enabled_plugins', ','.join(enabled_plugins))
if self.lang.getValue() != self.lang_old:
config.importLanguage()
evt.Skip() #let the frame now process the Ok event
Expand Down
2 changes: 2 additions & 0 deletions torchat/src/make_debian_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,13 @@
"usr/lib/torchat",
"usr/lib/torchat/SocksiPy",
"usr/lib/torchat/translations",
"usr/lib/torchat/plugins",
"usr/lib/torchat/Tor",
]

files = [("translations/*.py", "usr/lib/torchat/translations"),
("translations/*.txt", "usr/lib/torchat/translations"),
("plugins/*", "usr/lib/torchat/plugins"),
("icons/*", "usr/share/pixmaps/torchat"),
("SocksiPy/__init__.py", "usr/lib/torchat/SocksiPy"),
("SocksiPy/socks.py", "usr/lib/torchat/SocksiPy"),
Expand Down
3 changes: 3 additions & 0 deletions torchat/src/make_release_zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def zipSrc(zipfile_name):
"src\\translations\\insert_missing.py",
"src\\translations\\__init__.py",

"src\\plugins\\*",

"src\\SocksiPy\\*.py",
"src\\SocksiPy\\BUGS",
"src\\SocksiPy\\LICENSE",
Expand Down Expand Up @@ -130,6 +132,7 @@ def clean(folder):
def cleanSrc():
clean(".")
clean("translations")
clean("plugins")
clean("SocksiPy")

# ------------------
Expand Down
60 changes: 60 additions & 0 deletions torchat/src/plugins/add_password.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# -*- coding: UTF-8 -*-

NAME_en = u'Password protection against new contacts'
NAME_ru = u'Защита паролем от новых контактов'

def load(torchat):
def get(option):
return torchat.config.get("password", option)

torchat.config.config_defaults['password', 'password'] = ''
torchat.config.config_defaults['password', 'password_tip'] = ''

_message_execute = torchat.tc_client.ProtocolMsg_message.execute
def message_execute(self):
if self.buddy and self.buddy not in self.bl.list and get('password'):
if get('password') in self.text:
self.buddy.sendChatMessage('Good password')
self.__class__ = torchat.tc_client.ProtocolMsg_add_me
_add_me_execute(self)
else:
self.buddy.sendChatMessage('Bad password')
return # to suppress warning sent by torchat and password passing
_message_execute(self)
torchat.tc_client.ProtocolMsg_message.execute = message_execute

_add_me_execute = torchat.tc_client.ProtocolMsg_add_me.execute
def add_me_execute(self):
if self.buddy and self.buddy not in self.bl.list and get('password'):
message = u'Enter password'
if get('password_tip'):
message += u'. Password tip: %s' % get('password_tip')
self.buddy.sendChatMessage(message)
else:
_add_me_execute(self)
torchat.tc_client.ProtocolMsg_add_me.execute = add_me_execute

def set_tr(lang, option, translation):
setattr(torchat.TRANSLATIONS[lang],
'DSET_PASSWORD_' + option.upper(), translation)
set_tr('en', 'password', u'Password for new contacts')
set_tr('ru', 'password', u'Пароль для новых контактов')
set_tr('en', 'password_tip', u'Password tip')
set_tr('ru', 'password_tip', u'Подсказка о пароле')
torchat.config.importLanguage()

_addPluginSettings = torchat.dlg_settings.Dialog.addPluginSettings
def addPluginSettings(self, main_window):
_addPluginSettings(self, main_window)
def tr(option):
attr_name = 'DSET_PASSWORD_' + option.upper()
if hasattr(torchat.dlg_settings.lang, attr_name):
return getattr(torchat.dlg_settings.lang, attr_name)
else:
return option
def text(self, option):
torchat.dlg.Text(self.p3, tr(option),
("password", option), expand=True)
text(self, 'password')
text(self, 'password_tip')
torchat.dlg_settings.Dialog.addPluginSettings = addPluginSettings
Loading