Send xhtml on group message to XMPP MUC
This commit is contained in:
parent
5cd4442ddc
commit
e32365a065
10
session.py
10
session.py
|
@ -279,7 +279,7 @@ class Session(YowsupApp):
|
||||||
if participant is not None: # Group message
|
if participant is not None: # Group message
|
||||||
partname = participant.split('@')[0]
|
partname = participant.split('@')[0]
|
||||||
if notify is None:
|
if notify is None:
|
||||||
notify = "";
|
notify = ""
|
||||||
self.sendGroupMessageToXMPP(buddy, partname, messageContent,
|
self.sendGroupMessageToXMPP(buddy, partname, messageContent,
|
||||||
timestamp, notify)
|
timestamp, notify)
|
||||||
else:
|
else:
|
||||||
|
@ -479,9 +479,9 @@ class Session(YowsupApp):
|
||||||
self.logger.info("Stopped typing: %s to %s", self.legacyName, buddy)
|
self.logger.info("Stopped typing: %s to %s", self.legacyName, buddy)
|
||||||
self.sendTyping(buddy, False)
|
self.sendTyping(buddy, False)
|
||||||
|
|
||||||
def sendMessageToWA(self, sender, message, ID):
|
def sendMessageToWA(self, sender, message, ID, xhtml=""):
|
||||||
self.logger.info("Message sent from %s to %s: %s",
|
self.logger.info("Message sent from %s to %s: %s (xhtml=%s)",
|
||||||
self.legacyName, sender, message)
|
self.legacyName, sender, message, xhtml)
|
||||||
|
|
||||||
message = message.encode("utf-8")
|
message = message.encode("utf-8")
|
||||||
# FIXME: Fragile, should pass this in to onDlerror
|
# FIXME: Fragile, should pass this in to onDlerror
|
||||||
|
@ -519,7 +519,7 @@ class Session(YowsupApp):
|
||||||
self.logger.debug("Group Message from %s to %s Groups: %s",
|
self.logger.debug("Group Message from %s to %s Groups: %s",
|
||||||
group.nick , group , self.groups)
|
group.nick , group , self.groups)
|
||||||
self.backend.handleMessage(
|
self.backend.handleMessage(
|
||||||
self.user, room, message.decode('utf-8'), group.nick
|
self.user, room, message.decode('utf-8'), group.nick, xhtml=xhtml
|
||||||
)
|
)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.logger.error('Group not found: %s', room)
|
self.logger.error('Group not found: %s', room)
|
||||||
|
|
|
@ -61,9 +61,9 @@ class WhatsAppBackend(SpectrumBackend):
|
||||||
# causes duplicate messages. Thus we should not send consecutive
|
# causes duplicate messages. Thus we should not send consecutive
|
||||||
# messages with the same id
|
# messages with the same id
|
||||||
if ID == '':
|
if ID == '':
|
||||||
self.sessions[user].sendMessageToWA(buddy, message, ID)
|
self.sessions[user].sendMessageToWA(buddy, message, ID, xhtml)
|
||||||
elif user not in self.lastMsgId or self.lastMsgId[user] != ID:
|
elif user not in self.lastMsgId or self.lastMsgId[user] != ID:
|
||||||
self.sessions[user].sendMessageToWA(buddy, message, ID)
|
self.sessions[user].sendMessageToWA(buddy, message, ID, xhtml)
|
||||||
self.lastMsgId[user] = ID
|
self.lastMsgId[user] = ID
|
||||||
|
|
||||||
def handleJoinRoomRequest(self, user, room, nickname, pasword):
|
def handleJoinRoomRequest(self, user, room, nickname, pasword):
|
||||||
|
|
Loading…
Reference in a new issue