status -> show

we cannot join a gc twice at the same time with the same account
This commit is contained in:
Yann Leboulanger 2005-05-20 16:31:52 +00:00
parent 1d4d9f5229
commit f3d36d9d80
5 changed files with 24 additions and 20 deletions

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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):