pixbufs in groupchat window
exit chatroom when closing the window
This commit is contained in:
parent
2f1648f94f
commit
4ea21d3fce
20
core/core.py
20
core/core.py
|
@ -466,12 +466,6 @@ class GajimCore:
|
||||||
msg.setType('chat')
|
msg.setType('chat')
|
||||||
con.send(msg)
|
con.send(msg)
|
||||||
self.hub.sendPlugin('MSGSENT', ev[1], ev[2])
|
self.hub.sendPlugin('MSGSENT', ev[1], ev[2])
|
||||||
#('GC_MSG', account, (jid, msg))
|
|
||||||
elif ev[0] == 'GC_MSG':
|
|
||||||
msg = common.jabber.Message(ev[2][0], ev[2][1])
|
|
||||||
msg.setType('groupchat')
|
|
||||||
con.send(msg)
|
|
||||||
self.hub.sendPlugin('MSGSENT', ev[1], ev[2])
|
|
||||||
#('SUB', account, (jid, txt))
|
#('SUB', account, (jid, txt))
|
||||||
elif ev[0] == 'SUB':
|
elif ev[0] == 'SUB':
|
||||||
log.debug('subscription request for %s' % ev[2][0])
|
log.debug('subscription request for %s' % ev[2][0])
|
||||||
|
@ -621,6 +615,20 @@ class GajimCore:
|
||||||
p = common.jabber.Presence(to='%s@%s/%s' % (ev[2][1], ev[2][2], \
|
p = common.jabber.Presence(to='%s@%s/%s' % (ev[2][1], ev[2][2], \
|
||||||
ev[2][0]))
|
ev[2][0]))
|
||||||
con.send(p)
|
con.send(p)
|
||||||
|
#('GC_MSG', account, (jid, msg))
|
||||||
|
elif ev[0] == 'GC_MSG':
|
||||||
|
msg = common.jabber.Message(ev[2][0], ev[2][1])
|
||||||
|
msg.setType('groupchat')
|
||||||
|
con.send(msg)
|
||||||
|
self.hub.sendPlugin('MSGSENT', ev[1], ev[2])
|
||||||
|
#('GC_STATUS', account, (nick, jid, show, status))
|
||||||
|
elif ev[0] == 'GC_STATUS':
|
||||||
|
if ev[2][2] == 'offline':
|
||||||
|
con.send(common.jabber.Presence('%s/%s' % (ev[2][1], ev[2][0]), \
|
||||||
|
'unavailable'))
|
||||||
|
else:
|
||||||
|
con.send(common.jabber.Presence('%s/%s' % (ev[2][1], ev[2][0]), \
|
||||||
|
'available', show=ev[2][2], status = ev[2][3]))
|
||||||
else:
|
else:
|
||||||
log.debug(_("Unknown Command %s") % ev[0])
|
log.debug(_("Unknown Command %s") % ev[0])
|
||||||
if self.mode == 'server':
|
if self.mode == 'server':
|
||||||
|
|
|
@ -301,6 +301,8 @@ class message_Window:
|
||||||
class gc:
|
class gc:
|
||||||
def delete_event(self, widget):
|
def delete_event(self, widget):
|
||||||
"""close window"""
|
"""close window"""
|
||||||
|
self.plugin.send('GC_STATUS', self.account, (self.nick, self.jid,\
|
||||||
|
'offline', 'offline'))
|
||||||
del self.plugin.windows[self.account]['gc'][self.jid]
|
del self.plugin.windows[self.account]['gc'][self.jid]
|
||||||
|
|
||||||
def on_close(self, widget):
|
def on_close(self, widget):
|
||||||
|
@ -313,23 +315,34 @@ class gc:
|
||||||
if not iter:
|
if not iter:
|
||||||
return None
|
return None
|
||||||
while iter:
|
while iter:
|
||||||
if nick == model.get_value(iter, 0):
|
if nick == model.get_value(iter, 1):
|
||||||
return iter
|
return iter
|
||||||
iter = model.iter_next(iter)
|
iter = model.iter_next(iter)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def add_user_to_roster(self, nick):
|
def remove_user(self, nick):
|
||||||
|
"""Remove a user from the roster"""
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
model.append(None, (nick,))
|
iter = self.get_user_iter(nick)
|
||||||
|
model.remove(iter)
|
||||||
|
|
||||||
|
def add_user_to_roster(self, nick, show):
|
||||||
|
model = self.tree.get_model()
|
||||||
|
img = self.plugin.roster.pixbufs[show]
|
||||||
|
return model.append(None, (img, nick))
|
||||||
|
|
||||||
def chg_user_status(self, nick, show, status, account):
|
def chg_user_status(self, nick, show, status, account):
|
||||||
"""When a user change his status"""
|
"""When a user change his status"""
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
if show == 'offline' or show == 'error':
|
if show == 'offline' or show == 'error':
|
||||||
self.remove_user(user, account)
|
self.remove_user(nick)
|
||||||
else:
|
else:
|
||||||
if not self.get_user_iter(nick):
|
iter = self.get_user_iter(nick)
|
||||||
self.add_user_to_roster(nick)
|
if not iter:
|
||||||
|
iter = self.add_user_to_roster(nick, show)
|
||||||
|
else:
|
||||||
|
img = self.plugin.roster.pixbufs[show]
|
||||||
|
model.set_value(iter, 0, img)
|
||||||
# u = self.contacts[account][user.jid]
|
# u = self.contacts[account][user.jid]
|
||||||
# u.show = show
|
# u.show = show
|
||||||
# u.status = status
|
# u.status = status
|
||||||
|
@ -388,10 +401,26 @@ class gc:
|
||||||
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Gc', APP)
|
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Gc', APP)
|
||||||
self.window = self.xml.get_widget('Gc')
|
self.window = self.xml.get_widget('Gc')
|
||||||
self.tree = self.xml.get_widget('list')
|
self.tree = self.xml.get_widget('list')
|
||||||
store = gtk.TreeStore(str)
|
|
||||||
column = gtk.TreeViewColumn('contacts', gtk.CellRendererText(), text=0)
|
store = gtk.TreeStore(gtk.Image, str)
|
||||||
|
column = gtk.TreeViewColumn('contacts')#, ImageCellRenderer(), image=0)
|
||||||
|
render_text = ImageCellRenderer()
|
||||||
|
column.pack_start(render_text, expand = False)
|
||||||
|
column.add_attribute(render_text, 'image', 0)
|
||||||
|
render_text = gtk.CellRendererText()
|
||||||
|
column.pack_start(render_text, expand = True)
|
||||||
|
column.add_attribute(render_text, 'text', 1)
|
||||||
|
|
||||||
self.tree.append_column(column)
|
self.tree.append_column(column)
|
||||||
self.tree.set_model(store)
|
self.tree.set_model(store)
|
||||||
|
|
||||||
|
col = gtk.TreeViewColumn()
|
||||||
|
render = gtk.CellRendererPixbuf()
|
||||||
|
col.pack_start(render, expand = False)
|
||||||
|
self.tree.append_column(col)
|
||||||
|
col.set_visible(FALSE)
|
||||||
|
self.tree.set_expander_column(col)
|
||||||
|
|
||||||
conversation = self.xml.get_widget('conversation')
|
conversation = self.xml.get_widget('conversation')
|
||||||
buffer = conversation.get_buffer()
|
buffer = conversation.get_buffer()
|
||||||
end_iter = buffer.get_end_iter()
|
end_iter = buffer.get_end_iter()
|
||||||
|
|
Loading…
Reference in New Issue