Send xhtml on group message to XMPP MUC

This commit is contained in:
moyamo 2016-01-06 16:57:17 +02:00
parent 5cd4442ddc
commit e32365a065
2 changed files with 8 additions and 8 deletions

View file

@ -279,7 +279,7 @@ class Session(YowsupApp):
if participant is not None: # Group message
partname = participant.split('@')[0]
if notify is None:
notify = "";
notify = ""
self.sendGroupMessageToXMPP(buddy, partname, messageContent,
timestamp, notify)
else:
@ -479,9 +479,9 @@ class Session(YowsupApp):
self.logger.info("Stopped typing: %s to %s", self.legacyName, buddy)
self.sendTyping(buddy, False)
def sendMessageToWA(self, sender, message, ID):
self.logger.info("Message sent from %s to %s: %s",
self.legacyName, sender, message)
def sendMessageToWA(self, sender, message, ID, xhtml=""):
self.logger.info("Message sent from %s to %s: %s (xhtml=%s)",
self.legacyName, sender, message, xhtml)
message = message.encode("utf-8")
# FIXME: Fragile, should pass this in to onDlerror
@ -519,11 +519,11 @@ class Session(YowsupApp):
self.logger.debug("Group Message from %s to %s Groups: %s",
group.nick , group , self.groups)
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:
self.logger.error('Group not found: %s', room)
if (".jpg" in message.lower()) or (".webp" in message.lower()):
if (".jpg" in message.lower()):
self.imgType = "jpg"

View file

@ -61,9 +61,9 @@ class WhatsAppBackend(SpectrumBackend):
# causes duplicate messages. Thus we should not send consecutive
# messages with the same 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:
self.sessions[user].sendMessageToWA(buddy, message, ID)
self.sessions[user].sendMessageToWA(buddy, message, ID, xhtml)
self.lastMsgId[user] = ID
def handleJoinRoomRequest(self, user, room, nickname, pasword):