wix: MUC groupchat management + short nick shown in chat window instead of full jid when possible
This commit is contained in:
parent
5486458797
commit
ff49d87520
2 changed files with 10 additions and 2 deletions
|
|
@ -153,7 +153,10 @@ class Chat(wx.Frame, QuickChat):
|
|||
|
||||
def onEnterPressed(self, event):
|
||||
"""Behaviour when enter pressed in send line."""
|
||||
self.host.bridge.sendMessage(self.target, event.GetString(), profile_key=self.host.profile)
|
||||
self.host.bridge.sendMessage(self.target.short if self.type=='group' else self.target,
|
||||
event.GetString(),
|
||||
type = "groupchat" if self.type=='group' else "chat",
|
||||
profile_key=self.host.profile)
|
||||
self.textBox.Clear()
|
||||
|
||||
|
||||
|
|
@ -161,10 +164,11 @@ class Chat(wx.Frame, QuickChat):
|
|||
def printMessage(self, from_jid, msg, profile, timestamp=""):
|
||||
"""Print the message with differents colors depending on where it comes from."""
|
||||
jid=JID(from_jid)
|
||||
nick = jid.resource if self.type == "group" else (self.host.CM.getAttr(jid,'nick') or self.host.CM.getAttr(jid,'name') or jid)
|
||||
mymess = (jid.short == self.host.profiles[profile]['whoami'].short) #mymess = True if message comes from local user
|
||||
_font = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.BOLD)
|
||||
self.chatWindow.SetDefaultStyle(wx.TextAttr( "BLACK" if mymess else "BLUE", font=_font))
|
||||
self.chatWindow.AppendText("[%s] " % jid)
|
||||
self.chatWindow.AppendText("[%s] " % nick)
|
||||
_font = wx.Font(self.font["points"], self.font["family"], wx.ITALIC if mymess else wx.NORMAL, wx.NORMAL)
|
||||
self.chatWindow.SetDefaultStyle(wx.TextAttr("BLACK", font=_font))
|
||||
self.chatWindow.AppendText("%s\n" % msg)
|
||||
|
|
|
|||
|
|
@ -139,6 +139,10 @@ class SatMUCClient (muc.MUCClient):
|
|||
user_data={'entity':user.entity or '', 'affiliation':user.affiliation, 'role':user.role}
|
||||
self.host.bridge.roomUserLeft(room.roomIdentifier, room.service, user.nick, user_data, self.parent.profile)
|
||||
|
||||
def userUpdatedStatus(self, room, user, show, status):
|
||||
print("FIXME: MUC status not managed yet")
|
||||
#FIXME: gof
|
||||
|
||||
def receivedSubject(self, room, subject):
|
||||
debug (_("New subject for room (%(room_id)s): %(subject)s") % {'room_id':room.occupantJID.userhost(),'subject':subject})
|
||||
self.host.bridge.roomNewSubject(room.roomIdentifier, room.service, subject, self.parent.profile)
|
||||
|
|
|
|||
Loading…
Reference in a new issue