f0ce3e87c6
Seperate UserItems are now created for each list, too, rather than a single one being created per-user. This functionally works a lot nicer. But onto more important things… now setting the user's own nick should work quite well. Finally. =w= This has given me a good bit of trouble over the past couple of days― setting the user's nick *worked*, but it wouldn't propagate to its corresponding UserItem nor its UserInfoDialog. It would, however, work with the StatusView. These are all registered Observers of the User itself, so if one works, they *all* should, them all being registered to the same User. Now, if a given User isn't found in the ProtocolLooper's user-list, the Conversation class will take it upon itself to create a new one and add it to both of their respective lists. So the user's own contact would be set in the ProtocolLooper― but it *wouldn't* be added to the user-list. Hilarity ensues as two seperate objects for the user's own contact would be created. Since the StatusView is registered to the ProtocolLooper's "real" own contact slot, it would receive all updates… but since Conversations' user-lists and items would be registered to the Conversation-created "fake" user, they would be borked. Simple oversight, but wow it hecked with me. :P
89 lines
1.9 KiB
C++
89 lines
1.9 KiB
C++
/*
|
|
* Copyright 2009-2011, Andrea Anzani. All rights reserved.
|
|
* Copyright 2012, Dario Casalinuovo. All rights reserved.
|
|
* Copyright 2021, Jaidyn Levesque. All rights reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef USER_H
|
|
#define USER_H
|
|
|
|
#include <String.h>
|
|
#include <Message.h>
|
|
#include <Messenger.h>
|
|
#include <ObjectList.h>
|
|
#include <Path.h>
|
|
|
|
#include <libsupport/KeyMap.h>
|
|
|
|
#include "AppConstants.h"
|
|
#include "Notifier.h"
|
|
|
|
class BBitmap;
|
|
|
|
class Conversation;
|
|
class ProtocolLooper;
|
|
class UserPopUp;
|
|
|
|
|
|
typedef KeyMap<BString, Conversation*> ChatMap;
|
|
|
|
|
|
class User : public Notifier {
|
|
public:
|
|
User(BString id, BMessenger msgn);
|
|
|
|
void RegisterObserver(Conversation* chat);
|
|
void RegisterObserver(Observer* obs) { Notifier::RegisterObserver(obs); }
|
|
void UnregisterObserver(Conversation* chat);
|
|
void UnregisterObserver(Observer* obs) { Notifier::UnregisterObserver(obs); }
|
|
|
|
void ShowPopUp(BPoint where);
|
|
void DeletePopUp();
|
|
void HidePopUp();
|
|
|
|
BString GetId() const;
|
|
|
|
BMessenger Messenger() const;
|
|
void SetMessenger(BMessenger messenger);
|
|
|
|
ProtocolLooper* GetProtocolLooper() const;
|
|
void SetProtocolLooper(ProtocolLooper* looper);
|
|
BBitmap* ProtocolBitmap() const;
|
|
|
|
BString GetName() const;
|
|
BBitmap* AvatarBitmap() const;
|
|
UserStatus GetNotifyStatus() const;
|
|
BString GetNotifyPersonalStatus() const;
|
|
|
|
void SetNotifyName(BString name);
|
|
void SetNotifyAvatarBitmap(BBitmap* bitmap);
|
|
void SetNotifyStatus(UserStatus status);
|
|
void SetNotifyPersonalStatus(BString personalStatus);
|
|
|
|
ChatMap Conversations();
|
|
|
|
rgb_color fItemColor;
|
|
|
|
protected:
|
|
virtual void _EnsureCachePath();
|
|
|
|
BBitmap* _GetCachedAvatar();
|
|
void _SetCachedAvatar(BBitmap* avatar);
|
|
|
|
BMessenger fMessenger;
|
|
ProtocolLooper* fLooper;
|
|
|
|
BString fID;
|
|
BString fName;
|
|
BString fPersonalStatus;
|
|
BBitmap* fAvatarBitmap;
|
|
BPath fCachePath;
|
|
UserStatus fStatus;
|
|
UserPopUp* fPopUp;
|
|
ChatMap fConversations;
|
|
};
|
|
|
|
|
|
#endif // USER_H
|
|
|