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)
|
||||
self.connection.send(iq)
|
||||
|
||||
def change_gc_nick(self, nick, room_jid):
|
||||
def change_gc_nick(self, room_jid, nick):
|
||||
if not self.connection:
|
||||
return
|
||||
self.connection.send(common.xmpp.Presence(to = '%s/%s' % (room_jid,
|
||||
|
|
|
@ -496,7 +496,12 @@ class InputDialog:
|
|||
label.set_text(label_str)
|
||||
if 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):
|
||||
def __init__(self, pritext, sectext=''):
|
||||
|
@ -710,12 +715,12 @@ _('Without a connection, you can not change your password.')).get_response()
|
|||
if rep == gtk.RESPONSE_OK:
|
||||
password1 = self.password1_entry.get_text()
|
||||
if not password1:
|
||||
ErrorDialog(_('Invalid password.'), \
|
||||
ErrorDialog(_('Invalid password.'),
|
||||
_('You must enter a password.')).get_response()
|
||||
continue
|
||||
password2 = self.password2_entry.get_text()
|
||||
if password1 != password2:
|
||||
ErrorDialog(_("Passwords don't match."), \
|
||||
ErrorDialog(_("Passwords don't match."),
|
||||
_('The passwords typed in both fields must be identical.')).get_response()
|
||||
continue
|
||||
message = password1
|
||||
|
|
|
@ -274,7 +274,7 @@ class GroupchatWindow(chat.Chat):
|
|||
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
|
||||
if nick == self.nicks[room_jid]: # We changed our nick
|
||||
self.nicks[room_jid] = new_nick
|
||||
self.remove_user(room_jid, nick)
|
||||
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):
|
||||
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)
|
||||
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'),
|
||||
_('Please specify the new subject:'), subject)
|
||||
response = instance.dialog.run()
|
||||
instance.dialog.destroy()
|
||||
response = instance.get_response()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
subject = instance.input_entry.get_text()
|
||||
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):
|
||||
room_jid = self.get_active_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)
|
||||
response = instance.dialog.run()
|
||||
instance.dialog.destroy()
|
||||
response = response = instance.get_response()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
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):
|
||||
room_jid = self.get_active_jid()
|
||||
|
@ -504,6 +501,12 @@ class GroupchatWindow(chat.Chat):
|
|||
self.gc_refer_to_nick_char in text.lower().split()):
|
||||
other_tags_for_name.append('bold')
|
||||
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,
|
||||
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="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="has_separator">True</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="dialog-vbox8">
|
||||
|
@ -10959,7 +10958,7 @@ JID: whatever@jabber.org</property>
|
|||
<widget class="GtkLabel" id="label212">
|
||||
<property name="visible">True</property>
|
||||
<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_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
|
@ -15290,7 +15289,7 @@ the Jabber network.</property>
|
|||
<child>
|
||||
<widget class="GtkImageMenuItem" id="change_nick_menuitem">
|
||||
<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>
|
||||
<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