Commit aa861b90 authored by Yann Leboulanger's avatar Yann Leboulanger

configuration is now in common/config

currently gajim cannot be accessed from every where, even with global gajim :(
parent aaf349f1
......@@ -33,7 +33,7 @@ APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
GTKGUI_GLADE='gtkgui.glade'
class Chat:
"""Class for chat/groupchat windows"""
......@@ -58,15 +58,15 @@ class Chat:
def update_tags(self):
for jid in self.tagIn:
self.tagIn[jid].set_property("foreground", \
self.plugin.config['inmsgcolor'])
self.tagOut[jid].set_property("foreground", \
self.plugin.config['outmsgcolor'])
self.tagStatus[jid].set_property("foreground", \
self.plugin.config['statusmsgcolor'])
self.tagIn[jid].set_property('foreground', \
gajim.config.get('inmsgcolor'))
self.tagOut[jid].set_property('foreground', \
gajim.config.get('outmsgcolor'))
self.tagStatus[jid].set_property('foreground', \
gajim.config.get('statusmsgcolor'))
def update_print_time(self):
if self.plugin.config['print_time'] != 'sometimes':
if gajim.config.get('print_time') != 'sometimes':
list_jid = self.print_time_timeout_id.keys()
for jid in list_jid:
gobject.source_remove(self.print_time_timeout_id[jid])
......@@ -85,9 +85,9 @@ class Chat:
unread += self.nb_unread[jid]
start = ""
if unread > 1:
start = "[" + str(unread) + "] "
start = '[' + str(unread) + '] '
elif unread == 1:
start = "* "
start = '* '
chat = self.names[jid]
if len(self.xmls) > 1: # if more than one tabs in the same window
if self.widget_name == 'tabbed_chat_window':
......@@ -105,9 +105,9 @@ class Chat:
"""redraw the label of the tab"""
start = ''
if self.nb_unread[jid] > 1:
start = "[" + str(self.nb_unread[jid]) + "] "
start = '[' + str(self.nb_unread[jid]) + '] '
elif self.nb_unread[jid] == 1:
start = "* "
start = '* '
child = self.childs[jid]
tab_label = self.notebook.get_tab_label(child).get_children()[0]
tab_label.set_text(start + self.names[jid])
......@@ -134,8 +134,7 @@ class Chat:
return active_jid
def on_close_button_clicked(self, button, jid):
"""When close button is pressed :
close a tab"""
"""When close button is pressed : close a tab"""
self.remove_tab(jid)
def on_chat_window_focus_in_event(self, widget, event):
......@@ -219,13 +218,13 @@ class Chat:
conversation_buffer.create_mark('end', end_iter, False)
self.tagIn[jid] = conversation_buffer.create_tag('incoming')
color = self.plugin.config['inmsgcolor']
color = gajim.config.get('inmsgcolor')
self.tagIn[jid].set_property('foreground', color)
self.tagOut[jid] = conversation_buffer.create_tag('outgoing')
color = self.plugin.config['outmsgcolor']
color = gajim.config.get('outmsgcolor')
self.tagOut[jid].set_property('foreground', color)
self.tagStatus[jid] = conversation_buffer.create_tag('status')
color = self.plugin.config['statusmsgcolor']
color = gajim.config.get('statusmsgcolor')
self.tagStatus[jid].set_property('foreground', color)
tag = conversation_buffer.create_tag('time_sometimes')
......@@ -405,7 +404,7 @@ class Chat:
def print_time_timeout(self, jid):
if not jid in self.xmls.keys():
return 0
if self.plugin.config['print_time'] == 'sometimes':
if gajim.config.get('print_time') == 'sometimes':
conversation_textview = self.xmls[jid].\
get_widget('conversation_textview')
conversation_buffer = conversation_textview.get_buffer()
......@@ -487,7 +486,7 @@ class Chat:
index = 0
# basic: links + mail + formatting is always checked (we like that)
if self.plugin.config['useemoticons']: # search for emoticons & urls
if gajim.config.get('useemoticons'): # search for emoticons & urls
iterator = self.plugin.emot_and_basic_re.finditer(otext)
else: # search for just urls + mail + formatting
iterator = self.plugin.basic_pattern_re.finditer(otext)
......@@ -593,11 +592,11 @@ class Chat:
text = ''
if conversation_buffer.get_char_count() > 0:
conversation_buffer.insert(end_iter, '\n')
if self.plugin.config['print_time'] == 'always':
if gajim.config.get('print_time') == 'always':
if not tim:
tim = time.localtime()
self.before_time_symbols = self.plugin.config['before_time']
self.after_time_symbols = self.plugin.config['after_time']
self.before_time_symbols = gajim.config.get('before_time')
self.after_time_symbols = gajim.config.get('after_time')
format = self.before_time_symbols + '%H:%M:%S' + self.after_time_symbols
tim_format = time.strftime(format, tim)
conversation_buffer.insert(end_iter, tim_format + ' ')
......@@ -614,8 +613,8 @@ class Chat:
tags = other_tags_for_name[:] #create a new list
tags.append(kind)
if name and not print_all_special:
self.before_nickname_symbols = self.plugin.config['before_nickname']
self.after_nickname_symbols = self.plugin.config['after_nickname']
self.before_nickname_symbols = gajim.config.get('before_nickname')
self.after_nickname_symbols = gajim.config.get('after_nickname')
format = self.before_nickname_symbols + name\
+ self.after_nickname_symbols + ' '
self.print_with_tag_list(conversation_buffer, format, end_iter, tags)
......
## Core/connection.py
## common/connection.py
##
## Gajim Team:
## - Yann Le Boulanger <asterix@lagaule.org>
......@@ -86,13 +86,12 @@ class connection:
def __init__(self, name = None):
# dict of function to be calledfor each event
self.handlers = {'ROSTER': [], 'WARNING': [], 'ERROR': [], 'STATUS': [], \
'NOTIFY': [], 'MSG': [], 'MSGERROR': [], 'SUBSCRIBED': [], \
'UNSUBSCRIBED': [], 'SUBSCRIBE': [], 'AGENTS': [], 'AGENT_INFO': [], \
'AGENT_INFO_ITEMS': [], 'AGENT_INFO_INFO': [], 'REG_AGENT_INFO': [], \
'QUIT': [], 'ACC_OK': [], 'CONFIG': [], 'MYVCARD': [], 'OS_INFO': [], \
'VCARD': [], 'LOG_NB_LINE': [], 'LOG_LINE': [], 'VISUAL': [], \
'NOTIFY': [], 'MSG': [], 'MSGERROR': [], 'MSGSENT': [] , \
'SUBSCRIBED': [], 'UNSUBSCRIBED': [], 'SUBSCRIBE': [], \
'AGENT_INFO': [], 'AGENT_INFO_ITEMS': [], 'AGENT_INFO_INFO': [], \
'QUIT': [], 'ACC_OK': [], 'MYVCARD': [], 'OS_INFO': [], 'VCARD': [], \
'GC_MSG': [], 'GC_SUBJECT': [], 'BAD_PASSPHRASE': [], \
'GPG_SECRETE_KEYS': [], 'ROSTER_INFO': [], 'MSGSENT': []}
'ROSTER_INFO': []}
self.name = name
self.connected = 0 # offline
self.connection = None # Jabber.py instance
......
......@@ -31,7 +31,7 @@ gtk.glade.textdomain (APP)
from dialogs import *
import gtkgui
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
GTKGUI_GLADE='gtkgui.glade'
class Preferences_window:
......@@ -1213,9 +1213,13 @@ class Account_modification_window:
self.plugin.send('ASK_VCARD', self.account, jid)
def on_gpg_choose_button_clicked(self, widget, data=None):
w = choose_gpg_key_dialog()
self.plugin.windows['gpg_keys'] = w
self.plugin.send('GPG_SECRETE_KEYS', None, ())
#FIXME:
secret_keys = connection.ask_gpg_secrete_keys()
if not secret_keys:
Error_dialog(_('error contacting %s') % service)
return
secret_keys['None'] = 'None'
w = choose_gpg_key_dialog(secret_keys)
keyID = w.run()
if keyID == -1:
return
......@@ -1796,7 +1800,12 @@ class Service_discovery_window:
if not iter :
return
service = model.get_value(iter, 1)
self.plugin.send('REG_AGENT_INFO', self.account, service)
#FIXME:
infos = connection.ask_register_agent_info(service)
if not infos.has_key('instructions'):
Error_dialog(_('error contacting %s') % service)
else:
Service_registration_window(service, infos, self.plugin, self.account)
self.window.destroy()
def on_services_treeview_cursor_changed(self, widget):
......
......@@ -27,9 +27,8 @@ gtk.glade.bindtextdomain (APP, i18n.DIR)
gtk.glade.textdomain (APP)
import gtkgui
import version
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
GTKGUI_GLADE='gtkgui.glade'
class Vcard_information_window:
"""Class for user's information window"""
......@@ -363,7 +362,7 @@ class choose_gpg_key_dialog:
for keyID in list.keys():
model.append((keyID, list[keyID]))
def __init__(self):
def __init__(self, secret_keys):
#list : {keyID: userName, ...}
xml = gtk.glade.XML(GTKGUI_GLADE, 'choose_gpg_key_dialog', APP)
self.window = xml.get_widget('choose_gpg_key_dialog')
......@@ -377,6 +376,7 @@ class choose_gpg_key_dialog:
renderer = gtk.CellRendererText()
self.keys_treeview.insert_column_with_attributes(-1, _('User name'), \
renderer, text=1)
self.fill_tree(secret_keys)
self.window.show_all()
......@@ -389,12 +389,12 @@ class Change_status_message_dialog:
self.autoconnect = autoconnect
message_textview = self.xml.get_widget('message_textview')
self.message_buffer = message_textview.get_buffer()
self.message_buffer.set_text(self.plugin.config['last_msg'])
self.message_buffer.set_text(gajim.config.get('last_msg'))
self.values = {'':''}
i = 0
while self.plugin.config.has_key('msg%s_name' % i):
self.values[self.plugin.config['msg%s_name' % i]] = \
self.plugin.config['msg%s' % i]
while gajim.config.exist('msg%s_name' % i):
self.values[gajim.config.get('msg%s_name' % i)] = \
gajim.config.get('msg%s' % i)
i += 1
liststore = gtk.ListStore(str, str)
message_comboboxentry = self.xml.get_widget('message_comboboxentry')
......@@ -413,7 +413,7 @@ class Change_status_message_dialog:
if rep == gtk.RESPONSE_OK:
beg, end = self.message_buffer.get_bounds()
message = self.message_buffer.get_text(beg, end, 0)
self.plugin.config['last_msg'] = message
gajim.config.set('last_msg', message)
else:
message = -1
self.window.destroy()
......@@ -565,7 +565,7 @@ class About_dialog:
dlg = gtk.AboutDialog()
dlg.set_name('Gajim')
dlg.set_version(version.version)
dlg.set_version(gajim.version.version)
s = u'Copyright \xa9 2003-2005 Gajim Team'
dlg.set_copyright(s)
text = open('COPYING').read()
......@@ -683,7 +683,7 @@ class Join_groupchat_window:
cell = gtk.CellRendererText()
self.recently_combobox.pack_start(cell, True)
self.recently_combobox.add_attribute(cell, 'text', 0)
self.recently_groupchat = self.plugin.config['recently_groupchat'].split()
self.recently_groupchat = gajim.config.get('recently_groupchat').split()
for g in self.recently_groupchat:
self.recently_combobox.append_text(g)
......@@ -720,8 +720,7 @@ class Join_groupchat_window:
self.recently_groupchat.insert(0, jid)
if len(self.recently_groupchat) > 10:
self.recently_groupchat = self.recently_groupchat[0:10]
self.plugin.config['recently_groupchat'] = \
' '.join(self.recently_groupchat)
gajim.config.set('recently_groupchat', ' '.join(self.recently_groupchat))
self.plugin.roster.new_group(jid, nickname, self.account)
self.plugin.send('GC_JOIN', self.account, (nickname, room, server, \
password))
......
......@@ -34,7 +34,7 @@ APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
GTKGUI_GLADE='gtkgui.glade'
class Groupchat_window(Chat):
"""Class for Groupchat window"""
......
## plugins/gtkgui.py
## gtkgui.py
##
## Gajim Team:
## - Yann Le Boulanger <asterix@lagaule.org>
......@@ -16,41 +16,7 @@
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
if __name__ == "__main__":
import getopt, pickle, sys, socket
try: # Import Psyco if available
import psyco
psyco.full()
except ImportError:
pass
try:
opts, args = getopt.getopt(sys.argv[1:], "p:h", ["help"])
except getopt.GetoptError:
# print help information and exit:
usage()
sys.exit(2)
port = 8255
for o, a in opts:
if o == '-p':
port = a
if o in ("-h", "--help"):
usage()
sys.exit()
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
sock.connect(('', 8255))
except:
#TODO: use i18n
print "unable to connect to localhost on port ", port
else:
evp = pickle.dumps(('EXEC_PLUGIN', '', 'gtkgui'))
sock.send('<'+evp+'>')
sock.close()
sys.exit()
import pygtk
pygtk.require('2.0')
import gtk
......@@ -58,10 +24,9 @@ import gtk.glade
import pango
import gobject
import os
import time
import sys
import Queue
import sre
global gajim
import common.gajim as gajim
import common.sleepy
try:
......@@ -72,8 +37,8 @@ except ImportError:
class CellRendererImage(gtk.GenericCellRenderer):
__gproperties__ = {
"image": (gobject.TYPE_OBJECT, "Image",
"Image", gobject.PARAM_READWRITE),
'image': (gobject.TYPE_OBJECT, 'Image',
'Image', gobject.PARAM_READWRITE),
}
def __init__(self):
......@@ -115,8 +80,8 @@ class CellRendererImage(gtk.GenericCellRenderer):
pix_rect.x += cell_area.x
pix_rect.y += cell_area.y
pix_rect.width -= 2 * self.get_property("xpad")
pix_rect.height -= 2 * self.get_property("ypad")
pix_rect.width -= 2 * self.get_property('xpad')
pix_rect.height -= 2 * self.get_property('ypad')
draw_rect = cell_area.intersect(pix_rect)
draw_rect = expose_area.intersect(draw_rect)
......@@ -150,15 +115,15 @@ class CellRendererImage(gtk.GenericCellRenderer):
return 0, 0, 0, 0
pixbuf_width = pix.get_width()
pixbuf_height = pix.get_height()
calc_width = self.get_property("xpad") * 2 + pixbuf_width
calc_height = self.get_property("ypad") * 2 + pixbuf_height
calc_width = self.get_property('xpad') * 2 + pixbuf_width
calc_height = self.get_property('ypad') * 2 + pixbuf_height
x_offset = 0
y_offset = 0
if cell_area and pixbuf_width > 0 and pixbuf_height > 0:
x_offset = self.get_property("xalign") * (cell_area.width - \
calc_width - self.get_property("xpad"))
y_offset = self.get_property("yalign") * (cell_area.height - \
calc_height - self.get_property("ypad"))
x_offset = self.get_property('xalign') * (cell_area.width - \
calc_width - self.get_property('xpad'))
y_offset = self.get_property('yalign') * (cell_area.height - \
calc_height - self.get_property('ypad'))
return x_offset, y_offset, calc_width, calc_height
gobject.type_register(CellRendererImage)
......@@ -205,63 +170,24 @@ APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
def usage():
#TODO: use i18n
print 'usage :', sys.argv[0], ' [OPTION]'
print ' -p\tport on which the sock plugin listen'
print ' -h, --help\tdisplay this help and exit'
GTKGUI_GLADE='gtkgui.glade'
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
class plugin:
"""Class called by the core in a new thread"""
class accounts:
"""Class where are stored the accounts and users in them"""
def __init__(self):
self.__accounts = {}
def add_account(self, account, users=()):
#users must be like (user1, user2)
self.__accounts[account] = users
def add_user_to_account(self, account, user):
if self.__accounts.has_key(account):
self.__accounts[account].append(user)
else :
return 1
def get_accounts(self):
return self.__accounts.keys();
def get_users(self, account):
if self.__accounts.has_key(account):
return self.__accounts[account]
else :
return None
def which_account(self, user):
for a in self.__accounts.keys():
if user in self.__accounts[a]:
return a
return None
class interface:
def launch_browser_mailer(self, kind, url):
#kind = 'url' or 'mail'
if self.config['openwith'] == 'gnome-open':
if gajim.config.get('openwith') == 'gnome-open':
app = 'gnome-open'
args = ['gnome-open']
args.append(url)
elif self.config['openwith'] == 'kfmclient exec':
elif gajim.config.get('openwith') == 'kfmclient exec':
app = 'kfmclient'
args = ['kfmclient', 'exec']
elif self.config['openwith'] == 'custom':
elif gajim.config.get('openwith') == 'custom':
if kind == 'url':
conf = self.config['custombrowser']
conf = gajim.config.get('custombrowser')
if kind == 'mail':
conf = self.config['custommailapp']
conf = gajim.config.get('custommailapp')
if conf == '': # if no app is configured
return
args = conf.split()
......@@ -280,44 +206,24 @@ class plugin:
return 0
def play_sound(self, event):
if not self.config['sounds_on']:
if not gajim.config.get('sounds_on'):
return
path_to_soundfile = self.config[event + '_file']
path_to_soundfile = gajim.config.get(event + '_file')
if not os.path.exists(path_to_soundfile):
return
if os.name == 'nt':
winsound.PlaySound(path_to_soundfile, \
winsound.SND_FILENAME|winsound.SND_ASYNC)
elif os.name == 'posix':
if self.config['soundplayer'] == '':
if gajim.config.get('soundplayer') == '':
return
argv = self.config['soundplayer'].split()
argv = gajim.config.get('soundplayer').split()
argv.append(path_to_soundfile)
pid = os.spawnvp(os.P_NOWAIT, argv[0], argv)
pidp, r = os.waitpid(pid, os.WNOHANG)
if pidp == 0:
gobject.timeout_add(10000, self.play_timeout, pid)
def send(self, event, account, data):
self.queueOUT.put((event, account, data))
def wait(self, what):
"""Wait for a message from Core"""
#TODO: timeout
temp_q = Queue.Queue(50)
while 1:
if not self.queueIN.empty():
ev = self.queueIN.get()
if ev[0] == what and ev[2][0] == 'GtkGui':
#Restore messages
while not temp_q.empty():
ev2 = temp_q.get()
self.queueIN.put(ev2)
return ev[2][1]
else:
#Save messages
temp_q.put(ev)
def handle_event_roster(self, account, data):
#('ROSTER', account, (state, array))
statuss = ['offline', 'online', 'away', 'xa', 'dnd', 'invisible']
......@@ -500,11 +406,6 @@ class plugin:
def handle_event_unsubscribed(self, account, jid):
Information_dialog(_("You are now unsubscribed by %s") % jid)
def handle_event_agents(self, account, agents):
#('AGENTS', account, agents)
if self.windows[account].has_key('disco'):
self.windows[account]['disco'].agents(agents)
def handle_event_agent_info(self, account, array):
#('AGENT_INFO', account, (agent, identities, features, items))
if self.windows[account].has_key('disco'):
......@@ -522,13 +423,6 @@ class plugin:
self.windows[account]['disco'].agent_info_info(array[0], array[1], \
array[2])
def handle_event_reg_agent_info(self, account, array):
#('REG_AGENTS_INFO', account, (agent, infos))
if not array[1].has_key('instructions'):
Error_dialog(_("error contacting %s") % array[0])
else:
Service_registration_window(array[0], array[1], self, account)
def handle_event_acc_ok(self, account, array):
#('ACC_OK', account, (hostname, login, pasword, name, resource, prio,
#use_proxy, proxyhost, proxyport))
......@@ -559,11 +453,6 @@ class plugin:
def handle_event_quit(self, p1, p2):
self.roster.on_quit() # SUCH FUNCTION DOES NOT EXIST!!
def save_config(self):
hidden_lines = self.config['hiddenlines'].split('\t')
self.config['hiddenlines'] = '\t'.join(hidden_lines)
self.send('CONFIG', None, ('GtkGui', self.config, 'GtkGui'))
def handle_event_myvcard(self, account, array):
nick = ''
if array.has_key('NICKNAME'):
......@@ -581,22 +470,6 @@ class plugin:
self.windows[account]['infos'][array[0]].set_os_info(array[1], \
array[2])
def handle_event_log_nb_line(self, account, array):
#('LOG_NB_LINE', account, (jid, nb_line))
if self.windows['logs'].has_key(array[0]):
self.windows['logs'][array[0]].set_nb_line(array[1])
begin = 0
if array[1] > 50:
begin = array[1] - 50
self.send('LOG_GET_RANGE', None, (array[0], begin, array[1]))
def handle_event_log_line(self, account, array):
#('LOG_LINE', account, (jid, num_line, date, type, data))
# if type = 'recv' or 'sent' data = [msg]
# else type = jid and data = [status, away_msg]
if self.windows['logs'].has_key(array[0]):
self.windows['logs'][array[0]].new_line(array[1:])
def handle_event_gc_msg(self, account, array):
#('GC_MSG', account, (jid, msg, time))
jids = array[0].split('/')
......@@ -626,11 +499,6 @@ class plugin:
def handle_event_bad_passphrase(self, account, array):
Warning_dialog(_("Your GPG passphrase is wrong, so you are connected without your GPG key."))
def handle_event_gpg_secrete_keys(self, account, keys):
keys['None'] = 'None'
if self.windows.has_key('gpg_keys'):
self.windows['gpg_keys'].fill_tree(keys)
def handle_event_roster_info(self, account, array):
#('ROSTER_INFO', account, (jid, name, sub, ask, groups))
jid = array[0]
......@@ -652,68 +520,6 @@ class plugin:
user.groups = array[4]
self.roster.redraw_jid(jid, account)
def read_queue(self):
"""Read queue from the core and execute commands from it"""
while self.queueIN.empty() == 0:
ev = self.queueIN.get()
if ev[0] == 'ROSTER':
self.handle_event_roster(ev[1], ev[2])
elif ev[0] == 'WARNING':
self.handle_event_warning(ev[1], ev[2])
elif ev[0] == 'ERROR':
self.handle_event_error(ev[1], ev[2])
elif ev[0] == 'STATUS':
self.handle_event_status(ev[1], ev[2])
elif ev[0] == 'NOTIFY':
self.handle_event_notify(ev[1], ev[2])
elif ev[0] == 'MSG':
self.handle_event_msg(ev[1], ev[2])
elif ev[0] == 'MSGERROR':
self.handle_event_msgerror(ev[1], ev[2])
elif ev[0] == 'MSGSENT':
self.handle_event_msgsent(ev[1], ev[2])
elif ev[0] == 'SUBSCRIBE':
self.handle_event_subscribe(ev[1], ev[2])
elif ev[0] == 'SUBSCRIBED':
self.handle_event_subscribed(ev[1], ev[2])
elif ev[0] == 'UNSUBSCRIBED':
self.handle_event_unsubscribed(ev[1], ev[2])
elif ev[0] == 'AGENTS':
self.handle_event_agents(ev[1], ev[2])
elif ev[0] == 'AGENT_INFO':
self.handle_event_agent_info(ev[1], ev[2])
elif ev[0] == 'AGENT_INFO_ITEMS':
self.handle_event_agent_info_items(ev[1], ev[2])
elif ev[0] == 'AGENT_INFO_INFO':
self.handle_event_agent_info_info(ev[1], ev[2])
elif ev[0] == 'REG_AGENT_INFO':
self.handle_event_reg_agent_info(ev[1], ev[2])
elif ev[0] == 'ACC_OK':
self.handle_event_acc_ok(ev[1], ev[2])
elif ev[0] == 'QUIT':
self.handle_event_quit(ev[1], ev[2])
elif ev[0] == 'MYVCARD':
self.handle_event_myvcard(ev[1], ev[2])
elif ev[0] == 'OS_INFO':
self.handle_event_os_info(ev[1], ev[2])
elif ev[0] == 'VCARD':
self.handle_event_vcard(ev[1], ev[2])
elif ev[0] == 'LOG_NB_LINE':
self.handle_event_log_nb_line(ev[1], ev[2])
elif ev[0] == 'LOG_LINE':
self.handle_event_log_line(ev[1], ev[2])
elif ev[0] == 'GC_MSG':
self.handle_event_gc_msg(ev[1], ev[2])
elif ev[0] == 'GC_SUBJECT':
self.handle_event_gc_subject(ev[1], ev[2])
elif ev[0] == 'BAD_PASSPHRASE':
self.handle_event_bad_passphrase(ev[1], ev[2])
elif ev[0] == 'GPG_SECRETE_KEYS':
self.handle_event_gpg_secrete_keys(ev[1], ev[2])
elif ev[0] == 'ROSTER_INFO':
self.handle_event_roster_info(ev[1], ev[2])
return 1
def read_sleepy(self):
"""Check if we are idle"""
if not self.sleeper.poll():
......@@ -847,117 +653,25 @@ class plugin:
# update regular expressions
self.make_regexps()
def __init__(self, quIN, quOUT):
gtk.gdk.threads_init()
def __init__(self):
if gtk.pygtk_version >= (2, 6, 0):
gtk.about_dialog_set_email_hook(self.on_launch_browser_mailer, 'mail')
gtk.about_dialog_set_url_hook(self.on_launch_browser_mailer, 'url')
self.queueIN = quIN
self.queueOUT = quOUT
self.send('REG_MESSAGE', 'gtkgui', ['ROSTER', 'WARNING', 'ERROR', \
'STATUS', 'NOTIFY', 'MSG', 'MSGERROR', 'SUBSCRIBED', 'UNSUBSCRIBED', \
'SUBSCRIBE', 'AGENTS', 'AGENT_INFO', 'AGENT_INFO_ITEMS', \
'AGENT_INFO_INFO', 'REG_AGENT_INFO', 'QUIT', 'ACC_OK', 'CONFIG', \
'MYVCARD', 'OS_INFO', 'VCARD', 'LOG_NB_LINE', 'LOG_LINE', 'VISUAL', \
'GC_MSG', 'GC_SUBJECT', 'BAD_PASSPHRASE', 'GPG_SECRETE_KEYS', \
'ROSTER_INFO', 'MSGSENT'])
self.default_config = {'autopopup':0,\
'autopopupaway':0,\
'ignore_unknown_contacts':0,\
'showoffline':0,\
'autoaway':1,\
'autoawaytime':10,\
'autoxa':1,\
'autoxatime':20,\
'ask_online_status':0,\
'ask_offline_status':0,\
'last_msg':'',\
'msg0_name':'Nap',\
'msg0':'I\'m taking a nap.',\
'msg1_name':'Brb',\
'msg1':'Back in some minutes.',\
'msg2_name':'Eating',\
'msg2':'I\'m eating, so leave me a message.',\
'msg3_name':'Movie',\
'msg3':'I\'m watching a movie.',\
'msg4_name':'Working',\
'msg4':'I\'m working.',\
'trayicon':1,\
'iconset':'sun',\
'inmsgcolor':'#ff0000',\
'outmsgcolor': '#0000ff',\
'statusmsgcolor':'#1eaa1e',\
'hiddenlines':'',\
'accounttextcolor': '#ffffff',\
#ff0000
'accountbgcolor': '#94aa8c',\
#9fdfff
'accountfont': 'Sans Bold 10',\
'grouptextcolor': '#0000ff',\
'groupbgcolor': '#eff3e7',\
#ffffff
'groupfont': 'Sans Italic 10',\
'usertextcolor': '#000000',\
'userbgcolor': '#ffffff',\
'userfont': 'Sans 10',\
'saveposition': 1,\
'mergeaccounts': 0,\
'usetabbedchat': 1,\
'print_time': 'always',\