Merge branch 'yowsup-2' of https://github.com/stv0g/transwhat.git into yowsup-2
This commit is contained in:
commit
2911274ab6
|
@ -69,7 +69,7 @@ following content:
|
||||||
port = 5221
|
port = 5221
|
||||||
|
|
||||||
backend_host = localhost
|
backend_host = localhost
|
||||||
backend = /location/to/transwhat/transwhat.py
|
backend = /usr/bin/transwhat
|
||||||
|
|
||||||
users_per_backend = 10
|
users_per_backend = 10
|
||||||
more_resources = 1
|
more_resources = 1
|
||||||
|
|
3
setup.py
3
setup.py
|
@ -33,6 +33,9 @@ setup(name='transwhat',
|
||||||
'transWhat',
|
'transWhat',
|
||||||
'Spectrum2'
|
'Spectrum2'
|
||||||
],
|
],
|
||||||
|
scripts=[
|
||||||
|
'transWhat/transwhat.py'
|
||||||
|
],
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'protobuf',
|
'protobuf',
|
||||||
'yowsup2',
|
'yowsup2',
|
||||||
|
|
|
@ -135,39 +135,34 @@ class Session(YowsupApp):
|
||||||
"\n".join(text) + "\nIf you do not join them you will lose messages"
|
"\n".join(text) + "\nIf you do not join them you will lose messages"
|
||||||
#self.bot.send(message)
|
#self.bot.send(message)
|
||||||
|
|
||||||
def _updateGroups(self, response, request):
|
def _updateGroups(self, response, _):
|
||||||
self.logger.debug('Received groups list %s' % response)
|
self.logger.debug('Received groups list %s' % response)
|
||||||
groups = response.getGroups()
|
groups = response.getGroups()
|
||||||
for group in groups:
|
for group in groups:
|
||||||
room = group.getId()
|
room = group.getId()
|
||||||
|
# ensure self.groups[room] exists
|
||||||
|
if room not in self.groups:
|
||||||
owner = group.getOwner().split('@')[0]
|
owner = group.getOwner().split('@')[0]
|
||||||
subjectOwner = group.getSubjectOwner().split('@')[0]
|
subjectOwner = group.getSubjectOwner().split('@')[0]
|
||||||
subject = utils.softToUni(group.getSubject())
|
subject = utils.softToUni(group.getSubject())
|
||||||
|
self.groups[room] = Group(room, owner, subject, subjectOwner,
|
||||||
if room in self.groups:
|
self.backend, self.user)
|
||||||
oroom = self.groups[room]
|
# add/update room participants
|
||||||
oroom.owner = owner
|
|
||||||
oroom.subjectOwner = subjectOwner
|
|
||||||
oroom.subject = subject
|
|
||||||
else:
|
|
||||||
self.groups[room] = Group(room, owner, subject, subjectOwner, self.backend, self.user)
|
|
||||||
# self.joinRoom(self._shortenGroupId(room), self.user.split("@")[0])
|
|
||||||
self.groups[room].addParticipants(group.getParticipants().keys(),
|
self.groups[room].addParticipants(group.getParticipants().keys(),
|
||||||
self.buddies, self.legacyName)
|
self.buddies, self.legacyName)
|
||||||
|
self.gotGroupList = True
|
||||||
#self._addParticipantsToRoom(room, group.getParticipants())
|
# join rooms
|
||||||
|
while self.joinRoomQueue:
|
||||||
if room in self.groupOfflineQueue:
|
self.joinRoom(*self.joinRoomQueue.pop(0))
|
||||||
|
# deliver queued offline messages
|
||||||
|
for room in self.groupOfflineQueue:
|
||||||
while self.groupOfflineQueue[room]:
|
while self.groupOfflineQueue[room]:
|
||||||
msg = self.groupOfflineQueue[room].pop(0)
|
msg = self.groupOfflineQueue[room].pop(0)
|
||||||
self.backend.handleMessage(self.user, room, msg[1],
|
self.backend.handleMessage(self.user, room, msg[1], msg[0], "",
|
||||||
msg[0], "", msg[2])
|
msg[2])
|
||||||
self.logger.debug("Send queued group message to: %s %s %s" %
|
self.logger.debug("Send queued group message to: %s %s %s" %
|
||||||
(msg[0],msg[1], msg[2]))
|
(msg[0], msg[1], msg[2]))
|
||||||
self.gotGroupList = True
|
# pass update to backend
|
||||||
for room, nick in self.joinRoomQueue:
|
|
||||||
self.joinRoom(room, nick)
|
|
||||||
self.joinRoomQueue = []
|
|
||||||
self.updateRoomList()
|
self.updateRoomList()
|
||||||
|
|
||||||
def joinRoom(self, room, nick):
|
def joinRoom(self, room, nick):
|
||||||
|
|
Loading…
Reference in a new issue