frontends: fixes bug with private message introduced with revision 1000 (6f1e03068b5f) + display messages from contacts not in roster
This commit is contained in:
parent
2afa53f755
commit
f09fb76752
1 changed files with 49 additions and 30 deletions
|
|
@ -25,7 +25,7 @@ from sat_frontends.quick_frontend.quick_chat import QuickChat
|
|||
from sat_frontends.primitivus.card_game import CardGame
|
||||
from sat_frontends.quick_frontend.quick_utils import escapePrivate, unescapePrivate
|
||||
from sat_frontends.primitivus.xmlui import XMLUI
|
||||
from sat_frontends.primitivus.constants import Const
|
||||
from sat_frontends.primitivus.constants import Const as C
|
||||
import time
|
||||
from sat.tools.jid import JID
|
||||
|
||||
|
|
@ -179,18 +179,18 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
def updateChatState(self, state, nick=None):
|
||||
"""Set the chat state (XEP-0085) of the contact. Leave nick to None
|
||||
to set the state for a one2one conversation, or give a nickname or
|
||||
Const.ALL_OCCUPANTS to set the state of a participant within a MUC.
|
||||
C.ALL_OCCUPANTS to set the state of a participant within a MUC.
|
||||
@param state: the new chat state
|
||||
@param nick: None for one2one, the MUC user nick or Const.ALL_OCCUPANTS
|
||||
@param nick: None for one2one, the MUC user nick or C.ALL_OCCUPANTS
|
||||
"""
|
||||
if nick:
|
||||
assert(self.type == 'group')
|
||||
occupants = self.occupants if nick == Const.ALL_OCCUPANTS else [nick]
|
||||
occupants = self.occupants if nick == C.ALL_OCCUPANTS else [nick]
|
||||
options = self.present_wid.getAllValues()
|
||||
for index in xrange(0, len(options)):
|
||||
nick = options[index].value
|
||||
if nick in occupants:
|
||||
options[index] = (nick, '%s %s' % (Const.MUC_USER_STATES[state], nick))
|
||||
options[index] = (nick, '%s %s' % (C.MUC_USER_STATES[state], nick))
|
||||
self.present_wid.changeValues(options)
|
||||
self.host.redraw()
|
||||
else:
|
||||
|
|
@ -209,7 +209,7 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
full_jid = JID("%s/%s" % (self.target.bare, nick))
|
||||
new_jid = escapePrivate(full_jid)
|
||||
if new_jid not in self.host.contact_list:
|
||||
self.host.contact_list.add(new_jid)
|
||||
self.host.contact_list.add(new_jid, [C.GROUP_NOT_IN_ROSTER])
|
||||
|
||||
#now we select the new window
|
||||
self.host.contact_list.setFocus(full_jid, True)
|
||||
|
|
|
|||
Loading…
Reference in a new issue