diff --git a/src/common/helpers.py b/src/common/helpers.py index 40441ea7d..8173b198c 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -17,15 +17,15 @@ ## GNU General Public License for more details. ## -def get_uf_status(self, status): +def get_uf_show(show): '''returns a userfriendly string for dnd/xa/chat and capitalize()s the rest''' - if status == 'dnd': - uf_status = 'Busy' - elif status == 'xa': - uf_status = 'Not Available' - elif status == 'chat': - uf_status = 'Free for Chat' + if show == 'dnd': + uf_show = 'Busy' + elif show == 'xa': + uf_show = 'Not Available' + elif show == 'chat': + uf_show = 'Free for Chat' else: - uf_status = status.capitalize() - return uf_status + uf_show = show.capitalize() + return uf_show diff --git a/src/dialogs.py b/src/dialogs.py index 3bea64190..71adc91a4 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -180,11 +180,11 @@ class choose_gpg_key_dialog: self.window.show_all() class Change_status_message_dialog: - def __init__(self, plugin, status): + def __init__(self, plugin, show): self.xml = gtk.glade.XML(GTKGUI_GLADE, 'change_status_message_dialog', APP) self.window = self.xml.get_widget('change_status_message_dialog') - uf_status = helpers.get_uf_status(status) - self.window.set_title(uf_status + ' Status Message') + uf_show = helpers.get_uf_show(show) + self.window.set_title(uf_show + ' Status Message') message_textview = self.xml.get_widget('message_textview') self.message_buffer = message_textview.get_buffer() @@ -553,6 +553,9 @@ class Join_groupchat_window: server = self.xml.get_widget('server_entry').get_text() password = self.xml.get_widget('password_entry').get_text() jid = '%s@%s' % (room, server) + if jid in self.plugin.windows[self.account]['gc']: + Error_dialog(_('You are already in room ' + jid)) + return if jid in self.recently_groupchat: self.recently_groupchat.remove(jid) self.recently_groupchat.insert(0, jid) diff --git a/src/roster_window.py b/src/roster_window.py index b3b172715..efe33acb8 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -420,7 +420,7 @@ class Roster_window: name = user.name if user.resource != '': name += '/' + user.resource - uf_show = helpers.get_uf_status(show) + uf_show = helpers.get_uf_show(show) self.plugin.windows[account]['chats'][jid].print_conversation( _('%s is now %s (%s)') % (name, uf_show, status), jid, 'status') @@ -1459,10 +1459,11 @@ class Roster_window: self.status_combobox.pack_start(cell, True) self.status_combobox.add_attribute(cell, 'text', 0) - for status in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible', + for show in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible', 'offline']: - uf_status = helpers.get_uf_status(status) - iter = liststore.append([uf_status, self.jabber_state_images[status], status]) + uf_show = helpers.get_uf_show(show) + iter = liststore.append([uf_show, self.jabber_state_images[show], + show]) self.status_combobox.show_all() self.status_combobox.set_model(liststore) self.status_combobox.set_active(6) # default to offline diff --git a/src/systray.py b/src/systray.py index b8609935b..8a4eb00f6 100644 --- a/src/systray.py +++ b/src/systray.py @@ -182,8 +182,8 @@ class Systray: if group in user.groups and user.show != 'offline' and \ user.show != 'error': at_least_one = True - status = helpers.get_uf_status(user.show) - s = user.name.replace('_', '__') + ' (' + status + ')' + show = helpers.get_uf_show(user.show) + s = user.name.replace('_', '__') + ' (' + show + ')' item = gtk.MenuItem(s) item.connect('activate', self.start_chat, account,\ user.jid) diff --git a/src/tabbed_chat_window.py b/src/tabbed_chat_window.py index 8c69d08e0..4a4e389c4 100644 --- a/src/tabbed_chat_window.py +++ b/src/tabbed_chat_window.py @@ -171,9 +171,9 @@ class Tabbed_chat_window(chat.Chat): self.redraw_tab(user.jid) self.draw_widgets(user) - uf_status = helpers.get_uf_status(user.show) + uf_show = helpers.get_uf_show(user.show) self.print_conversation(_('%s is %s (%s)') % (user.name, - uf_status, user.status), user.jid, 'status') + uf_show, user.status), user.jid, 'status') #print queued messages if self.plugin.queues[self.account].has_key(user.jid):