we can now change our nick in gc
This commit is contained in:
parent
71e06b9606
commit
87f1dbcac8
|
@ -313,7 +313,7 @@ class Connection:
|
|||
self.dispatch('NOTIFY', ( account, show, status,
|
||||
resource, prio, keyID, prs.getRole(),
|
||||
prs.getAffiliation(), prs.getJid(), prs.getReason(),
|
||||
prs.getActor(), prs.getStatusCode()))
|
||||
prs.getActor(), prs.getStatusCode(), prs.getNewNick()))
|
||||
# END presenceCB
|
||||
|
||||
def _disconnectedCB(self):
|
||||
|
@ -1041,6 +1041,12 @@ class Connection:
|
|||
iq = common.xmpp.Iq(typ = 'get', queryNS = common.xmpp.NS_MUC_OWNER,
|
||||
to = room_jid)
|
||||
self.connection.send(iq)
|
||||
|
||||
def change_gc_nick(self, nick, room_jid):
|
||||
if not self.connection:
|
||||
return
|
||||
self.connection.send(common.xmpp.Presence(to = '%s/%s' % (room_jid,
|
||||
nick)))
|
||||
|
||||
def send_gc_status(self, nick, jid, show, status):
|
||||
if not self.connection:
|
||||
|
|
|
@ -425,6 +425,9 @@ class Presence(Protocol):
|
|||
def getAffiliation(self):
|
||||
"""Returns the presence affiliation (for groupchat)"""
|
||||
return self._muc_getItemAttr('item','affiliation')
|
||||
def getNewNick(self):
|
||||
"""Returns the status code of the presence (for groupchat)"""
|
||||
return self._muc_getItemAttr('item','nick')
|
||||
def getJid(self):
|
||||
"""Returns the presence jid (for groupchat)"""
|
||||
return self._muc_getItemAttr('item','jid')
|
||||
|
|
|
@ -217,7 +217,7 @@ class Interface:
|
|||
|
||||
def handle_event_notify(self, account, array):
|
||||
#('NOTIFY', account, (jid, status, message, resource, priority, keyID,
|
||||
# role, affiliation, real_jid, reason, actor, statusCode))
|
||||
# role, affiliation, real_jid, reason, actor, statusCode, new_nick))
|
||||
statuss = ['offline', 'error', 'online', 'chat', 'away', 'xa', 'dnd', 'invisible']
|
||||
old_show = 0
|
||||
new_show = statuss.index(array[1])
|
||||
|
@ -335,7 +335,7 @@ class Interface:
|
|||
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)
|
||||
array[10], array[11], array[12], account)
|
||||
|
||||
def handle_event_msg(self, account, array):
|
||||
#('MSG', account, (user, msg, time, encrypted))
|
||||
|
|
|
@ -262,7 +262,7 @@ class GroupchatWindow(chat.Chat):
|
|||
role_iter = model.iter_next(role_iter)
|
||||
|
||||
def chg_user_status(self, room_jid, nick, show, status, role, affiliation, \
|
||||
jid, reason, actor, statusCode, account):
|
||||
jid, reason, actor, statusCode, new_nick, account):
|
||||
"""When a user changes his status"""
|
||||
if not role:
|
||||
role = 'visitor'
|
||||
|
@ -271,8 +271,13 @@ class GroupchatWindow(chat.Chat):
|
|||
if statusCode == '307':
|
||||
self.print_conversation(_('%s has been kicked by %s: %s') % (nick,
|
||||
actor, reason), room_jid)
|
||||
elif statusCode == '303': # Someone changed his nick
|
||||
self.print_conversation(_('%s is now known as %s') % (nick,
|
||||
new_nick), room_jid)
|
||||
if nick == self.nicks[room_jid]: # We changed out nick
|
||||
self.nicks[room_jid] = new_nick
|
||||
self.remove_user(room_jid, nick)
|
||||
if nick == self.nicks[room_jid]: # We became offline
|
||||
if nick == self.nicks[room_jid] and statusCode != '303': # We became offline
|
||||
model.clear()
|
||||
else:
|
||||
iter = self.get_user_iter(room_jid, nick)
|
||||
|
@ -293,7 +298,7 @@ class GroupchatWindow(chat.Chat):
|
|||
model.set_value(iter, 0, image)
|
||||
model.set_value(iter, 3, show)
|
||||
if (time.time() - self.room_creation[room_jid]) > 30 and \
|
||||
nick != self.nicks[room_jid]:
|
||||
nick != self.nicks[room_jid] and statusCode != '303':
|
||||
if show == 'offline':
|
||||
st = _('%s has left') % nick
|
||||
else:
|
||||
|
@ -323,6 +328,17 @@ class GroupchatWindow(chat.Chat):
|
|||
subject = instance.input_entry.get_text()
|
||||
gajim.connections[self.account].send_gc_subject(room_jid, subject)
|
||||
|
||||
def on_change_nick_menuitem_activate(self, widget):
|
||||
room_jid = self.get_active_jid()
|
||||
nick = self.nicks[room_jid]
|
||||
instance = dialogs.InputDialog(_('Changing out Nickname'),
|
||||
_('Please specify the new nickname you want to use:'), nick)
|
||||
response = instance.dialog.run()
|
||||
instance.dialog.destroy()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
nick = instance.input_entry.get_text()
|
||||
gajim.connections[self.account].change_gc_nick(nick, room_jid)
|
||||
|
||||
def on_configure_room_menuitem_activate(self, widget):
|
||||
room_jid = self.get_active_jid()
|
||||
gajim.connections[self.account].request_gc_config(room_jid)
|
||||
|
@ -345,7 +361,7 @@ class GroupchatWindow(chat.Chat):
|
|||
|
||||
gajim.connections[self.account].bookmarks.append(bm)
|
||||
gajim.connections[self.account].store_bookmarks()
|
||||
|
||||
|
||||
self.plugin.roster.make_menu()
|
||||
|
||||
dialogs.InformationDialog(
|
||||
|
|
|
@ -15253,7 +15253,7 @@ the Jabber network.</property>
|
|||
<signal name="activate" handler="on_configure_room_menuitem_activate" last_modification_time="Mon, 13 Jun 2005 11:04:55 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image684">
|
||||
<widget class="GtkImage" id="image691">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-properties</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -15274,7 +15274,7 @@ the Jabber network.</property>
|
|||
<signal name="activate" handler="on_change_subject_menuitem_activate" last_modification_time="Mon, 13 Jun 2005 11:05:10 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image685">
|
||||
<widget class="GtkImage" id="image692">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-edit</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -15287,6 +15287,27 @@ the Jabber network.</property>
|
|||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="change_nick_menuitem">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Change _Nick</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_change_nick_menuitem_activate" last_modification_time="Sat, 18 Jun 2005 20:23:46 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image693">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-media-next</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="bookmark_room_menuitem">
|
||||
<property name="visible">True</property>
|
||||
|
@ -15295,7 +15316,7 @@ the Jabber network.</property>
|
|||
<signal name="activate" handler="on_bookmark_room_menuitem_activate" last_modification_time="Mon, 13 Jun 2005 12:43:29 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image686">
|
||||
<widget class="GtkImage" id="image694">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
|
Loading…
Reference in New Issue