/close /part /leave for Group chat window [basic IRC emulation is finished I think]
This commit is contained in:
parent
a9a2b483cb
commit
f198b6d9f5
1 changed files with 11 additions and 3 deletions
|
@ -571,6 +571,7 @@ class GroupchatWindow(chat.Chat):
|
||||||
message_buffer = message_textview.get_buffer()
|
message_buffer = message_textview.get_buffer()
|
||||||
if message != '' or message != '\n':
|
if message != '' or message != '\n':
|
||||||
self.save_sent_message(room_jid, message)
|
self.save_sent_message(room_jid, message)
|
||||||
|
|
||||||
if message in ['/clear', '/clear ']:
|
if message in ['/clear', '/clear ']:
|
||||||
self.on_clear(None, conversation_textview) # clear conversation
|
self.on_clear(None, conversation_textview) # clear conversation
|
||||||
self.on_clear(None, message_textview) # clear message textview too
|
self.on_clear(None, message_textview) # clear message textview too
|
||||||
|
@ -625,6 +626,13 @@ class GroupchatWindow(chat.Chat):
|
||||||
self.print_conversation(self.subjects[room_jid], room_jid)
|
self.print_conversation(self.subjects[room_jid], room_jid)
|
||||||
return # don't print the command
|
return # don't print the command
|
||||||
|
|
||||||
|
elif message.startswith('/leave') or message.startswith('/part')\
|
||||||
|
or message.startswith('/close'):
|
||||||
|
# close current tab
|
||||||
|
room_jid = self.get_active_jid()
|
||||||
|
self.remove_tab(room_jid)
|
||||||
|
return # don't print the command
|
||||||
|
|
||||||
elif message.startswith('/ban '): #eg. /ban fooman he was a bad boy
|
elif message.startswith('/ban '): #eg. /ban fooman he was a bad boy
|
||||||
text_after_ban_command = message[5:].strip() # 5 is len('/ban ')
|
text_after_ban_command = message[5:].strip() # 5 is len('/ban ')
|
||||||
splitted_text_after_ban_command = text_after_ban_command.split()
|
splitted_text_after_ban_command = text_after_ban_command.split()
|
||||||
|
@ -903,10 +911,10 @@ class GroupchatWindow(chat.Chat):
|
||||||
|
|
||||||
def remove_tab(self, room_jid):
|
def remove_tab(self, room_jid):
|
||||||
if time.time() - gajim.last_message_time[self.account][room_jid] < 2:
|
if time.time() - gajim.last_message_time[self.account][room_jid] < 2:
|
||||||
|
name = gajim.get_nick_from_jid(room_jid)
|
||||||
dialog = dialogs.ConfirmationDialog(
|
dialog = dialogs.ConfirmationDialog(
|
||||||
_('You just received a new message in room "%s"'),
|
_('You just received a new message in room "%s"') % name,
|
||||||
_('If you close this tab, the message will be lost.') % \
|
_('If you close this tab, the message will be lost.'))
|
||||||
room_jid.split('@')[0])
|
|
||||||
if dialog.get_response() != gtk.RESPONSE_OK:
|
if dialog.get_response() != gtk.RESPONSE_OK:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue