we now have option in case abc@doremi.org is not an email and it is jid (we can add it to roster, we can chat to it, we can join group chat). Most of the patch is done by neurocyte
This commit is contained in:
parent
39ee13f5ac
commit
c7f8486e8c
36
src/chat.py
36
src/chat.py
|
@ -653,6 +653,27 @@ class Chat:
|
|||
clip = gtk.clipboard_get()
|
||||
clip.set_text(text)
|
||||
|
||||
def on_start_chat_activate(self, widget, jid):
|
||||
self.plugin.roster.new_chat_from_jid(self.account, jid)
|
||||
|
||||
def on_join_group_chat_menuitem_activate(self, widget, jid):
|
||||
server, room = jid.split('@')
|
||||
if self.plugin.windows[self.account].has_key('join_gc'):
|
||||
instance = self.plugin.windows[self.account]['join_gc']
|
||||
print instance.xml
|
||||
instance.xml.get_widget('server_entry').set_text(server)
|
||||
instance.xml.get_widget('room_entry').set_text(room)
|
||||
self.plugin.windows[self.account]['join_gc'].window.present()
|
||||
else:
|
||||
try:
|
||||
self.plugin.windows[self.account]['join_gc'] = \
|
||||
dialogs.JoinGroupchatWindow(self.plugin, self.account, server, room)
|
||||
except RuntimeError:
|
||||
pass
|
||||
|
||||
def on_add_to_roster_activate(self, widget, jid):
|
||||
dialogs.AddNewContactWindow(self.plugin, self.account, jid)
|
||||
|
||||
def make_link_menu(self, event, kind, text):
|
||||
xml = gtk.glade.XML(GTKGUI_GLADE, 'chat_context_menu', APP)
|
||||
menu = xml.get_widget('chat_context_menu')
|
||||
|
@ -662,9 +683,22 @@ class Chat:
|
|||
childs[1].connect('activate', self.on_open_link_activate, kind, text)
|
||||
childs[2].hide() # copy mail address
|
||||
childs[3].hide() # open mail composer
|
||||
else: # It's a mail
|
||||
childs[4].hide() # jid section seperator
|
||||
childs[5].hide() # start chat
|
||||
childs[6].hide() # add to roster
|
||||
else: # It's a mail or a JID
|
||||
childs[2].connect('activate', self.on_copy_link_activate, text)
|
||||
childs[3].connect('activate', self.on_open_link_activate, kind, text)
|
||||
childs[5].connect('activate', self.on_start_chat_activate, text)
|
||||
childs[6].connect('activate',
|
||||
self.on_join_group_chat_menuitem_activate, text)
|
||||
if self.plugin.roster.contacts[self.account].has_key(text):
|
||||
#and\#FIXME: check if it's in 'not in the roster' and then don't hide
|
||||
#not self.plugin.roster.contacts[self.account][text].show == 'not in the roster':
|
||||
childs[7].hide()
|
||||
else:
|
||||
childs[7].connect('activate', self.on_add_to_roster_activate, text)
|
||||
childs[7].show()
|
||||
childs[0].hide() # copy link location
|
||||
childs[1].hide() # open link in browser
|
||||
|
||||
|
|
|
@ -580,7 +580,7 @@ _('You can not join a group chat unless you are connected.')).get_response()
|
|||
our_jid = gajim.config.get_per('accounts', self.account, 'name') + '@' + \
|
||||
gajim.config.get_per('accounts', self.account, 'hostname')
|
||||
if len(gajim.connections) > 1:
|
||||
title = _('Join Groupchat as ') + our_jid
|
||||
title = _('Join Groupchat as %s') % our_jid
|
||||
else:
|
||||
title = _('Join Groupchat')
|
||||
self.window.set_title(title)
|
||||
|
@ -594,7 +594,7 @@ _('You can not join a group chat unless you are connected.')).get_response()
|
|||
self.recently_groupchat = gajim.config.get('recently_groupchat').split()
|
||||
for g in self.recently_groupchat:
|
||||
self.recently_combobox.append_text(g)
|
||||
if len(self.recently_groupchat):
|
||||
if len(self.recently_groupchat) and server == '' and room == '':
|
||||
self.recently_combobox.set_active(0)
|
||||
self.xml.get_widget('room_entry').select_region(0, -1)
|
||||
|
||||
|
@ -660,26 +660,7 @@ class NewMessageDialog:
|
|||
_('Contact ID must be of the form "username@servername".')).get_response()
|
||||
return
|
||||
|
||||
# use Contact class, new_chat expects it that way
|
||||
# is it in the roster?
|
||||
if self.plugin.roster.contacts[self.account].has_key(jid):
|
||||
user = self.plugin.roster.contacts[self.account][jid][0]
|
||||
else:
|
||||
keyID = ''
|
||||
attached_keys = gajim.config.get_per('accounts', self.account,
|
||||
'attached_gpg_keys').split()
|
||||
if jid in attached_keys:
|
||||
keyID = attached_keys[attached_keys.index(jid) + 1]
|
||||
user = Contact(jid = jid, name = jid.split('@')[0],
|
||||
groups = ['not in the roster'], show = 'not in the roster',
|
||||
status = 'not in the roster', sub = 'none', keyID = keyID)
|
||||
self.plugin.roster.contacts[self.account][jid] = [user]
|
||||
self.plugin.roster.add_user_to_roster(user.jid, self.account)
|
||||
|
||||
if not self.plugin.windows[self.account]['chats'].has_key(jid):
|
||||
self.plugin.roster.new_chat(user, self.account)
|
||||
self.plugin.windows[self.account]['chats'][jid].set_active_tab(jid)
|
||||
self.plugin.windows[self.account]['chats'][jid].window.present()
|
||||
self.plugin.roster.new_chat_from_jid(self.account, jid)
|
||||
|
||||
class ChangePasswordDialog:
|
||||
def __init__(self, plugin, account):
|
||||
|
|
|
@ -12023,7 +12023,7 @@ JID: whatever@jabber.org</property>
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image593">
|
||||
<widget class="GtkImage" id="image737">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-copy</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -12043,7 +12043,7 @@ JID: whatever@jabber.org</property>
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image594">
|
||||
<widget class="GtkImage" id="image738">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-jump-to</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -12063,7 +12063,7 @@ JID: whatever@jabber.org</property>
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image595">
|
||||
<widget class="GtkImage" id="image739">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-copy</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -12083,7 +12083,7 @@ JID: whatever@jabber.org</property>
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image596">
|
||||
<widget class="GtkImage" id="image740">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-jump-to</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -12095,6 +12095,73 @@ JID: whatever@jabber.org</property>
|
|||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="jid_section_separator">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="start_chat_menuitem">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Start Chat</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image741">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-jump-to</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="join_group_chat_menuitem">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Join _Group Chat</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_join_group_chat_menuitem_activate" last_modification_time="Thu, 30 Jun 2005 16:13:06 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image742">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-connect</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="add_to_roster_menuitem">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Add to Roster</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image743">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget class="GtkWindow" id="wizard_window">
|
||||
|
|
|
@ -1251,6 +1251,26 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
|||
self.plugin.windows[account]['chats'][user.jid] = \
|
||||
tabbed_chat_window.TabbedChatWindow(user, self.plugin, account)
|
||||
|
||||
def new_chat_from_jid(self, account, jid):
|
||||
if self.contacts[account].has_key(jid):
|
||||
user = self.contacts[account][jid][0]
|
||||
else:
|
||||
keyID = ''
|
||||
attached_keys = gajim.config.get_per('accounts', account,
|
||||
'attached_gpg_keys').split()
|
||||
if jid in attached_keys:
|
||||
keyID = attached_keys[attached_keys.index(jid) + 1]
|
||||
user = Contact(jid = jid, name = jid.split('@')[0],
|
||||
groups = ['not in the roster'], show = 'not in the roster',
|
||||
status = 'not in the roster', sub = 'none', keyID = keyID)
|
||||
self.contacts[account][jid] = [user]
|
||||
self.add_user_to_roster(user.jid, account)
|
||||
|
||||
if not self.plugin.windows[account]['chats'].has_key(jid):
|
||||
self.new_chat(user, account)
|
||||
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
||||
self.plugin.windows[account]['chats'][jid].window.present()
|
||||
|
||||
def new_room(self, jid, nick, account):
|
||||
if gajim.config.get('usetabbedchat'):
|
||||
if not self.plugin.windows[account]['gc'].has_key('tabbed'):
|
||||
|
|
Loading…
Reference in New Issue