2021-05-23 15:10:14 -05:00
|
|
|
/*
|
|
|
|
* Copyright 2009-2011, Andrea Anzani. All rights reserved.
|
|
|
|
* Copyright 2012, Dario Casalinuovo. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2021-05-24 01:47:21 -05:00
|
|
|
#ifndef USER_H
|
|
|
|
#define USER_H
|
2021-05-23 15:10:14 -05:00
|
|
|
|
|
|
|
#include <String.h>
|
|
|
|
#include <Message.h>
|
|
|
|
#include <Messenger.h>
|
2021-05-24 01:47:21 -05:00
|
|
|
#include <ObjectList.h>
|
|
|
|
|
|
|
|
#include <libsupport/KeyMap.h>
|
2021-05-23 15:10:14 -05:00
|
|
|
|
|
|
|
#include "Notifier.h"
|
|
|
|
#include "CayaConstants.h"
|
|
|
|
|
|
|
|
class BBitmap;
|
|
|
|
|
2021-05-24 01:47:21 -05:00
|
|
|
class Conversation;
|
2021-05-23 15:10:14 -05:00
|
|
|
class ProtocolLooper;
|
2021-05-31 10:50:43 -05:00
|
|
|
class UserItem;
|
|
|
|
class UserPopUp;
|
2021-05-23 15:10:14 -05:00
|
|
|
|
2021-05-24 01:47:21 -05:00
|
|
|
|
|
|
|
typedef KeyMap<BString, Conversation*> ChatMap;
|
|
|
|
|
|
|
|
|
2021-05-23 15:10:14 -05:00
|
|
|
class User : public Notifier {
|
|
|
|
public:
|
|
|
|
User(BString id, BMessenger msgn);
|
|
|
|
|
2021-05-24 01:47:21 -05:00
|
|
|
void RegisterObserver(Conversation* chat);
|
|
|
|
void RegisterObserver(Observer* obs) { Notifier::RegisterObserver(obs); }
|
|
|
|
void UnregisterObserver(Conversation* chat);
|
|
|
|
void UnregisterObserver(Observer* obs) { Notifier::UnregisterObserver(obs); }
|
|
|
|
|
2021-05-23 15:10:14 -05:00
|
|
|
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;
|
|
|
|
|
2021-05-31 10:50:43 -05:00
|
|
|
UserItem* GetListItem();
|
|
|
|
|
2021-05-23 15:10:14 -05:00
|
|
|
BString GetName() const;
|
|
|
|
BBitmap* AvatarBitmap() const;
|
|
|
|
CayaStatus GetNotifyStatus() const;
|
|
|
|
BString GetNotifyPersonalStatus() const;
|
|
|
|
|
|
|
|
void SetNotifyName(BString name);
|
|
|
|
void SetNotifyAvatarBitmap(BBitmap* bitmap);
|
|
|
|
void SetNotifyStatus(CayaStatus status);
|
|
|
|
void SetNotifyPersonalStatus(BString personalStatus);
|
|
|
|
|
2021-05-24 01:47:21 -05:00
|
|
|
ChatMap Conversations();
|
|
|
|
|
2021-05-23 15:10:14 -05:00
|
|
|
protected:
|
|
|
|
BMessenger fMessenger;
|
|
|
|
ProtocolLooper* fLooper;
|
|
|
|
|
2021-05-31 10:50:43 -05:00
|
|
|
UserItem* fListItem;
|
|
|
|
|
2021-05-23 15:10:14 -05:00
|
|
|
BString fID;
|
|
|
|
bigtime_t fInstance;
|
|
|
|
BString fName;
|
|
|
|
BString fPersonalStatus;
|
|
|
|
BBitmap* fAvatarBitmap;
|
|
|
|
CayaStatus fStatus;
|
|
|
|
UserPopUp* fPopUp;
|
2021-05-24 01:47:21 -05:00
|
|
|
ChatMap fConversations;
|
2021-05-23 15:10:14 -05:00
|
|
|
};
|
|
|
|
|
2021-05-24 01:47:21 -05:00
|
|
|
|
|
|
|
#endif // USER_H
|
|
|
|
|