Use notify as buddies nickname when sending groupchats.
This commit is contained in:
parent
a5877bc1a9
commit
744efd154f
26
session.py
26
session.py
|
@ -54,7 +54,6 @@ class Session(YowsupApp):
|
||||||
self.groups = {}
|
self.groups = {}
|
||||||
self.presenceRequested = []
|
self.presenceRequested = []
|
||||||
self.offlineQueue = []
|
self.offlineQueue = []
|
||||||
self.msgIDs = { }
|
|
||||||
self.groupOfflineQueue = { }
|
self.groupOfflineQueue = { }
|
||||||
self.shouldBeConnected = False
|
self.shouldBeConnected = False
|
||||||
|
|
||||||
|
@ -170,10 +169,12 @@ class Session(YowsupApp):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
ownerNick = group.subjectOwner
|
ownerNick = group.subjectOwner
|
||||||
|
|
||||||
self.backend.handleSubject(self.user, room, group.subject,
|
self.backend.handleSubject(self.user, self._shortenGroupId(room),
|
||||||
|
group.subject,
|
||||||
ownerNick)
|
ownerNick)
|
||||||
self.backend.handleRoomNicknameChanged(self.user, room,
|
self.backend.handleRoomNicknameChanged(
|
||||||
group.subject)
|
self.user, self._shortenGroupId(room), group.subject
|
||||||
|
)
|
||||||
self._refreshParticipants(room)
|
self._refreshParticipants(room)
|
||||||
else:
|
else:
|
||||||
self.logger.warn("Room doesn't exist: %s", room)
|
self.logger.warn("Room doesn't exist: %s", room)
|
||||||
|
@ -225,8 +226,10 @@ class Session(YowsupApp):
|
||||||
flags = protocol_pb2.PARTICIPANT_FLAG_ME
|
flags = protocol_pb2.PARTICIPANT_FLAG_ME
|
||||||
buddyFull = self.user
|
buddyFull = self.user
|
||||||
|
|
||||||
self.backend.handleParticipantChanged(self.user, buddyFull,
|
self.backend.handleParticipantChanged(
|
||||||
self._shortenGroupId(room), flags, protocol_pb2.STATUS_ONLINE, buddy, nick)
|
self.user, buddyFull, self._shortenGroupId(room), flags,
|
||||||
|
protocol_pb2.STATUS_ONLINE, buddy, nick
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _lastSeen(self, number, seconds):
|
def _lastSeen(self, number, seconds):
|
||||||
|
@ -301,6 +304,17 @@ class Session(YowsupApp):
|
||||||
buddy, self.legacyName, messageContent, timestamp)
|
buddy, self.legacyName, messageContent, timestamp)
|
||||||
if participant is not None: # Group message
|
if participant is not None: # Group message
|
||||||
partname = participant.split('@')[0]
|
partname = participant.split('@')[0]
|
||||||
|
try:
|
||||||
|
part = self.buddies[partname]
|
||||||
|
if part.nick == "":
|
||||||
|
part.nick = notify
|
||||||
|
self.backend.handleParticipantChanged(
|
||||||
|
self.user, partname, buddy,
|
||||||
|
protocol_pb2.PARTICIPANT_FLAG_NONE,
|
||||||
|
protocol_pb2.STATUS_NONE, "", part.nick
|
||||||
|
) # TODO
|
||||||
|
except KeyError:
|
||||||
|
self.updateBuddy(partname, notify, [])
|
||||||
self.sendGroupMessageToXMPP(buddy, partname, messageContent,
|
self.sendGroupMessageToXMPP(buddy, partname, messageContent,
|
||||||
timestamp)
|
timestamp)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue