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