we now have private messages ! (TODO: update the chat window when the contact change his status)
This commit is contained in:
parent
80c1dc36f2
commit
0c79775f5a
|
@ -313,7 +313,8 @@ class Chat:
|
|||
if self.widget_name == 'tabbed_chat_window':
|
||||
xm = gtk.glade.XML(GTKGUI_GLADE, 'chat_tab_hbox', APP)
|
||||
tab_hbox = xm.get_widget('chat_tab_hbox')
|
||||
user = self.plugin.roster.contacts[self.account][jid][0]
|
||||
# user = self.plugin.roster.contacts[self.account][jid][0]
|
||||
user = self.users[jid]
|
||||
gtklabel = gtk.Label(user.name)
|
||||
gtklabel.set_property('xalign', 0)
|
||||
elif self.widget_name == 'groupchat_window':
|
||||
|
|
20
src/gajim.py
20
src/gajim.py
|
@ -331,6 +331,8 @@ class Interface:
|
|||
|
||||
elif self.windows[account]['gc'].has_key(ji):
|
||||
#it is a groupchat presence
|
||||
#TODO: upgrade the chat instavces (for pm)
|
||||
fjid = array[0] + '/' + array[3]
|
||||
self.windows[account]['gc'][ji].chg_user_status(ji, resource,
|
||||
array[1], array[2], array[6], array[7], array[8], array[9],
|
||||
array[10], array[11], account)
|
||||
|
@ -340,6 +342,24 @@ class Interface:
|
|||
jid = array[0].split('/')[0]
|
||||
if jid.find('@') <= 0:
|
||||
jid = jid.replace('@', '')
|
||||
|
||||
if self.windows[account]['gc'].has_key(jid): # it's a Private Message
|
||||
nick = array[0].split('/', 1)[1]
|
||||
fjid = jid + '/' + nick
|
||||
if not self.windows[account]['chats'].has_key(fjid):
|
||||
gc = self.windows[account]['gc'][jid]
|
||||
tv = gc.list_treeview[jid]
|
||||
model = tv.get_model()
|
||||
iter = gc.get_user_iter(jid, nick)
|
||||
show = model.get_value(iter, 3)
|
||||
u = User(fjid, nick, ['none'], show, '', 'none', None, '', 0,
|
||||
'')
|
||||
self.roster.new_chat(u, account)
|
||||
chat_win = self.windows[account]['chats'][fjid]
|
||||
chat_win.print_conversation(array[1], fjid, tim = array[2])
|
||||
return
|
||||
|
||||
|
||||
if gajim.config.get('ignore_unknown_contacts') and \
|
||||
not self.roster.contacts[account].has_key(jid):
|
||||
return
|
||||
|
|
|
@ -25,6 +25,7 @@ import time
|
|||
import dialogs
|
||||
import chat
|
||||
import cell_renderer_image
|
||||
from gajim import User
|
||||
from common import gajim
|
||||
from common import i18n
|
||||
|
||||
|
@ -545,7 +546,7 @@ class Groupchat_window(chat.Chat):
|
|||
'subject_entry')
|
||||
self.subject_entry_tooltip[room_jid] = gtk.Tooltips()
|
||||
|
||||
#status_image, nickname, real_jid, status
|
||||
#status_image, nickname, real_jid, show
|
||||
store = gtk.TreeStore(gtk.Image, str, str, str)
|
||||
store.set_sort_column_id(1, gtk.SORT_ASCENDING)
|
||||
column = gtk.TreeViewColumn('contacts')
|
||||
|
@ -620,11 +621,22 @@ class Groupchat_window(chat.Chat):
|
|||
"""When an iter is double clicked: open the chat window"""
|
||||
model = widget.get_model()
|
||||
iter = model.get_iter(path)
|
||||
if len(path) == 1:
|
||||
if len(path) == 1: # It's a group
|
||||
if (widget.row_expanded(path)):
|
||||
widget.collapse_row(path)
|
||||
else:
|
||||
widget.expand_row(path, False)
|
||||
else: # We want to send a private message
|
||||
room_jid = self.get_active_jid()
|
||||
nick = model.get_value(iter, 1)
|
||||
fjid = room_jid + '/' + nick
|
||||
if not self.plugin.windows[self.account]['chats'].has_key(fjid):
|
||||
show = model.get_value(iter, 3)
|
||||
u = User(fjid, nick, ['none'], show, '', 'none', None, '', 0,
|
||||
'')
|
||||
self.plugin.roster.new_chat(u, self.account)
|
||||
self.plugin.windows[self.account]['chats'][fjid].set_active_tab(fjid)
|
||||
self.plugin.windows[self.account]['chats'][fjid].window.present()
|
||||
|
||||
def on_list_treeview_row_expanded(self, widget, iter, path):
|
||||
"""When a row is expanded: change the icon of the arrow"""
|
||||
|
|
|
@ -92,7 +92,10 @@ class Tabbed_chat_window(chat.Chat):
|
|||
|
||||
def set_state_image(self, jid):
|
||||
prio = 0
|
||||
list_users = self.plugin.roster.contacts[self.account][jid]
|
||||
if self.plugin.roster.contacts[self.account].has_key(jid):
|
||||
list_users = self.plugin.roster.contacts[self.account][jid]
|
||||
else:
|
||||
list_users = [self.users[jid]]
|
||||
user = list_users[0]
|
||||
show = user.show
|
||||
jid = user.jid
|
||||
|
@ -180,10 +183,10 @@ class Tabbed_chat_window(chat.Chat):
|
|||
self.names[user.jid] = user.name
|
||||
self.xmls[user.jid] = gtk.glade.XML(GTKGUI_GLADE, 'chats_vbox', APP)
|
||||
self.childs[user.jid] = self.xmls[user.jid].get_widget('chats_vbox')
|
||||
chat.Chat.new_tab(self, user.jid)
|
||||
self.users[user.jid] = user
|
||||
self.encrypted[user.jid] = False
|
||||
|
||||
chat.Chat.new_tab(self, user.jid)
|
||||
self.redraw_tab(user.jid)
|
||||
self.draw_widgets(user)
|
||||
|
||||
|
|
Loading…
Reference in New Issue