gtkgui now registers to connections events
This commit is contained in:
parent
0c2fb7ffe3
commit
d6a76e58c4
|
@ -437,11 +437,11 @@ class connection:
|
||||||
return -1
|
return -1
|
||||||
# END connect
|
# END connect
|
||||||
|
|
||||||
def register_handler(self, event, funtion):
|
def register_handler(self, event, function):
|
||||||
if event in self.handlers:
|
if event in self.handlers:
|
||||||
self.handlers[event].append(function)
|
self.handlers[event].append(function)
|
||||||
|
|
||||||
def unregister_handler(self, event, funtion):
|
def unregister_handler(self, event, function):
|
||||||
if event in self.handlers:
|
if event in self.handlers:
|
||||||
if function in self.handlers[event]:
|
if function in self.handlers[event]:
|
||||||
self.handlers[event].remove(function)
|
self.handlers[event].remove(function)
|
||||||
|
|
|
@ -1123,6 +1123,7 @@ class Account_modification_window:
|
||||||
Error_dialog(_('An account already has this name'))
|
Error_dialog(_('An account already has this name'))
|
||||||
return
|
return
|
||||||
gajim.connections[name] = connection.connection(name)
|
gajim.connections[name] = connection.connection(name)
|
||||||
|
self.plugin.register_handlers(gajim.connections[name])
|
||||||
#if we neeed to register a new account
|
#if we neeed to register a new account
|
||||||
if new_account_checkbutton.get_active():
|
if new_account_checkbutton.get_active():
|
||||||
self.plugin.send('NEW_ACC', None, (hostname, login, password, name, \
|
self.plugin.send('NEW_ACC', None, (hostname, login, password, name, \
|
||||||
|
|
|
@ -652,6 +652,33 @@ class interface:
|
||||||
# update regular expressions
|
# update regular expressions
|
||||||
self.make_regexps()
|
self.make_regexps()
|
||||||
|
|
||||||
|
def register_handlers(self, conn):
|
||||||
|
conn.register_handler('ROSTER', self.handle_event_roster)
|
||||||
|
conn.register_handler('WARNING', self.handle_event_warning)
|
||||||
|
conn.register_handler('ERROR', self.handle_event_error)
|
||||||
|
conn.register_handler('STATUS', self.handle_event_status)
|
||||||
|
conn.register_handler('NOTIFY', self.handle_event_notify)
|
||||||
|
conn.register_handler('MSG', self.handle_event_msg)
|
||||||
|
conn.register_handler('MSGERROR', self.handle_event_msgerror)
|
||||||
|
conn.register_handler('MSGSENT', self.handle_event_msgsent)
|
||||||
|
conn.register_handler('SUBSCRIBED', self.handle_event_subscribed)
|
||||||
|
conn.register_handler('UNSUBSCRIBED', self.handle_event_unsubscribed)
|
||||||
|
conn.register_handler('SUBSCRIBE', self.handle_event_subscribe)
|
||||||
|
conn.register_handler('AGENT_INFO', self.handle_event_agent_info)
|
||||||
|
conn.register_handler('AGENT_INFO_ITEMS', \
|
||||||
|
self.handle_event_agent_info_items)
|
||||||
|
conn.register_handler('AGENT_INFO_INFO', \
|
||||||
|
self.handle_event_agent_info_info)
|
||||||
|
conn.register_handler('QUIT', self.handle_event_quit)
|
||||||
|
conn.register_handler('ACC_OK', self.handle_event_acc_ok)
|
||||||
|
conn.register_handler('MYVCARD', self.handle_event_myvcard)
|
||||||
|
conn.register_handler('VCARD', self.handle_event_vcard)
|
||||||
|
conn.register_handler('OS_INFO', self.handle_event_os_info)
|
||||||
|
conn.register_handler('GC_MSG', self.handle_event_gc_msg)
|
||||||
|
conn.register_handler('GC_SUBJECT', self.handle_event_gc_subject)
|
||||||
|
conn.register_handler('BAD_PASSPHRASE', self.handle_event_bad_passphrase)
|
||||||
|
conn.register_handler('ROSTER_INFO', self.handle_event_roster_info)
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
if gtk.pygtk_version >= (2, 6, 0):
|
if gtk.pygtk_version >= (2, 6, 0):
|
||||||
gtk.about_dialog_set_email_hook(self.on_launch_browser_mailer, 'mail')
|
gtk.about_dialog_set_email_hook(self.on_launch_browser_mailer, 'mail')
|
||||||
|
@ -680,7 +707,6 @@ class interface:
|
||||||
if pix:
|
if pix:
|
||||||
gtk.window_set_default_icon(pix)
|
gtk.window_set_default_icon(pix)
|
||||||
self.roster = Roster_window(self)
|
self.roster = Roster_window(self)
|
||||||
gobject.timeout_add(100, self.read_sleepy)
|
|
||||||
self.sleeper = common.sleepy.Sleepy( \
|
self.sleeper = common.sleepy.Sleepy( \
|
||||||
gajim.config.get('autoawaytime')*60, \
|
gajim.config.get('autoawaytime')*60, \
|
||||||
gajim.config.get('autoxatime')*60)
|
gajim.config.get('autoxatime')*60)
|
||||||
|
@ -708,8 +734,12 @@ class interface:
|
||||||
self.windows['add_remove_emoticons_window'] = \
|
self.windows['add_remove_emoticons_window'] = \
|
||||||
Add_remove_emoticons_window(self)
|
Add_remove_emoticons_window(self)
|
||||||
self.windows['roster'] = self.roster
|
self.windows['roster'] = self.roster
|
||||||
|
|
||||||
|
for account in gajim.connections:
|
||||||
|
self.register_handlers(gajim.connections[account])
|
||||||
|
|
||||||
gobject.timeout_add(100, self.autoconnect)
|
gobject.timeout_add(100, self.autoconnect)
|
||||||
|
gobject.timeout_add(100, self.read_sleepy)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try: # Import Psyco if available
|
try: # Import Psyco if available
|
||||||
|
|
Loading…
Reference in New Issue