frontends: fixed /me usage + renamed a couple of "type" parameters to type_

This commit is contained in:
Goffi 2014-02-04 18:51:16 +01:00
commit 4d14048f8c

View file

@ -26,19 +26,19 @@ from sat_frontends.quick_frontend.constants import Const
class QuickChat(object):
def __init__(self, target, host, type='one2one'):
def __init__(self, target, host, type_='one2one'):
self.target = target
self.host = host
self.type = type
self.type = type_
self.id = ""
self.nick = None
self.occupants = set()
def setType(self, type):
def setType(self, type_):
"""Set the type of the chat
@param type: can be 'one2one' for single conversation or 'group' for chat à la IRC
"""
self.type = type
self.type = type_
def setPresents(self, nicks):
"""Set the users presents in the contact list for a group chat
@ -130,14 +130,14 @@ class QuickChat(object):
nick = self._get_nick(jid)
mymess = (jid.resource == self.nick) if self.type == "group" else (jid.bare == self.host.profiles[profile]['whoami'].bare) #mymess = True if message comes from local user
if msg.startswith('/me '):
self.printInfo('* %s %s' % (nick, msg[4:]),type='me', timestamp=timestamp)
self.printInfo('* %s %s' % (nick, msg[4:]), type_='me', timestamp=timestamp)
return
return jid, nick, mymess
def printInfo(self, msg, type='normal'):
def printInfo(self, msg, type_='normal'):
"""Print general info
@param msg: message to print
@type: one of:
@type_: one of:
normal: general info like "toto has joined the room"
me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist"
"""