we can change nick by IRC command too (/nick foo); input dialog also has get_response() now
This commit is contained in:
parent
63812878f2
commit
daacc7334d
|
@ -1042,7 +1042,7 @@ class Connection:
|
||||||
to = room_jid)
|
to = room_jid)
|
||||||
self.connection.send(iq)
|
self.connection.send(iq)
|
||||||
|
|
||||||
def change_gc_nick(self, nick, room_jid):
|
def change_gc_nick(self, room_jid, nick):
|
||||||
if not self.connection:
|
if not self.connection:
|
||||||
return
|
return
|
||||||
self.connection.send(common.xmpp.Presence(to = '%s/%s' % (room_jid,
|
self.connection.send(common.xmpp.Presence(to = '%s/%s' % (room_jid,
|
||||||
|
|
|
@ -498,6 +498,11 @@ class InputDialog:
|
||||||
self.input_entry.set_text(input_str)
|
self.input_entry.set_text(input_str)
|
||||||
self.input_entry.select_region(0, -1) # select all
|
self.input_entry.select_region(0, -1) # select all
|
||||||
|
|
||||||
|
def get_response(self):
|
||||||
|
response = self.dialog.run()
|
||||||
|
self.dialog.destroy()
|
||||||
|
return response
|
||||||
|
|
||||||
class ErrorDialog(HigDialog):
|
class ErrorDialog(HigDialog):
|
||||||
def __init__(self, pritext, sectext=''):
|
def __init__(self, pritext, sectext=''):
|
||||||
"""HIG compliant error dialog."""
|
"""HIG compliant error dialog."""
|
||||||
|
@ -710,12 +715,12 @@ _('Without a connection, you can not change your password.')).get_response()
|
||||||
if rep == gtk.RESPONSE_OK:
|
if rep == gtk.RESPONSE_OK:
|
||||||
password1 = self.password1_entry.get_text()
|
password1 = self.password1_entry.get_text()
|
||||||
if not password1:
|
if not password1:
|
||||||
ErrorDialog(_('Invalid password.'), \
|
ErrorDialog(_('Invalid password.'),
|
||||||
_('You must enter a password.')).get_response()
|
_('You must enter a password.')).get_response()
|
||||||
continue
|
continue
|
||||||
password2 = self.password2_entry.get_text()
|
password2 = self.password2_entry.get_text()
|
||||||
if password1 != password2:
|
if password1 != password2:
|
||||||
ErrorDialog(_("Passwords don't match."), \
|
ErrorDialog(_("Passwords don't match."),
|
||||||
_('The passwords typed in both fields must be identical.')).get_response()
|
_('The passwords typed in both fields must be identical.')).get_response()
|
||||||
continue
|
continue
|
||||||
message = password1
|
message = password1
|
||||||
|
|
|
@ -274,7 +274,7 @@ class GroupchatWindow(chat.Chat):
|
||||||
elif statusCode == '303': # Someone changed his nick
|
elif statusCode == '303': # Someone changed his nick
|
||||||
self.print_conversation(_('%s is now known as %s') % (nick,
|
self.print_conversation(_('%s is now known as %s') % (nick,
|
||||||
new_nick), room_jid)
|
new_nick), room_jid)
|
||||||
if nick == self.nicks[room_jid]: # We changed out nick
|
if nick == self.nicks[room_jid]: # We changed our nick
|
||||||
self.nicks[room_jid] = new_nick
|
self.nicks[room_jid] = new_nick
|
||||||
self.remove_user(room_jid, nick)
|
self.remove_user(room_jid, nick)
|
||||||
if nick == self.nicks[room_jid] and statusCode != '303': # We became offline
|
if nick == self.nicks[room_jid] and statusCode != '303': # We became offline
|
||||||
|
@ -317,13 +317,11 @@ class GroupchatWindow(chat.Chat):
|
||||||
|
|
||||||
def on_change_subject_menuitem_activate(self, widget):
|
def on_change_subject_menuitem_activate(self, widget):
|
||||||
room_jid = self.get_active_jid()
|
room_jid = self.get_active_jid()
|
||||||
# I don't know how this works with markup... Let's find out!
|
|
||||||
label_text = self.name_labels[room_jid].get_text() # whole text (including JID)
|
label_text = self.name_labels[room_jid].get_text() # whole text (including JID)
|
||||||
subject = label_text[label_text.find('\n') + 1:] # just the text after the newline *shrug*
|
subject = label_text[label_text.find('\n') + 1:] # just the text after the newline
|
||||||
instance = dialogs.InputDialog(_('Changing the Subject'),
|
instance = dialogs.InputDialog(_('Changing the Subject'),
|
||||||
_('Please specify the new subject:'), subject)
|
_('Please specify the new subject:'), subject)
|
||||||
response = instance.dialog.run()
|
response = instance.get_response()
|
||||||
instance.dialog.destroy()
|
|
||||||
if response == gtk.RESPONSE_OK:
|
if response == gtk.RESPONSE_OK:
|
||||||
subject = instance.input_entry.get_text()
|
subject = instance.input_entry.get_text()
|
||||||
gajim.connections[self.account].send_gc_subject(room_jid, subject)
|
gajim.connections[self.account].send_gc_subject(room_jid, subject)
|
||||||
|
@ -331,13 +329,12 @@ class GroupchatWindow(chat.Chat):
|
||||||
def on_change_nick_menuitem_activate(self, widget):
|
def on_change_nick_menuitem_activate(self, widget):
|
||||||
room_jid = self.get_active_jid()
|
room_jid = self.get_active_jid()
|
||||||
nick = self.nicks[room_jid]
|
nick = self.nicks[room_jid]
|
||||||
instance = dialogs.InputDialog(_('Changing out Nickname'),
|
instance = dialogs.InputDialog(_('Changing our Nickname'),
|
||||||
_('Please specify the new nickname you want to use:'), nick)
|
_('Please specify the new nickname you want to use:'), nick)
|
||||||
response = instance.dialog.run()
|
response = response = instance.get_response()
|
||||||
instance.dialog.destroy()
|
|
||||||
if response == gtk.RESPONSE_OK:
|
if response == gtk.RESPONSE_OK:
|
||||||
nick = instance.input_entry.get_text()
|
nick = instance.input_entry.get_text()
|
||||||
gajim.connections[self.account].change_gc_nick(nick, room_jid)
|
gajim.connections[self.account].change_gc_nick(room_jid, nick)
|
||||||
|
|
||||||
def on_configure_room_menuitem_activate(self, widget):
|
def on_configure_room_menuitem_activate(self, widget):
|
||||||
room_jid = self.get_active_jid()
|
room_jid = self.get_active_jid()
|
||||||
|
@ -505,6 +502,12 @@ class GroupchatWindow(chat.Chat):
|
||||||
other_tags_for_name.append('bold')
|
other_tags_for_name.append('bold')
|
||||||
other_tags_for_text.append('marked')
|
other_tags_for_text.append('marked')
|
||||||
|
|
||||||
|
if text.startswith('/nick '):
|
||||||
|
new_nick = text[6:]
|
||||||
|
if len(new_nick.split()) == 1: #dont accept /nick foo bar
|
||||||
|
gajim.connections[self.account].change_gc_nick(room_jid, new_nick)
|
||||||
|
return False
|
||||||
|
|
||||||
chat.Chat.print_conversation_line(self, text, room_jid, kind, contact,
|
chat.Chat.print_conversation_line(self, text, room_jid, kind, contact,
|
||||||
tim, other_tags_for_name, [], other_tags_for_text)
|
tim, other_tags_for_name, [], other_tags_for_text)
|
||||||
|
|
||||||
|
|
|
@ -10817,7 +10817,6 @@ JID: whatever@jabber.org</property>
|
||||||
<property name="skip_pager_hint">False</property>
|
<property name="skip_pager_hint">False</property>
|
||||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||||
<property name="has_separator">True</property>
|
|
||||||
|
|
||||||
<child internal-child="vbox">
|
<child internal-child="vbox">
|
||||||
<widget class="GtkVBox" id="dialog-vbox8">
|
<widget class="GtkVBox" id="dialog-vbox8">
|
||||||
|
@ -10959,7 +10958,7 @@ JID: whatever@jabber.org</property>
|
||||||
<widget class="GtkLabel" id="label212">
|
<widget class="GtkLabel" id="label212">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes">Enter the user ID of the contact you would like to
|
<property name="label" translatable="yes">Enter the user ID of the contact you would like to
|
||||||
send a chat message to</property>
|
send a chat message to:</property>
|
||||||
<property name="use_underline">False</property>
|
<property name="use_underline">False</property>
|
||||||
<property name="use_markup">False</property>
|
<property name="use_markup">False</property>
|
||||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
@ -15290,7 +15289,7 @@ the Jabber network.</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkImageMenuItem" id="change_nick_menuitem">
|
<widget class="GtkImageMenuItem" id="change_nick_menuitem">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes">Change _Nick</property>
|
<property name="label" translatable="yes">Change _Nickname</property>
|
||||||
<property name="use_underline">True</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"/>
|
<signal name="activate" handler="on_change_nick_menuitem_activate" last_modification_time="Sat, 18 Jun 2005 20:23:46 GMT"/>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue