diff --git a/src/core.py b/src/core.py index f5c0713e..8014a4df 100644 --- a/src/core.py +++ b/src/core.py @@ -240,6 +240,8 @@ class Core(object): if not room: return self.on_chatstate_private_conversation(message, state) + elif message['type'] == 'groupchat': + self.on_chatstate_groupchat_conversation(message, state) def on_chatstate_normal_conversation(self, message,state): tab = self.get_tab_of_conversation_with_jid(message['from'], False) @@ -259,6 +261,15 @@ class Core(object): self.refresh_window() return True + def on_chatstate_groupchat_conversation(self, message, state): + nick = message['mucnick'] + room_from = message.getMucroom() + tab = self.get_tab_by_name(room_from, tabs.MucTab) + if tab and tab.get_room() and tab.get_room().get_user_by_name(nick): + tab.get_room().get_user_by_name(nick).chatstate = state + if tab == self.current_tab(): + self.refresh_window() + def open_new_form(self, form, on_cancel, on_send, **kwargs): """ Open a new tab containing the form diff --git a/src/tabs.py b/src/tabs.py index ffae2652..20ddd212 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -555,7 +555,12 @@ class MucTab(ChatTab, TabWithInfoWin): self.core.room_error(res, self.get_name()) def command_say(self, line): - muc.send_groupchat_message(self.core.xmpp, self.get_name(), line) + msg = self.core.xmpp.make_message(self.get_name()) + msg['type'] = 'groupchat' + msg['body'] = line + if config.get('send_chat_states', 'true') == 'true' and self.remote_wants_chatstates is not False: + msg['chat_state'] = 'active' + msg.send() def command_ignore(self, arg): """ diff --git a/src/user.py b/src/user.py index 395d522b..8916c8ff 100644 --- a/src/user.py +++ b/src/user.py @@ -43,6 +43,7 @@ class User(object): self.change_nick(nick) self.color = choice(theme.LIST_COLOR_NICKNAMES) self.jid = jid + self.chatstate = None def update(self, affiliation, show, status, role): self.affiliation = affiliation diff --git a/src/windows.py b/src/windows.py index a18785ad..01566506 100644 --- a/src/windows.py +++ b/src/windows.py @@ -138,7 +138,11 @@ class UserList(Win): show_col = theme.COLOR_STATUS_NONE else: show_col = self.color_show[user.show] - self.addstr(y, 0, theme.CHAR_STATUS, common.curses_color_pair(show_col)) + if user.chatstate == 'composing': + char = 'X' + else: + char = theme.CHAR_STATUS + self.addstr(y, 0, char, common.curses_color_pair(show_col)) self.addstr(y, 1, user.nick[:self.width-2], common.curses_color_pair(role_col)) y += 1 if y == self.height: