friends: Handle online friends
This commit is contained in:
parent
4587bcd43c
commit
b259ead8c8
|
|
@ -2856,6 +2856,7 @@ struct Friend {
|
|||
dclass ToontownFriendsManager : DistributedObject {
|
||||
getFriendsListRequest() clsend;
|
||||
getFriendsListResponse(Friend[]);
|
||||
friendOnline(uint32, uint8, uint8);
|
||||
};
|
||||
|
||||
dclass TTSpeedchatRelay : SpeedchatRelay {
|
||||
|
|
|
|||
|
|
@ -995,20 +995,29 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
if avatarHandleList:
|
||||
messenger.send('gotExtraFriendHandles', [avatarHandleList])
|
||||
|
||||
def handleFriendOnline(self, di):
|
||||
doId = di.getUint32()
|
||||
commonChatFlags = 0
|
||||
whitelistChatFlags = 0
|
||||
if di.getRemainingSize() > 0:
|
||||
commonChatFlags = di.getUint8()
|
||||
if di.getRemainingSize() > 0:
|
||||
whitelistChatFlags = di.getUint8()
|
||||
self.notify.debug('Friend %d now online. common=%d whitelist=%d' % (doId, commonChatFlags, whitelistChatFlags))
|
||||
if doId not in self.friendsOnline:
|
||||
self.friendsOnline[doId] = self.identifyFriend(doId)
|
||||
messenger.send('friendOnline', [doId, commonChatFlags, whitelistChatFlags])
|
||||
if not self.friendsOnline[doId]:
|
||||
self.friendPendingChatSettings[doId] = (commonChatFlags, whitelistChatFlags)
|
||||
if __astron__:
|
||||
def handleFriendOnline(self, doId, commonChatFlags, whitelistChatFlags):
|
||||
self.notify.debug('Friend %d now online. common=%d whitelist=%d' % (doId, commonChatFlags, whitelistChatFlags))
|
||||
if doId not in self.friendsOnline:
|
||||
self.friendsOnline[doId] = self.identifyFriend(doId)
|
||||
messenger.send('friendOnline', [doId, commonChatFlags, whitelistChatFlags])
|
||||
if not self.friendsOnline[doId]:
|
||||
self.friendPendingChatSettings[doId] = (commonChatFlags, whitelistChatFlags)
|
||||
else:
|
||||
def handleFriendOnline(self, di):
|
||||
doId = di.getUint32()
|
||||
commonChatFlags = 0
|
||||
whitelistChatFlags = 0
|
||||
if di.getRemainingSize() > 0:
|
||||
commonChatFlags = di.getUint8()
|
||||
if di.getRemainingSize() > 0:
|
||||
whitelistChatFlags = di.getUint8()
|
||||
self.notify.debug('Friend %d now online. common=%d whitelist=%d' % (doId, commonChatFlags, whitelistChatFlags))
|
||||
if doId not in self.friendsOnline:
|
||||
self.friendsOnline[doId] = self.identifyFriend(doId)
|
||||
messenger.send('friendOnline', [doId, commonChatFlags, whitelistChatFlags])
|
||||
if not self.friendsOnline[doId]:
|
||||
self.friendPendingChatSettings[doId] = (commonChatFlags, whitelistChatFlags)
|
||||
|
||||
def handleFriendOffline(self, di):
|
||||
doId = di.getUint32()
|
||||
|
|
|
|||
|
|
@ -10,3 +10,6 @@ class ToontownFriendsManager(DistributedObjectGlobal):
|
|||
|
||||
def getFriendsListResponse(self, friendsList):
|
||||
self.cr.handleGetFriendsList(friendsList)
|
||||
|
||||
def friendOnline(self, doId, commonChatFlags, whitelistChatFlags):
|
||||
self.cr.handleFriendOnline(doId, commonChatFlags, whitelistChatFlags)
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ class GetFriendsListOperation(FriendsOperation):
|
|||
|
||||
def __sendFriendsList(self):
|
||||
self.friendsManager.sendUpdateToAvatarId(self.sender, 'getFriendsListResponse', [self.friendsList])
|
||||
for friendId in self.onlineFriends:
|
||||
self.friendsManager.sendUpdateToAvatarId(self.sender, 'friendOnline', [friendId, 0, 1])
|
||||
|
||||
|
||||
class ToontownFriendsManagerUD(DistributedObjectGlobalUD):
|
||||
|
|
|
|||
Loading…
Reference in New Issue