2003-10-22 20:45:13 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
## plugins/gtkgui.py
|
|
|
|
##
|
|
|
|
## Gajim Team:
|
|
|
|
## - Yann Le Boulanger <asterix@crans.org>
|
|
|
|
## - Vincent Hanquez <tab@tuxfamily.org>
|
2003-10-23 11:54:19 +02:00
|
|
|
## - David Ferlier <david@yazzy.org>
|
2003-10-22 20:45:13 +02:00
|
|
|
##
|
|
|
|
## Copyright (C) 2003 Gajim Team
|
|
|
|
##
|
|
|
|
## 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; version 2 only.
|
|
|
|
##
|
|
|
|
## 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.
|
|
|
|
##
|
|
|
|
|
|
|
|
import pygtk
|
|
|
|
pygtk.require('2.0')
|
|
|
|
import gtk
|
|
|
|
import gtk.glade
|
|
|
|
import gobject
|
2003-10-23 20:29:15 +02:00
|
|
|
import string
|
|
|
|
import common.optparser
|
|
|
|
CONFPATH = "~/.gajimrc"
|
2003-10-22 20:45:13 +02:00
|
|
|
|
|
|
|
class user:
|
|
|
|
def __init__(self, *args):
|
|
|
|
if len(args) == 0:
|
2003-10-29 13:58:58 +01:00
|
|
|
self.jid = ''
|
2003-10-22 20:45:13 +02:00
|
|
|
self.name = ''
|
2003-10-29 13:58:58 +01:00
|
|
|
self.groups = []
|
2003-10-22 20:45:13 +02:00
|
|
|
self.show = ''
|
|
|
|
self.status = ''
|
2003-10-29 13:58:58 +01:00
|
|
|
self.sub == ''
|
2003-10-28 00:31:57 +01:00
|
|
|
elif len(args) == 6:
|
2003-10-29 13:58:58 +01:00
|
|
|
self.jid = args[0]
|
|
|
|
self.name = args[1]
|
|
|
|
self.groups = args[2]
|
|
|
|
self.show = args[3]
|
|
|
|
self.status = args[4]
|
|
|
|
self.sub = args[5]
|
|
|
|
# elif ((len(args)) and (type (args[0]) == type (self)) and
|
|
|
|
# (self.__class__ == args[0].__class__)):
|
|
|
|
# self.name = args[0].name
|
|
|
|
# self.groups = args[0].groups
|
|
|
|
# self.show = args[0].show
|
|
|
|
# self.status = args[0].status
|
|
|
|
# self.sub = args[0].sub
|
2003-10-22 20:45:13 +02:00
|
|
|
else: raise TypeError, 'bad arguments'
|
2003-10-28 00:31:57 +01:00
|
|
|
# self.jid = self.name + '@' + self.server + '/' + self.resource
|
2003-10-29 13:58:58 +01:00
|
|
|
# self.jid = self.name + '@' + self.server
|
2003-10-22 20:45:13 +02:00
|
|
|
|
2003-10-27 17:30:37 +01:00
|
|
|
class add:
|
|
|
|
def delete_event(self, widget):
|
|
|
|
self.Wadd.destroy()
|
|
|
|
|
|
|
|
def on_subscribe(self, widget):
|
|
|
|
who=self.xml.get_widget("entry_who").get_text()
|
|
|
|
buf=self.xml.get_widget("textview_sub").get_buffer()
|
|
|
|
start_iter = buf.get_start_iter()
|
|
|
|
end_iter = buf.get_end_iter()
|
|
|
|
txt = buf.get_text(start_iter, end_iter, 0)
|
|
|
|
self.r.req_sub(who, txt)
|
|
|
|
self.delete_event(self)
|
|
|
|
|
|
|
|
def __init__(self, roster):
|
|
|
|
self.r=roster
|
|
|
|
self.xml = gtk.glade.XML('plugins/gtkgui.glade', 'Add')
|
|
|
|
self.Wadd=self.xml.get_widget("Add")
|
|
|
|
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
|
|
|
self.xml.signal_connect('on_button_sub_clicked', self.on_subscribe)
|
|
|
|
|
2003-10-22 23:23:59 +02:00
|
|
|
class about:
|
|
|
|
def delete_event(self, widget):
|
2003-10-27 17:30:37 +01:00
|
|
|
self.Wabout.destroy()
|
2003-10-22 23:23:59 +02:00
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
self.xml = gtk.glade.XML('plugins/gtkgui.glade', 'About')
|
2003-10-27 17:30:37 +01:00
|
|
|
self.Wabout=self.xml.get_widget("About")
|
2003-10-22 23:23:59 +02:00
|
|
|
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
|
|
|
|
|
|
|
class accounts:
|
|
|
|
def delete_event(self, widget):
|
|
|
|
self.window.destroy()
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
self.xml = gtk.glade.XML('plugins/gtkgui.glade', 'Accounts')
|
|
|
|
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
|
|
|
|
2003-10-22 20:45:13 +02:00
|
|
|
class message:
|
|
|
|
def delete_event(self, widget):
|
2003-10-28 00:31:57 +01:00
|
|
|
del self.roster.tab_messages[self.user.jid]
|
2003-10-22 20:45:13 +02:00
|
|
|
self.window.destroy()
|
|
|
|
|
|
|
|
def print_conversation(self, txt, contact = None):
|
2003-10-23 23:36:00 +02:00
|
|
|
end_iter = self.convTxtBuffer.get_end_iter()
|
2003-10-25 19:50:34 +02:00
|
|
|
if contact:
|
|
|
|
self.convTxtBuffer.insert_with_tags_by_name(end_iter, '<moi> ', 'outgoing')
|
|
|
|
else:
|
2003-10-28 00:31:57 +01:00
|
|
|
self.convTxtBuffer.insert_with_tags_by_name(end_iter, '<' + self.user.name + '> ', 'incomming')
|
2003-10-25 19:50:34 +02:00
|
|
|
self.convTxtBuffer.insert(end_iter, txt+'\n')
|
2003-10-23 23:36:00 +02:00
|
|
|
self.conversation.scroll_to_mark(\
|
|
|
|
self.convTxtBuffer.get_mark('end'), 0.1, 0, 0, 0)
|
2003-10-22 20:45:13 +02:00
|
|
|
|
|
|
|
def on_msg_key_press_event(self, widget, event):
|
|
|
|
if event.keyval == gtk.keysyms.Return:
|
|
|
|
if (event.state & gtk.gdk.SHIFT_MASK):
|
|
|
|
return 0
|
|
|
|
txt_buffer = widget.get_buffer()
|
|
|
|
start_iter = txt_buffer.get_start_iter()
|
|
|
|
end_iter = txt_buffer.get_end_iter()
|
|
|
|
txt = txt_buffer.get_text(start_iter, end_iter, 0)
|
2003-10-28 00:31:57 +01:00
|
|
|
self.roster.queueOUT.put(('MSG',(self.user.jid, txt)))
|
2003-10-22 20:45:13 +02:00
|
|
|
txt_buffer.set_text('', -1)
|
2003-10-28 00:31:57 +01:00
|
|
|
self.print_conversation(txt, self.user.jid)
|
2003-10-22 20:45:13 +02:00
|
|
|
widget.grab_focus()
|
|
|
|
return 1
|
|
|
|
return 0
|
|
|
|
|
2003-10-28 00:31:57 +01:00
|
|
|
def __init__(self, user, roster):
|
2003-10-25 19:50:34 +02:00
|
|
|
self.cfgParser = common.optparser.OptionsParser(CONFPATH)
|
|
|
|
self.cfgParser.parseCfgFile()
|
2003-10-28 00:31:57 +01:00
|
|
|
self.user = user
|
2003-10-22 20:45:13 +02:00
|
|
|
self.roster = roster
|
|
|
|
self.xml = gtk.glade.XML('plugins/gtkgui.glade', 'Chat')
|
|
|
|
self.window = self.xml.get_widget('Chat')
|
2003-10-28 00:31:57 +01:00
|
|
|
self.window.set_title('Chat with ' + user.name)
|
2003-10-29 13:58:58 +01:00
|
|
|
self.xml.get_widget('label_contact').set_text(user.name + ' <'\
|
|
|
|
+ user.jid + '>')
|
|
|
|
#+ '/' + user.resource + '>')
|
2003-10-22 20:45:13 +02:00
|
|
|
self.message = self.xml.get_widget('message')
|
|
|
|
self.conversation = self.xml.get_widget('conversation')
|
2003-10-23 23:36:00 +02:00
|
|
|
self.convTxtBuffer = self.conversation.get_buffer()
|
2003-10-27 17:30:37 +01:00
|
|
|
end_iter=self.convTxtBuffer.get_end_iter()
|
2003-10-23 23:36:00 +02:00
|
|
|
self.convTxtBuffer.create_mark('end', end_iter, 0)
|
2003-10-22 20:45:13 +02:00
|
|
|
self.window.show()
|
|
|
|
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
|
|
|
self.xml.signal_connect('on_msg_key_press_event', self.on_msg_key_press_event)
|
2003-10-27 17:30:37 +01:00
|
|
|
self.tag = self.convTxtBuffer.create_tag("incomming")
|
2003-10-25 19:50:34 +02:00
|
|
|
color = self.cfgParser.GtkGui_inmsgcolor
|
|
|
|
if not color : color = red
|
|
|
|
self.tag.set_property("foreground", color)
|
|
|
|
self.tag = self.convTxtBuffer.create_tag("outgoing")
|
|
|
|
color = self.cfgParser.GtkGui_outmsgcolor
|
|
|
|
if not color : color = blue
|
|
|
|
self.tag.set_property("foreground", color)
|
2003-10-22 20:45:13 +02:00
|
|
|
|
|
|
|
class roster:
|
|
|
|
def get_icon_pixbuf(self, stock):
|
|
|
|
return self.tree.render_icon(stock, size = gtk.ICON_SIZE_MENU, detail = None)
|
|
|
|
|
2003-10-23 01:05:36 +02:00
|
|
|
def mkroster(self, tab):
|
2003-10-29 13:58:58 +01:00
|
|
|
""" l_contact = {jid:{'user':_, 'iter':[iter1, ...]] """
|
2003-10-28 00:31:57 +01:00
|
|
|
self.l_contact = {}
|
2003-10-29 13:58:58 +01:00
|
|
|
""" l_group = {name:iter} """
|
|
|
|
self.l_group = {}
|
2003-10-22 20:45:13 +02:00
|
|
|
for jid in tab.keys():
|
2003-10-29 13:58:58 +01:00
|
|
|
user1 = user(jid, tab[jid]['name'], tab[jid]['groups'], tab[jid]['show'], tab[jid]['status'], tab[jid]['sub'])
|
|
|
|
self.l_contact[user1.jid] = {'user':user1, 'iter':[]}
|
|
|
|
if user1.groups == []:
|
|
|
|
user1.groups.append('general')
|
|
|
|
for g in user1.groups:
|
|
|
|
if not self.l_group.has_key(g):
|
|
|
|
iterG = self.treestore.append(None, (None, g, 'group'))
|
|
|
|
self.l_group[g]=iterG
|
|
|
|
if user1.show != 'offline' or self.showOffline:
|
|
|
|
iterU = self.treestore.append(self.l_group[g], (self.pixbufs[user1.show], user1.name, user1.jid))
|
|
|
|
self.l_contact[user1.jid]['iter'].append(iterU)
|
|
|
|
|
2003-10-22 20:45:13 +02:00
|
|
|
def update_iter(self, widget, path, iter, data):
|
2003-10-28 00:31:57 +01:00
|
|
|
jid = self.treestore.get_value(iter, 2)
|
|
|
|
if jid == data[0]:
|
2003-10-23 01:05:36 +02:00
|
|
|
if data[1] == 'offline':
|
|
|
|
self.treestore.remove(iter)
|
|
|
|
if not self.showOffline:
|
2003-10-23 22:31:52 +02:00
|
|
|
self.found = 1
|
2003-10-23 01:05:36 +02:00
|
|
|
else:
|
|
|
|
self.treestore.set_value(iter, 0, self.pixbufs[data[1]])
|
2003-10-23 22:31:52 +02:00
|
|
|
self.found = 1
|
2003-10-23 01:05:36 +02:00
|
|
|
return 1
|
|
|
|
return 0
|
2003-10-22 20:45:13 +02:00
|
|
|
|
|
|
|
def chg_status(self, jid, show, status):
|
2003-10-28 20:37:40 +01:00
|
|
|
u = self.l_contact[jid]['user']
|
2003-10-29 13:58:58 +01:00
|
|
|
if self.l_contact[jid]['iter'] == []:
|
|
|
|
for g in u.groups:
|
|
|
|
if not self.l_group.has_key(g):
|
|
|
|
iterG = self.treestore.append(None, (None, g, 'group'))
|
|
|
|
self.l_group[u.group] = iterG
|
|
|
|
iterU = self.treestore.append(self.l_group[g], (self.pixbufs[show], u.name, u.jid))
|
|
|
|
self.l_contact[u.jid]['iter'].append(iterU)
|
|
|
|
else:
|
|
|
|
if show == 'offline' and not self.showOffline:
|
|
|
|
self.treestore.remove(iter)
|
|
|
|
else:
|
|
|
|
for i in self.l_contact[jid]['iter']:
|
|
|
|
self.treestore.set_value(i, 0, self.pixbufs[show])
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-10-28 00:31:57 +01:00
|
|
|
u.show = show
|
|
|
|
u.status = status
|
2003-10-22 20:45:13 +02:00
|
|
|
|
2003-10-27 17:30:37 +01:00
|
|
|
def mk_menu_c(self, event, iter):
|
2003-10-22 20:45:13 +02:00
|
|
|
self.menu_c = gtk.Menu()
|
2003-10-27 17:30:37 +01:00
|
|
|
item = gtk.MenuItem("Remove")
|
2003-10-22 20:45:13 +02:00
|
|
|
self.menu_c.append(item)
|
2003-10-27 17:30:37 +01:00
|
|
|
item.connect("activate", self.on_req_usub, iter)
|
|
|
|
# item = gtk.MenuItem("user2")
|
|
|
|
# self.menu_c.append(item)
|
2003-10-22 20:45:13 +02:00
|
|
|
self.menu_c.popup(None, None, None, event.button, event.time)
|
|
|
|
self.menu_c.show_all()
|
|
|
|
|
|
|
|
def mk_menu_g(self, event):
|
|
|
|
self.menu_c = gtk.Menu()
|
|
|
|
item = gtk.MenuItem("grp1")
|
|
|
|
self.menu_c.append(item)
|
|
|
|
item = gtk.MenuItem("grp2")
|
|
|
|
self.menu_c.append(item)
|
|
|
|
item = gtk.MenuItem("grp3")
|
|
|
|
self.menu_c.append(item)
|
|
|
|
self.menu_c.popup(None, None, None, event.button, event.time)
|
|
|
|
self.menu_c.show_all()
|
|
|
|
|
|
|
|
def on_treeview_event(self, widget, event):
|
|
|
|
if (event.button == 3) & (event.type == gtk.gdk.BUTTON_PRESS):
|
|
|
|
try:
|
|
|
|
path, column, x, y = self.tree.get_path_at_pos(int(event.x), int(event.y))
|
|
|
|
except TypeError:
|
|
|
|
return
|
|
|
|
iter = self.treestore.get_iter(path)
|
|
|
|
data = self.treestore.get_value(iter, 2)
|
|
|
|
if data == 'group':
|
|
|
|
self.mk_menu_g(event)
|
|
|
|
else:
|
2003-10-27 17:30:37 +01:00
|
|
|
self.mk_menu_c(event, iter)
|
2003-10-22 20:45:13 +02:00
|
|
|
return gtk.TRUE
|
|
|
|
return gtk.FALSE
|
|
|
|
|
2003-10-27 17:30:37 +01:00
|
|
|
def on_req_usub(self, widget, iter):
|
2003-10-28 00:31:57 +01:00
|
|
|
jid = self.treestore.get_value(iter, 2)
|
|
|
|
self.queueOUT.put(('UNSUB', jid))
|
|
|
|
del self.l_contact[jid]
|
2003-10-27 17:30:37 +01:00
|
|
|
self.treestore.remove(iter)
|
|
|
|
|
2003-10-28 00:31:57 +01:00
|
|
|
def req_sub(self, jid, txt):
|
|
|
|
self.queueOUT.put(('SUB', (jid, txt)))
|
|
|
|
if not self.l_contact.has_key(jid):
|
2003-10-29 13:58:58 +01:00
|
|
|
#TODO: sub
|
|
|
|
user1 = user(jid, jid, ['general'], 'requested', 'requested', 'sub')
|
2003-10-27 17:30:37 +01:00
|
|
|
#TODO: ajouter un grp si necessaire
|
2003-10-28 20:37:40 +01:00
|
|
|
iterU = self.treestore.append(self.l_group['general'], (self.pixbufs['requested'], jid, jid))
|
2003-10-29 13:58:58 +01:00
|
|
|
self.l_contact[jid] = {'user':user1, 'iter':[iterU]}
|
2003-10-27 17:30:37 +01:00
|
|
|
|
2003-10-22 20:45:13 +02:00
|
|
|
def on_status_changed(self, widget):
|
|
|
|
self.queueOUT.put(('STATUS',widget.name))
|
2003-10-22 23:23:59 +02:00
|
|
|
|
2003-10-27 17:30:37 +01:00
|
|
|
def on_add(self, widget):
|
|
|
|
window_add = add(self)
|
|
|
|
|
2003-10-22 23:23:59 +02:00
|
|
|
def on_about(self, widget):
|
|
|
|
window_about = about()
|
|
|
|
|
|
|
|
def on_accounts(self, widget):
|
|
|
|
window_accounts = accounts()
|
2003-10-22 20:45:13 +02:00
|
|
|
|
|
|
|
def on_quit(self, widget):
|
|
|
|
self.queueOUT.put(('QUIT',''))
|
|
|
|
gtk.mainquit()
|
|
|
|
|
|
|
|
def on_row_activated(self, widget, path, col):
|
|
|
|
iter = self.treestore.get_iter(path)
|
2003-10-28 00:31:57 +01:00
|
|
|
jid = self.treestore.get_value(iter, 2)
|
2003-10-22 20:45:13 +02:00
|
|
|
if self.tab_messages.has_key(jid):
|
|
|
|
#NE FONCTIONNE PAS !
|
|
|
|
self.tab_messages[jid].window.grab_focus()
|
2003-10-29 13:58:58 +01:00
|
|
|
elif self.l_contact.has_key(jid):
|
2003-10-28 20:37:40 +01:00
|
|
|
self.tab_messages[jid] = message(self.l_contact[jid]['user'], self)
|
2003-10-22 20:45:13 +02:00
|
|
|
|
|
|
|
def __init__(self, queueOUT):
|
|
|
|
#initialisation des variables
|
|
|
|
# FIXME : handle no file ...
|
2003-10-23 20:29:15 +02:00
|
|
|
self.cfgParser = common.optparser.OptionsParser(CONFPATH)
|
|
|
|
self.cfgParser.parseCfgFile()
|
2003-10-22 20:45:13 +02:00
|
|
|
self.xml = gtk.glade.XML('plugins/gtkgui.glade', 'Gajim')
|
|
|
|
self.tree = self.xml.get_widget('treeview')
|
|
|
|
self.treestore = gtk.TreeStore(gtk.gdk.Pixbuf, str, str)
|
|
|
|
add_pixbuf = self.get_icon_pixbuf(gtk.STOCK_ADD)
|
|
|
|
remove_pixbuf = self.get_icon_pixbuf(gtk.STOCK_REMOVE)
|
2003-10-27 17:30:37 +01:00
|
|
|
requested_pixbuf = self.get_icon_pixbuf(gtk.STOCK_QUIT)
|
|
|
|
self.pixbufs = {"online":add_pixbuf, "away":remove_pixbuf, \
|
|
|
|
"xa":remove_pixbuf, "dnd":remove_pixbuf, "offline":remove_pixbuf, \
|
|
|
|
"requested":requested_pixbuf}
|
2003-10-22 20:45:13 +02:00
|
|
|
self.tree.set_model(self.treestore)
|
|
|
|
self.queueOUT = queueOUT
|
|
|
|
self.optionmenu = self.xml.get_widget('optionmenu')
|
|
|
|
self.optionmenu.set_history(6)
|
|
|
|
self.tab_messages = {}
|
2003-10-23 22:31:52 +02:00
|
|
|
|
|
|
|
showOffline = self.cfgParser.GtkGui_showoffline
|
2003-10-23 22:26:22 +02:00
|
|
|
if showOffline :
|
2003-10-23 22:31:52 +02:00
|
|
|
self.showOffline = string.atoi(showOffline)
|
2003-10-23 22:26:22 +02:00
|
|
|
else :
|
2003-10-23 22:31:52 +02:00
|
|
|
self.showOffline = 0
|
2003-10-22 23:23:59 +02:00
|
|
|
|
2003-10-22 20:45:13 +02:00
|
|
|
#colonnes
|
|
|
|
self.col = gtk.TreeViewColumn()
|
|
|
|
render_pixbuf = gtk.CellRendererPixbuf()
|
|
|
|
self.col.pack_start(render_pixbuf, expand = False)
|
2003-10-29 13:58:58 +01:00
|
|
|
self.col.add_attribute(render_pixbuf, 'pixbuf-expander-closed', 0)
|
|
|
|
self.col.add_attribute(render_pixbuf, 'pixbuf-expander-open', 0)
|
2003-10-22 20:45:13 +02:00
|
|
|
render_text = gtk.CellRendererText()
|
|
|
|
self.col.pack_start(render_text, expand = True)
|
|
|
|
self.col.add_attribute(render_text, 'text', 1)
|
|
|
|
self.tree.append_column(self.col)
|
2003-10-22 23:23:59 +02:00
|
|
|
|
|
|
|
#signals
|
2003-10-22 20:45:13 +02:00
|
|
|
self.xml.signal_connect('gtk_main_quit', self.on_quit)
|
2003-10-22 23:23:59 +02:00
|
|
|
self.xml.signal_connect('on_accounts_activate', self.on_accounts)
|
2003-10-27 17:30:37 +01:00
|
|
|
self.xml.signal_connect('on_add_activate', self.on_add)
|
2003-10-22 23:23:59 +02:00
|
|
|
self.xml.signal_connect('on_about_activate', self.on_about)
|
2003-10-22 20:45:13 +02:00
|
|
|
self.xml.signal_connect('on_quit_activate', self.on_quit)
|
|
|
|
self.xml.signal_connect('on_treeview_event', self.on_treeview_event)
|
|
|
|
self.xml.signal_connect('on_status_changed', self.on_status_changed)
|
|
|
|
self.xml.signal_connect('on_row_activated', self.on_row_activated)
|
|
|
|
# self.mk_menu_c()
|
|
|
|
|
|
|
|
class plugin:
|
|
|
|
def read_queue(self):
|
|
|
|
while self.queueIN.empty() == 0:
|
|
|
|
ev = self.queueIN.get()
|
2003-10-27 17:30:37 +01:00
|
|
|
# print ev
|
2003-10-22 20:45:13 +02:00
|
|
|
if ev[0] == 'ROSTER':
|
2003-10-23 01:05:36 +02:00
|
|
|
self.r.mkroster(ev[1])
|
2003-10-22 20:45:13 +02:00
|
|
|
elif ev[0] == 'NOTIFY':
|
2003-10-28 20:37:40 +01:00
|
|
|
if self.r.l_contact.has_key(ev[1][0]):
|
|
|
|
self.r.chg_status(ev[1][0], ev[1][1], ev[1][2])
|
2003-10-22 20:45:13 +02:00
|
|
|
elif ev[0] == 'MSG':
|
|
|
|
if not self.r.tab_messages.has_key(ev[1][0]):
|
2003-10-29 13:58:58 +01:00
|
|
|
#FIXME:message d'un inconne
|
2003-10-28 20:37:40 +01:00
|
|
|
self.r.tab_messages[ev[1][0]] = message(self.r.l_contact[ev[1][0]]['user'], self.r)
|
2003-10-22 20:45:13 +02:00
|
|
|
self.r.tab_messages[ev[1][0]].print_conversation(ev[1][1])
|
2003-10-28 20:37:40 +01:00
|
|
|
elif ev[0] == 'SUBSCRIBED':
|
2003-10-29 13:58:58 +01:00
|
|
|
u = self.r.l_contact[ev[1]['jid']]['user']
|
2003-10-28 20:37:40 +01:00
|
|
|
u.name = ev[1]['nom']
|
2003-10-29 13:58:58 +01:00
|
|
|
for i in self.r.l_contact[u.jid]['iter']:
|
|
|
|
self.r.treestore.set_value(i, 1, u.name)
|
2003-10-22 20:45:13 +02:00
|
|
|
return 1
|
|
|
|
|
|
|
|
def __init__(self, quIN, quOUT):
|
|
|
|
gtk.threads_init()
|
|
|
|
gtk.threads_enter()
|
|
|
|
self.queueIN = quIN
|
|
|
|
self.r = roster(quOUT)
|
|
|
|
self.time = gtk.timeout_add(200, self.read_queue)
|
|
|
|
gtk.main()
|
|
|
|
gtk.threads_leave()
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
plugin(None, None)
|
|
|
|
|
2003-10-23 01:05:36 +02:00
|
|
|
print "plugin gtkgui loaded"
|