mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-08-03 04:19:20 -04:00
Added ChatServer and soePlatform
This commit is contained in:
+478
@@ -0,0 +1,478 @@
|
||||
#include "AvatarIteratorCore.h"
|
||||
#include "ChatAvatar.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
|
||||
// AVATAR ITERATOR CORE
|
||||
|
||||
AvatarIteratorCore::AvatarIteratorCore()
|
||||
: m_map(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
AvatarIteratorCore::AvatarIteratorCore(std::map<unsigned, ChatAvatar *> *mapIn, std::map<unsigned, ChatAvatar *>::iterator iter)
|
||||
: m_map(mapIn),
|
||||
m_mapIter(iter)
|
||||
{
|
||||
}
|
||||
|
||||
AvatarIteratorCore::~AvatarIteratorCore()
|
||||
{
|
||||
}
|
||||
|
||||
AvatarIteratorCore &AvatarIteratorCore::operator=(const AvatarIteratorCore& rhs)
|
||||
{
|
||||
m_map = rhs.m_map;
|
||||
m_mapIter = rhs.m_mapIter;
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
ChatAvatar *AvatarIteratorCore::getCurAvatar()
|
||||
{
|
||||
ChatAvatar *returnVal = NULL;
|
||||
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = (*m_mapIter).second;
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool AvatarIteratorCore::increment()
|
||||
{
|
||||
bool returnVal = false;
|
||||
|
||||
m_mapIter++;
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = true;
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool AvatarIteratorCore::decrement()
|
||||
{
|
||||
bool returnVal = false;
|
||||
|
||||
m_mapIter--;
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = true;
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool AvatarIteratorCore::outOfBounds()
|
||||
{
|
||||
bool returnVal = true;
|
||||
|
||||
if (m_map)
|
||||
{
|
||||
if (m_mapIter != m_map->end())
|
||||
{
|
||||
returnVal = false;
|
||||
}
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
// MODERATOR ITERATOR CORE
|
||||
|
||||
ModeratorIteratorCore::ModeratorIteratorCore()
|
||||
: m_set(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
ModeratorIteratorCore::ModeratorIteratorCore(std::set<ChatAvatar *> *setIn, std::set<ChatAvatar *>::iterator iter)
|
||||
: m_set(setIn),
|
||||
m_setIter(iter)
|
||||
{
|
||||
}
|
||||
|
||||
ModeratorIteratorCore::~ModeratorIteratorCore()
|
||||
{
|
||||
}
|
||||
|
||||
ModeratorIteratorCore &ModeratorIteratorCore::operator=(const ModeratorIteratorCore& rhs)
|
||||
{
|
||||
m_set = rhs.m_set;
|
||||
m_setIter = rhs.m_setIter;
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
ChatAvatar *ModeratorIteratorCore::getCurAvatar()
|
||||
{
|
||||
ChatAvatar *returnVal = NULL;
|
||||
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = (*m_setIter);
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool ModeratorIteratorCore::increment()
|
||||
{
|
||||
bool returnVal = false;
|
||||
|
||||
m_setIter++;
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = true;
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool ModeratorIteratorCore::decrement()
|
||||
{
|
||||
bool returnVal = false;
|
||||
|
||||
m_setIter--;
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = true;
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool ModeratorIteratorCore::outOfBounds()
|
||||
{
|
||||
bool returnVal = true;
|
||||
|
||||
if (m_set)
|
||||
{
|
||||
if (m_setIter != m_set->end())
|
||||
{
|
||||
returnVal = false;
|
||||
}
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
// TEMPORARY MODERATOR ITERATOR CORE
|
||||
|
||||
TemporaryModeratorIteratorCore::TemporaryModeratorIteratorCore()
|
||||
: m_set(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
TemporaryModeratorIteratorCore::TemporaryModeratorIteratorCore(std::set<ChatAvatar *> *setIn, std::set<ChatAvatar *>::iterator iter)
|
||||
: m_set(setIn),
|
||||
m_setIter(iter)
|
||||
{
|
||||
}
|
||||
|
||||
TemporaryModeratorIteratorCore::~TemporaryModeratorIteratorCore()
|
||||
{
|
||||
}
|
||||
|
||||
TemporaryModeratorIteratorCore &TemporaryModeratorIteratorCore::operator=(const TemporaryModeratorIteratorCore& rhs)
|
||||
{
|
||||
m_set = rhs.m_set;
|
||||
m_setIter = rhs.m_setIter;
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
ChatAvatar *TemporaryModeratorIteratorCore::getCurAvatar()
|
||||
{
|
||||
ChatAvatar *returnVal = NULL;
|
||||
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = (*m_setIter);
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool TemporaryModeratorIteratorCore::increment()
|
||||
{
|
||||
bool returnVal = false;
|
||||
|
||||
m_setIter++;
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = true;
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool TemporaryModeratorIteratorCore::decrement()
|
||||
{
|
||||
bool returnVal = false;
|
||||
|
||||
m_setIter--;
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = true;
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool TemporaryModeratorIteratorCore::outOfBounds()
|
||||
{
|
||||
bool returnVal = true;
|
||||
|
||||
if (m_set)
|
||||
{
|
||||
if (m_setIter != m_set->end())
|
||||
{
|
||||
returnVal = false;
|
||||
}
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
// VOICE ITERATOR CORE
|
||||
|
||||
VoiceIteratorCore::VoiceIteratorCore()
|
||||
: m_set(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
VoiceIteratorCore::VoiceIteratorCore(std::set<ChatAvatar *> *setIn, std::set<ChatAvatar *>::iterator iter)
|
||||
: m_set(setIn),
|
||||
m_setIter(iter)
|
||||
{
|
||||
}
|
||||
|
||||
VoiceIteratorCore::~VoiceIteratorCore()
|
||||
{
|
||||
}
|
||||
|
||||
VoiceIteratorCore &VoiceIteratorCore::operator=(const VoiceIteratorCore& rhs)
|
||||
{
|
||||
m_set = rhs.m_set;
|
||||
m_setIter = rhs.m_setIter;
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
ChatAvatar *VoiceIteratorCore::getCurAvatar()
|
||||
{
|
||||
ChatAvatar *returnVal = NULL;
|
||||
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = (*m_setIter);
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool VoiceIteratorCore::increment()
|
||||
{
|
||||
bool returnVal = false;
|
||||
|
||||
m_setIter++;
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = true;
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool VoiceIteratorCore::decrement()
|
||||
{
|
||||
bool returnVal = false;
|
||||
|
||||
m_setIter--;
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = true;
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool VoiceIteratorCore::outOfBounds()
|
||||
{
|
||||
bool returnVal = true;
|
||||
|
||||
if (m_set)
|
||||
{
|
||||
if (m_setIter != m_set->end())
|
||||
{
|
||||
returnVal = false;
|
||||
}
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
// INVITE ITERATOR CORE
|
||||
|
||||
InviteIteratorCore::InviteIteratorCore()
|
||||
: m_set(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
InviteIteratorCore::InviteIteratorCore(std::set<ChatAvatar *> *setIn, std::set<ChatAvatar *>::iterator iter)
|
||||
: m_set(setIn),
|
||||
m_setIter(iter)
|
||||
{
|
||||
}
|
||||
|
||||
InviteIteratorCore::~InviteIteratorCore()
|
||||
{
|
||||
}
|
||||
|
||||
InviteIteratorCore &InviteIteratorCore::operator=(const InviteIteratorCore& rhs)
|
||||
{
|
||||
m_set = rhs.m_set;
|
||||
m_setIter = rhs.m_setIter;
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
ChatAvatar *InviteIteratorCore::getCurAvatar()
|
||||
{
|
||||
ChatAvatar *returnVal = NULL;
|
||||
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = (*m_setIter);
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool InviteIteratorCore::increment()
|
||||
{
|
||||
bool returnVal = false;
|
||||
|
||||
m_setIter++;
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = true;
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool InviteIteratorCore::decrement()
|
||||
{
|
||||
bool returnVal = false;
|
||||
|
||||
m_setIter--;
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = true;
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool InviteIteratorCore::outOfBounds()
|
||||
{
|
||||
bool returnVal = true;
|
||||
|
||||
if (m_set)
|
||||
{
|
||||
if (m_setIter != m_set->end())
|
||||
{
|
||||
returnVal = false;
|
||||
}
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
// BAN ITERATOR CORE
|
||||
|
||||
BanIteratorCore::BanIteratorCore()
|
||||
: m_set(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
BanIteratorCore::BanIteratorCore(std::set<ChatAvatar *> *setIn, std::set<ChatAvatar *>::iterator iter)
|
||||
: m_set(setIn),
|
||||
m_setIter(iter)
|
||||
{
|
||||
}
|
||||
|
||||
BanIteratorCore::~BanIteratorCore()
|
||||
{
|
||||
}
|
||||
|
||||
BanIteratorCore &BanIteratorCore::operator=(const BanIteratorCore& rhs)
|
||||
{
|
||||
m_set = rhs.m_set;
|
||||
m_setIter = rhs.m_setIter;
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
ChatAvatar *BanIteratorCore::getCurAvatar()
|
||||
{
|
||||
ChatAvatar *returnVal = NULL;
|
||||
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = (*m_setIter);
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool BanIteratorCore::increment()
|
||||
{
|
||||
bool returnVal = false;
|
||||
|
||||
m_setIter++;
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = true;
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool BanIteratorCore::decrement()
|
||||
{
|
||||
bool returnVal = false;
|
||||
|
||||
m_setIter--;
|
||||
if (!outOfBounds())
|
||||
{
|
||||
returnVal = true;
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
bool BanIteratorCore::outOfBounds()
|
||||
{
|
||||
bool returnVal = true;
|
||||
|
||||
if (m_set)
|
||||
{
|
||||
if (m_setIter != m_set->end())
|
||||
{
|
||||
returnVal = false;
|
||||
}
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
#if !defined (AVATARITERATORCORE_H_)
|
||||
#define AVATARITERATORCORE_H_
|
||||
|
||||
#pragma warning (disable : 4786)
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
|
||||
class ChatAvatar;
|
||||
|
||||
class AvatarIteratorCore
|
||||
{
|
||||
public:
|
||||
AvatarIteratorCore();
|
||||
AvatarIteratorCore(std::map<unsigned, ChatAvatar *> *mapIn, std::map<unsigned, ChatAvatar *>::iterator iter);
|
||||
~AvatarIteratorCore();
|
||||
|
||||
AvatarIteratorCore & operator=(const AvatarIteratorCore& rhs);
|
||||
|
||||
ChatAvatar *getCurAvatar();
|
||||
|
||||
// navigation functions return true while iterator points to a map node,
|
||||
// else false if reached the end.
|
||||
bool increment();
|
||||
bool decrement();
|
||||
|
||||
// have we reached the end?
|
||||
bool outOfBounds();
|
||||
|
||||
private:
|
||||
std::map<unsigned, ChatAvatar *> *m_map;
|
||||
std::map<unsigned, ChatAvatar *>::iterator m_mapIter;
|
||||
};
|
||||
|
||||
class ModeratorIteratorCore
|
||||
{
|
||||
public:
|
||||
ModeratorIteratorCore();
|
||||
ModeratorIteratorCore(std::set<ChatAvatar *> *setIn, std::set<ChatAvatar *>::iterator iter);
|
||||
~ModeratorIteratorCore();
|
||||
|
||||
ModeratorIteratorCore & operator=(const ModeratorIteratorCore& rhs);
|
||||
|
||||
ChatAvatar *getCurAvatar();
|
||||
|
||||
// navigation functions return true while iterator points to a map node,
|
||||
// else false if reached the end.
|
||||
bool increment();
|
||||
bool decrement();
|
||||
|
||||
// have we reached the end?
|
||||
bool outOfBounds();
|
||||
|
||||
private:
|
||||
std::set<ChatAvatar *> *m_set;
|
||||
std::set<ChatAvatar *>::iterator m_setIter;
|
||||
};
|
||||
|
||||
class TemporaryModeratorIteratorCore
|
||||
{
|
||||
public:
|
||||
TemporaryModeratorIteratorCore();
|
||||
TemporaryModeratorIteratorCore(std::set<ChatAvatar *> *setIn, std::set<ChatAvatar *>::iterator iter);
|
||||
~TemporaryModeratorIteratorCore();
|
||||
|
||||
TemporaryModeratorIteratorCore & operator=(const TemporaryModeratorIteratorCore& rhs);
|
||||
|
||||
ChatAvatar *getCurAvatar();
|
||||
|
||||
// navigation functions return true while iterator points to a map node,
|
||||
// else false if reached the end.
|
||||
bool increment();
|
||||
bool decrement();
|
||||
|
||||
// have we reached the end?
|
||||
bool outOfBounds();
|
||||
|
||||
private:
|
||||
std::set<ChatAvatar *> *m_set;
|
||||
std::set<ChatAvatar *>::iterator m_setIter;
|
||||
};
|
||||
|
||||
class VoiceIteratorCore
|
||||
{
|
||||
public:
|
||||
VoiceIteratorCore();
|
||||
VoiceIteratorCore(std::set<ChatAvatar *> *setIn, std::set<ChatAvatar *>::iterator iter);
|
||||
~VoiceIteratorCore();
|
||||
|
||||
VoiceIteratorCore & operator=(const VoiceIteratorCore& rhs);
|
||||
|
||||
ChatAvatar *getCurAvatar();
|
||||
|
||||
// navigation functions return true while iterator points to a map node,
|
||||
// else false if reached the end.
|
||||
bool increment();
|
||||
bool decrement();
|
||||
|
||||
// have we reached the end?
|
||||
bool outOfBounds();
|
||||
|
||||
private:
|
||||
std::set<ChatAvatar *> *m_set;
|
||||
std::set<ChatAvatar *>::iterator m_setIter;
|
||||
};
|
||||
|
||||
class InviteIteratorCore
|
||||
{
|
||||
public:
|
||||
InviteIteratorCore();
|
||||
InviteIteratorCore(std::set<ChatAvatar *> *setIn, std::set<ChatAvatar *>::iterator iter);
|
||||
~InviteIteratorCore();
|
||||
|
||||
InviteIteratorCore & operator=(const InviteIteratorCore& rhs);
|
||||
|
||||
ChatAvatar *getCurAvatar();
|
||||
|
||||
// navigation functions return true while iterator points to a map node,
|
||||
// else false if reached the end.
|
||||
bool increment();
|
||||
bool decrement();
|
||||
|
||||
// have we reached the end?
|
||||
bool outOfBounds();
|
||||
|
||||
private:
|
||||
std::set<ChatAvatar *> *m_set;
|
||||
std::set<ChatAvatar *>::iterator m_setIter;
|
||||
};
|
||||
|
||||
class BanIteratorCore
|
||||
{
|
||||
public:
|
||||
BanIteratorCore();
|
||||
BanIteratorCore(std::set<ChatAvatar *> *setIn, std::set<ChatAvatar *>::iterator iter);
|
||||
~BanIteratorCore();
|
||||
|
||||
BanIteratorCore & operator=(const BanIteratorCore& rhs);
|
||||
|
||||
ChatAvatar *getCurAvatar();
|
||||
|
||||
// navigation functions return true while iterator points to a map node,
|
||||
// else false if reached the end.
|
||||
bool increment();
|
||||
bool decrement();
|
||||
|
||||
// have we reached the end?
|
||||
bool outOfBounds();
|
||||
|
||||
private:
|
||||
std::set<ChatAvatar *> *m_set;
|
||||
std::set<ChatAvatar *>::iterator m_setIter;
|
||||
};
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#if !defined (AVATARLISTITEM_H_)
|
||||
#define AVATARLISTITEM_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ChatEnum.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
class AvatarListItemCore;
|
||||
|
||||
class AvatarListItem
|
||||
{
|
||||
public:
|
||||
AvatarListItem();
|
||||
~AvatarListItem();
|
||||
const ChatUnicodeString &getName() const { return m_name; }
|
||||
const ChatUnicodeString &getAddress() const { return m_address; }
|
||||
|
||||
friend class AvatarListItemCore;
|
||||
private:
|
||||
ChatUnicodeString m_name;
|
||||
ChatUnicodeString m_address;
|
||||
|
||||
AvatarListItemCore *m_core;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#include "AvatarListItemCore.h"
|
||||
#include "AvatarListItem.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
using namespace Base;
|
||||
using namespace Plat_Unicode;
|
||||
|
||||
AvatarListItem::AvatarListItem()
|
||||
: m_core(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
AvatarListItem::~AvatarListItem()
|
||||
{
|
||||
}
|
||||
|
||||
AvatarListItemCore::AvatarListItemCore()
|
||||
: m_interface(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
AvatarListItemCore::~AvatarListItemCore()
|
||||
{
|
||||
}
|
||||
|
||||
void AvatarListItemCore::load(Base::ByteStream::ReadIterator &iter, AvatarListItem *inf)
|
||||
{
|
||||
m_interface = inf;
|
||||
inf->m_core = this;
|
||||
get(iter, m_name);
|
||||
get(iter, m_address);
|
||||
|
||||
m_interface->m_name = m_name;
|
||||
m_interface->m_address = m_address;
|
||||
}
|
||||
};
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#if !defined (AVATARLISTITEMCORE_H_)
|
||||
#define AVATARLISTITEMCORE_H_
|
||||
|
||||
#include <Base/Archive.h>
|
||||
#include <Unicode/Unicode.h>
|
||||
#include <Unicode/UnicodeUtils.h>
|
||||
|
||||
#include "ChatEnum.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
|
||||
|
||||
class AvatarListItem;
|
||||
|
||||
class AvatarListItemCore
|
||||
{
|
||||
public:
|
||||
AvatarListItemCore();
|
||||
~AvatarListItemCore();
|
||||
|
||||
const Plat_Unicode::String &getName() const { return m_name; }
|
||||
const Plat_Unicode::String &getAddress() const { return m_address; }
|
||||
|
||||
void load(Base::ByteStream::ReadIterator &iter, AvatarListItem *inf);
|
||||
|
||||
private:
|
||||
AvatarListItem *m_interface;
|
||||
Plat_Unicode::String m_name;
|
||||
Plat_Unicode::String m_address;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,106 @@
|
||||
#if !defined (CHATAPICORE_H_)
|
||||
#define CHATAPICORE_H_
|
||||
|
||||
#pragma warning (disable : 4786)
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <Unicode/Unicode.h>
|
||||
#include <Unicode/UnicodeUtils.h>
|
||||
|
||||
#include <GenericAPI/GenericApiCore.h>
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
|
||||
class ChatAvatar;
|
||||
class ChatAvatarCore;
|
||||
class ChatRoomCore;
|
||||
class ChatRoom;
|
||||
class ChatAPI;
|
||||
class ChatUnicodeString;
|
||||
|
||||
class ChatAPICore : public GenericAPI::GenericAPICore
|
||||
{
|
||||
public:
|
||||
ChatAPICore(const char *registrar_host, short registrar_port, const char *server_host, short server_port);
|
||||
virtual ~ChatAPICore();
|
||||
|
||||
void setRequestTimeout(unsigned requestTimeout) { m_requestTimeout = requestTimeout; }
|
||||
|
||||
unsigned RequestCreateAvatar(const char *name);
|
||||
unsigned RequestDestroyAvatar(ChatAvatar *avatar);
|
||||
|
||||
virtual void responseCallback(GenericAPI::GenericResponse *res);
|
||||
virtual void responseCallback(short type, Base::ByteStream::ReadIterator &iter);
|
||||
void clearRequestCount() { m_requestCount = 0; }
|
||||
|
||||
virtual void OnConnect(const char *host, short port);
|
||||
virtual void OnDisconnect(const char *host, short port);
|
||||
|
||||
void setAPI(ChatAPI *api) { m_api = api; }
|
||||
ChatAvatar *getAvatar(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress);
|
||||
ChatAvatar *getAvatar(unsigned avatarID);
|
||||
ChatRoom *getRoom(const ChatUnicodeString &roomAddress);
|
||||
ChatRoom *getRoom(unsigned roomID);
|
||||
|
||||
static ChatUnicodeString getErrorString(unsigned resultCode);
|
||||
|
||||
bool isUID(Plat_Unicode::String &uid) { return (m_uidSet.find(Plat_Unicode::toUpper(uid)) != m_uidSet.end()); }
|
||||
|
||||
// calls GenericAPICore::processAPI() after doing any necessary work
|
||||
void processAPI();
|
||||
|
||||
private:
|
||||
void cacheRoom(ChatRoomCore *roomCore);
|
||||
ChatRoomCore *decacheRoom(unsigned roomID);
|
||||
|
||||
ChatRoomCore *getRoomCore(unsigned roomID);
|
||||
|
||||
void cacheAvatar(ChatAvatarCore *avatarCore);
|
||||
ChatAvatarCore *decacheAvatar(unsigned avatarID);
|
||||
|
||||
ChatAvatarCore *getAvatarCore(unsigned avatarID);
|
||||
|
||||
bool areEqualChatStrings(const ChatUnicodeString &str1, const ChatUnicodeString &str2);
|
||||
|
||||
void failoverReloginAvatars();
|
||||
void failoverReloginOneAvatar(ChatAvatarCore * avatarCore);
|
||||
|
||||
void failoverRecreateRooms();
|
||||
|
||||
std::map<unsigned, ChatAvatarCore *> m_avatarCoreCache;
|
||||
std::map<unsigned, ChatAvatar *> m_avatarCache;
|
||||
std::map<unsigned, ChatRoomCore *> m_roomCoreCache;
|
||||
std::map<unsigned, ChatRoom *> m_roomCache;
|
||||
|
||||
std::set<Plat_Unicode::String> m_uidSet;
|
||||
|
||||
bool m_connected;
|
||||
bool m_sentVersion;
|
||||
bool m_inFailoverMode;
|
||||
unsigned m_failoverAvatarResRemain;
|
||||
unsigned m_failoverRoomResRemain;
|
||||
unsigned m_requestCount;
|
||||
|
||||
bool m_setToRegistrar;
|
||||
std::string m_registrarHost;
|
||||
std::string m_defaultServerHost;
|
||||
std::string m_assignedServerHost;
|
||||
short m_registrarPort;
|
||||
short m_defaultServerPort;
|
||||
short m_assignedServerPort;
|
||||
|
||||
time_t m_timeSinceLastDisconnect;
|
||||
bool m_rcvdRegistrarResponse;
|
||||
|
||||
static const char * const ms_errorStringsEnglish[];
|
||||
static unsigned ms_numErrorStrings;
|
||||
|
||||
ChatAPI *m_api;
|
||||
|
||||
protected:
|
||||
bool m_shouldSendVersion;
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
#include "ChatAvatar.h"
|
||||
#include "ChatAvatarCore.h"
|
||||
#include "Base/MD5.h"
|
||||
#include "Unicode/utf8.h"
|
||||
#include <numeric>
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
|
||||
const unsigned MOD_NUMBER = 256;
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
|
||||
ChatAvatar::ChatAvatar()
|
||||
: m_core(new ChatAvatarCore())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ChatAvatar::ChatAvatar(unsigned avatarID, unsigned userID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &gateway, const ChatUnicodeString &server, unsigned gatewayID, unsigned serverID)
|
||||
: m_core(new ChatAvatarCore(avatarID, userID, name, address, gateway, server, gatewayID, serverID, ChatUnicodeString(), 0)),
|
||||
m_cServer(m_core->getServer().data(), m_core->getServer().size()),
|
||||
m_cGateway(m_core->getGateway().data(), m_core->getGateway().size()),
|
||||
m_cName(m_core->getName().data(), m_core->getName().size()),
|
||||
m_cAddress(m_core->getAddress().data(), m_core->getAddress().size()),
|
||||
m_cLoginLocation(m_core->getLoginLocation().data(), m_core->getLoginLocation().size())
|
||||
{
|
||||
}
|
||||
|
||||
ChatAvatar::ChatAvatar(unsigned avatarID, unsigned userID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &gateway, const ChatUnicodeString &server, unsigned gatewayID, unsigned serverID, const ChatUnicodeString &loginLocation, unsigned attributes)
|
||||
: m_core(new ChatAvatarCore(avatarID, userID, name, address, gateway, server, gatewayID, serverID, loginLocation, attributes)),
|
||||
m_cServer(m_core->getServer().data(), m_core->getServer().size()),
|
||||
m_cGateway(m_core->getGateway().data(), m_core->getGateway().size()),
|
||||
m_cName(m_core->getName().data(), m_core->getName().size()),
|
||||
m_cAddress(m_core->getAddress().data(), m_core->getAddress().size()),
|
||||
m_cLoginLocation(m_core->getLoginLocation().data(), m_core->getLoginLocation().size())
|
||||
{
|
||||
}
|
||||
|
||||
ChatAvatar::ChatAvatar(const ChatAvatar &rhs)
|
||||
: m_core(new ChatAvatarCore(*(rhs.m_core)))
|
||||
{
|
||||
}
|
||||
|
||||
ChatAvatar::~ChatAvatar()
|
||||
{
|
||||
delete m_core;
|
||||
}
|
||||
|
||||
ChatAvatar &ChatAvatar::operator=(const ChatAvatar &rhs)
|
||||
{
|
||||
delete m_core;
|
||||
m_core = new ChatAvatarCore(rhs.m_core->getAvatarID(),
|
||||
rhs.m_core->getUserID(),
|
||||
rhs.m_core->getName(),
|
||||
rhs.m_core->getAddress(),
|
||||
rhs.m_core->getGateway(),
|
||||
rhs.m_core->getServer(),
|
||||
rhs.m_core->getGatewayID(),
|
||||
rhs.m_core->getServerID(),
|
||||
rhs.m_core->getLoginLocation(),
|
||||
rhs.getAttributes());
|
||||
|
||||
m_cServer = m_core->getServer();
|
||||
m_cGateway= m_core->getGateway();
|
||||
m_cName = m_core->getName();
|
||||
m_cAddress = m_core->getAddress();
|
||||
|
||||
return(*this);
|
||||
}
|
||||
|
||||
const ChatUnicodeString &ChatAvatar::getName() const
|
||||
{
|
||||
m_cName = m_core->getName();
|
||||
return m_cName;
|
||||
}
|
||||
|
||||
const ChatUnicodeString &ChatAvatar::getAddress() const
|
||||
{
|
||||
m_cAddress = m_core->getAddress();
|
||||
return m_cAddress;
|
||||
}
|
||||
|
||||
unsigned ChatAvatar::getUserID() const
|
||||
{
|
||||
return m_core->getUserID();
|
||||
}
|
||||
|
||||
unsigned ChatAvatar::getAvatarID() const
|
||||
{
|
||||
return m_core->getAvatarID();
|
||||
}
|
||||
|
||||
const ChatUnicodeString &ChatAvatar::getLoginLocation() const
|
||||
{
|
||||
m_cLoginLocation = m_core->getLoginLocation();
|
||||
|
||||
return m_cLoginLocation;
|
||||
}
|
||||
|
||||
int ChatAvatar::getLoginPriority() const
|
||||
{
|
||||
return m_core->getLoginPriority();
|
||||
}
|
||||
|
||||
unsigned ChatAvatar::getInboxLimit() const
|
||||
{
|
||||
return m_core->getInboxLimit();
|
||||
}
|
||||
|
||||
const ChatUnicodeString &ChatAvatar::getForwardingEmail() const
|
||||
{
|
||||
m_cForwardingEmail = m_core->getEmail();
|
||||
|
||||
return m_cForwardingEmail;
|
||||
}
|
||||
|
||||
unsigned ChatAvatar::getAttributes() const
|
||||
{
|
||||
return m_core->getAttributes();
|
||||
}
|
||||
|
||||
const ChatUnicodeString &ChatAvatar::getServer() const
|
||||
{
|
||||
m_cServer = m_core->getServer();
|
||||
return m_cServer;
|
||||
}
|
||||
|
||||
const ChatUnicodeString &ChatAvatar::getGateway() const
|
||||
{
|
||||
m_cGateway = m_core->getGateway();
|
||||
return m_cGateway;
|
||||
}
|
||||
|
||||
unsigned ChatAvatar::getServerID() const
|
||||
{
|
||||
return m_core->getServerID();
|
||||
}
|
||||
|
||||
unsigned ChatAvatar::getGatewayID() const
|
||||
{
|
||||
return m_core->getGatewayID();
|
||||
}
|
||||
|
||||
const ChatUnicodeString& ChatAvatar::getStatusMessage() const
|
||||
{
|
||||
m_cStatusMessage = m_core->getStatusMessage();
|
||||
return m_cStatusMessage;
|
||||
}
|
||||
|
||||
void ChatAvatar::setAttributes(unsigned long attributes)
|
||||
{
|
||||
m_core->setAttributes(attributes);
|
||||
}
|
||||
|
||||
void ChatAvatar::setLoginPriority(int loginPriority)
|
||||
{
|
||||
m_core->setLoginPriority(loginPriority);
|
||||
}
|
||||
|
||||
void ChatAvatar::setInboxLimit(unsigned inboxLimit)
|
||||
{
|
||||
m_core->setInboxLimit(inboxLimit);
|
||||
}
|
||||
|
||||
void ChatAvatar::setForwardingEmail(const ChatUnicodeString &forwardingEmail)
|
||||
{
|
||||
m_core->setEmail(forwardingEmail.data());
|
||||
}
|
||||
|
||||
void ChatAvatar::setStatusMessage(const ChatUnicodeString& statusMessage)
|
||||
{
|
||||
m_core->setStatusMessage( statusMessage.data() );
|
||||
}
|
||||
|
||||
|
||||
ChatUnicodeString ChatAvatar::CreateAddressFromName(const ChatUnicodeString & name, const std::string & gameCode)
|
||||
{
|
||||
// convert to utf8
|
||||
char utf8Buff[256];
|
||||
memset(utf8Buff, 0, 256);
|
||||
Plat_Unicode::UTF16_convertToUTF8( (Plat_Unicode::UTF16 *)name.data(), utf8Buff, 256);
|
||||
|
||||
std::string utf8String(utf8Buff);
|
||||
|
||||
std::transform(utf8String.begin(), utf8String.end(), utf8String.begin(), tolower);
|
||||
|
||||
// hash the username
|
||||
Base::MD5 md5r(utf8String);
|
||||
std::string hexName = md5r.asHex();
|
||||
|
||||
// get the sum of each character
|
||||
unsigned sum = std::accumulate(hexName.begin(), hexName.end(), 0);
|
||||
|
||||
// mod to a world ID.
|
||||
unsigned short worldID = (sum % MOD_NUMBER);
|
||||
|
||||
char buff[256];
|
||||
memset(buff, 0, 256);
|
||||
unsigned len = 0;
|
||||
|
||||
if (gameCode.length() < 230)
|
||||
{
|
||||
len = sprintf (buff, "SOE+%s+World%03d", gameCode.c_str(), worldID);
|
||||
}
|
||||
|
||||
return ChatUnicodeString(buff, len);
|
||||
}
|
||||
|
||||
|
||||
}; // end ChatSystem namespace
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
#if !defined (CHATAVATAR_H_)
|
||||
#define CHATAVATAR_H_
|
||||
|
||||
#pragma warning (disable : 4786)
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ChatEnum.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
|
||||
enum AvatarAttributes
|
||||
{
|
||||
AVATARATTR_INVISIBLE = 1 << 0,
|
||||
AVATARATTR_GM = 1 << 1,
|
||||
AVATARATTR_SUPERGM = 1 << 2,
|
||||
AVATARATTR_SUPERSNOOP = 1 << 3,
|
||||
AVATARATTR_EXTENDED = 1 << 4
|
||||
};
|
||||
|
||||
class ChatAvatarCore;
|
||||
|
||||
// class ChatAvatar
|
||||
//
|
||||
// Description:
|
||||
// This class stores the information about an avatar in the ChatSystem that
|
||||
// is relevant to the API.
|
||||
//
|
||||
// Usage:
|
||||
// Typically a ChatAvatar will originate from an API callback method.
|
||||
// The ChatAvatar object can be copied for local storage and the data
|
||||
// members can be retrieved from the available get__ methods below.
|
||||
class ChatAvatar
|
||||
{
|
||||
public:
|
||||
ChatAvatar();
|
||||
ChatAvatar(unsigned avatarID, unsigned userID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &gateway, const ChatUnicodeString &server, unsigned gatewayID, unsigned serverID);
|
||||
ChatAvatar(unsigned avatarID, unsigned userID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &gateway, const ChatUnicodeString &server, unsigned gatewayID, unsigned serverID, const ChatUnicodeString &loginLocation, unsigned attributes);
|
||||
ChatAvatar(const ChatAvatar &rhs);
|
||||
~ChatAvatar();
|
||||
|
||||
ChatAvatar &operator=(const ChatAvatar &rhs);
|
||||
|
||||
const ChatUnicodeString &getName() const;
|
||||
const ChatUnicodeString &getAddress() const;
|
||||
|
||||
unsigned getUserID() const;
|
||||
unsigned getAvatarID() const;
|
||||
|
||||
const ChatUnicodeString &getServer() const;
|
||||
const ChatUnicodeString &getGateway() const;
|
||||
|
||||
unsigned getServerID() const;
|
||||
unsigned getGatewayID() const;
|
||||
|
||||
const ChatUnicodeString &getLoginLocation() const;
|
||||
int getLoginPriority() const;
|
||||
unsigned getAttributes() const;
|
||||
unsigned getInboxLimit() const;
|
||||
const ChatUnicodeString &getForwardingEmail() const;
|
||||
const ChatUnicodeString& getStatusMessage() const;
|
||||
|
||||
void setAttributes(unsigned long attributes);
|
||||
void setLoginPriority(int loginPriority);
|
||||
void setInboxLimit(unsigned inboxLimit);
|
||||
void setForwardingEmail(const ChatUnicodeString &forwardingEmail);
|
||||
void setStatusMessage(const ChatUnicodeString& statusMessage);
|
||||
|
||||
static ChatUnicodeString CreateAddressFromName(const ChatUnicodeString & name, const std::string & gameCode);
|
||||
|
||||
private:
|
||||
ChatAvatarCore *m_core;
|
||||
mutable ChatUnicodeString m_cServer;
|
||||
mutable ChatUnicodeString m_cGateway;
|
||||
mutable ChatUnicodeString m_cName;
|
||||
mutable ChatUnicodeString m_cAddress;
|
||||
mutable ChatUnicodeString m_cLoginLocation;
|
||||
mutable ChatUnicodeString m_cForwardingEmail;
|
||||
mutable ChatUnicodeString m_cStatusMessage;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
#include "ChatAvatarCore.h"
|
||||
#include "ChatAvatar.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
|
||||
using namespace Plat_Unicode;
|
||||
using namespace Base;
|
||||
|
||||
ChatAvatarCore::ChatAvatarCore()
|
||||
: m_inboxLimit(0),
|
||||
m_loginPriority(0),
|
||||
m_userID(0),
|
||||
m_avatarID(0),
|
||||
m_serverID(0),
|
||||
m_gatewayID(0)
|
||||
{
|
||||
}
|
||||
|
||||
ChatAvatarCore::ChatAvatarCore(unsigned avatarID, unsigned userID, const unsigned short *name, const unsigned short *address, const unsigned short *gateway, const unsigned short *server, unsigned gatewayID, unsigned serverID, const unsigned short *loginLocation, unsigned attributes)
|
||||
: m_name(name),
|
||||
m_address(address),
|
||||
m_server(server),
|
||||
m_gateway(gateway),
|
||||
m_loginLocation(loginLocation),
|
||||
m_attributes(attributes),
|
||||
m_inboxLimit(0),
|
||||
m_loginPriority(0),
|
||||
m_userID(userID),
|
||||
m_avatarID(avatarID),
|
||||
m_serverID(serverID),
|
||||
m_gatewayID(gatewayID)
|
||||
{
|
||||
}
|
||||
|
||||
ChatAvatarCore::ChatAvatarCore(unsigned avatarID, unsigned userID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &gateway, const ChatUnicodeString &server, unsigned gatewayID, unsigned serverID, const ChatUnicodeString &loginLocation, unsigned attributes)
|
||||
: m_name(name.string_data, name.string_length),
|
||||
m_address(address.string_data, address.string_length),
|
||||
m_server(server.string_data, server.string_length),
|
||||
m_gateway(gateway.string_data, gateway.string_length),
|
||||
m_loginLocation(loginLocation.string_data, loginLocation.string_length),
|
||||
m_attributes(attributes),
|
||||
m_inboxLimit(0),
|
||||
m_loginPriority(0),
|
||||
m_userID(userID),
|
||||
m_avatarID(avatarID),
|
||||
m_serverID(serverID),
|
||||
m_gatewayID(gatewayID)
|
||||
{
|
||||
}
|
||||
|
||||
ChatAvatarCore::ChatAvatarCore(unsigned avatarID, unsigned userID, const String &name, const String &address, const String &gateway, const String &server, unsigned gatewayID, unsigned serverID, const Plat_Unicode::String &loginLocation, unsigned attributes)
|
||||
: m_name(name),
|
||||
m_address(address),
|
||||
m_server(server),
|
||||
m_gateway(gateway),
|
||||
m_loginLocation(loginLocation),
|
||||
m_attributes(attributes),
|
||||
m_inboxLimit(0),
|
||||
m_loginPriority(0),
|
||||
m_userID(userID),
|
||||
m_avatarID(avatarID),
|
||||
m_serverID(serverID),
|
||||
m_gatewayID(gatewayID)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ChatAvatarCore::ChatAvatarCore(ByteStream::ReadIterator &iter)
|
||||
{
|
||||
get(iter, m_avatarID);
|
||||
get(iter, m_userID);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_name));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_address));
|
||||
get(iter, (uint32 &)m_attributes);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_loginLocation));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_server));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_gateway));
|
||||
get(iter, m_serverID);
|
||||
get(iter, m_gatewayID);
|
||||
|
||||
m_loginPriority = 0;
|
||||
m_inboxLimit = 0;
|
||||
}
|
||||
|
||||
ChatAvatarCore::ChatAvatarCore(const ChatAvatarCore &rhs)
|
||||
: m_name(rhs.m_name),
|
||||
m_address(rhs.m_address),
|
||||
m_server(rhs.m_server),
|
||||
m_gateway(rhs.m_gateway),
|
||||
m_loginLocation(rhs.m_loginLocation),
|
||||
m_email(rhs.m_email),
|
||||
m_statusMessage(rhs.m_statusMessage),
|
||||
m_attributes(rhs.m_attributes),
|
||||
m_inboxLimit(rhs.m_inboxLimit),
|
||||
m_loginPriority(rhs.m_loginPriority),
|
||||
m_userID(rhs.m_userID),
|
||||
m_avatarID(rhs.m_avatarID),
|
||||
m_serverID(rhs.m_serverID),
|
||||
m_gatewayID(rhs.m_gatewayID)
|
||||
{
|
||||
}
|
||||
|
||||
ChatAvatarCore &ChatAvatarCore::operator=(const ChatAvatarCore &rhs)
|
||||
{
|
||||
m_name = rhs.m_name;
|
||||
m_address = rhs.m_address;
|
||||
m_userID = rhs.m_userID;
|
||||
m_avatarID = rhs.m_avatarID;
|
||||
m_server = rhs.m_server;
|
||||
m_gateway = rhs.m_gateway;
|
||||
m_serverID = rhs.m_serverID;
|
||||
m_gatewayID = rhs.m_gatewayID;
|
||||
m_attributes = rhs.m_attributes;
|
||||
m_inboxLimit = rhs.m_inboxLimit;
|
||||
m_loginPriority = rhs.m_loginPriority;
|
||||
m_loginLocation = rhs.m_loginLocation;
|
||||
m_email = rhs.m_email;
|
||||
m_inboxLimit = rhs.m_inboxLimit;
|
||||
m_statusMessage = rhs.m_statusMessage;
|
||||
|
||||
return(*this);
|
||||
}
|
||||
|
||||
ChatAvatar *ChatAvatarCore::getNewChatAvatar() const
|
||||
{
|
||||
ChatUnicodeString addr(m_address.data(), m_address.size());
|
||||
ChatUnicodeString name(m_name.data(), m_name.size());
|
||||
ChatUnicodeString gateway(m_gateway.data(), m_gateway.size());
|
||||
ChatUnicodeString server(m_server.data(), m_server.size());
|
||||
|
||||
ChatAvatar *newChatAvatar = new ChatAvatar(m_avatarID,
|
||||
m_userID,
|
||||
name,
|
||||
addr,
|
||||
gateway,
|
||||
server,
|
||||
m_gatewayID,
|
||||
m_serverID,
|
||||
m_loginLocation,
|
||||
m_attributes);
|
||||
|
||||
newChatAvatar->setLoginPriority(m_loginPriority);
|
||||
newChatAvatar->setInboxLimit(m_inboxLimit);
|
||||
newChatAvatar->setForwardingEmail(m_email);
|
||||
newChatAvatar->setStatusMessage(m_statusMessage);
|
||||
|
||||
return (newChatAvatar);
|
||||
}
|
||||
|
||||
void ChatAvatarCore::serialize(Base::ByteStream &msg)
|
||||
{
|
||||
put(msg, m_avatarID);
|
||||
put(msg, m_userID);
|
||||
put(msg, m_name);
|
||||
put(msg, m_address);
|
||||
put(msg, (uint32)m_attributes);
|
||||
put(msg, m_loginLocation);
|
||||
}
|
||||
|
||||
void ChatAvatarCore::setAttributes(unsigned long attributes)
|
||||
{
|
||||
m_attributes = attributes;
|
||||
}
|
||||
|
||||
void ChatAvatarCore::setLoginPriority(int loginPriority)
|
||||
{
|
||||
m_loginPriority = loginPriority;
|
||||
}
|
||||
|
||||
void ChatAvatarCore::setEmail(const Plat_Unicode::String email)
|
||||
{
|
||||
m_email = email;
|
||||
}
|
||||
|
||||
void ChatAvatarCore::setInboxLimit(unsigned inboxLimit)
|
||||
{
|
||||
m_inboxLimit = inboxLimit;
|
||||
}
|
||||
|
||||
void ChatAvatarCore::setStatusMessage(const Plat_Unicode::String statusMessage)
|
||||
{
|
||||
m_statusMessage = statusMessage;
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,79 @@
|
||||
#if !defined (CHATAVATARCORE_H_)
|
||||
#define CHATAVATARCORE_H_
|
||||
|
||||
#pragma warning (disable : 4786)
|
||||
|
||||
#include <Base/Archive.h>
|
||||
#include <Unicode/Unicode.h>
|
||||
#include <Unicode/UnicodeUtils.h>
|
||||
|
||||
#include "ChatEnum.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
|
||||
|
||||
class ChatAvatar;
|
||||
|
||||
class ChatAvatarCore
|
||||
{
|
||||
public:
|
||||
ChatAvatarCore();
|
||||
ChatAvatarCore(Base::ByteStream::ReadIterator &iter);
|
||||
ChatAvatarCore(unsigned avatarID, unsigned userID, const unsigned short *name, const unsigned short *address, const unsigned short *gateway, const unsigned short *server, unsigned gatewayID, unsigned serverID, const unsigned short *loginLocation, unsigned attributes);
|
||||
ChatAvatarCore(unsigned avatarID, unsigned userID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &gateway, const ChatUnicodeString &server, unsigned gatewayID, unsigned serverID, const ChatUnicodeString &loginLocation, unsigned attributes);
|
||||
ChatAvatarCore(unsigned avatarID, unsigned userID, const Plat_Unicode::String &name, const Plat_Unicode::String &address, const Plat_Unicode::String &gateway, const Plat_Unicode::String &server, unsigned gatewayID, unsigned serverID, const Plat_Unicode::String &loginLocation, unsigned attributes);
|
||||
|
||||
|
||||
ChatAvatarCore(const ChatAvatarCore &rhs);
|
||||
~ChatAvatarCore() {};
|
||||
|
||||
const Plat_Unicode::String &getName() const { return m_name; }
|
||||
const Plat_Unicode::String &getAddress() const { return m_address; }
|
||||
unsigned getUserID() const { return m_userID; }
|
||||
unsigned getAvatarID() const { return m_avatarID; }
|
||||
const Plat_Unicode::String &getLoginLocation() const { return m_loginLocation; }
|
||||
int getLoginPriority() const { return m_loginPriority; }
|
||||
unsigned getAttributes() const { return m_attributes; }
|
||||
const Plat_Unicode::String &getEmail() const { return m_email; }
|
||||
unsigned getInboxLimit() const { return m_inboxLimit; }
|
||||
const Plat_Unicode::String &getServer() const { return m_server; }
|
||||
const Plat_Unicode::String &getGateway() const { return m_gateway; }
|
||||
unsigned getServerID() const { return m_serverID; }
|
||||
unsigned getGatewayID() const { return m_gatewayID; }
|
||||
const Plat_Unicode::String& getStatusMessage() { return m_statusMessage; }
|
||||
|
||||
ChatAvatar *getNewChatAvatar() const;
|
||||
|
||||
void setAttributes(unsigned long attributes);
|
||||
void setLoginPriority(int loginPriority);
|
||||
void setEmail(const Plat_Unicode::String email);
|
||||
void setInboxLimit(unsigned inboxLimit);
|
||||
void setStatusMessage(const Plat_Unicode::String statusMessage);
|
||||
|
||||
ChatAvatarCore &operator=(const ChatAvatarCore &rhs);
|
||||
|
||||
void serialize(Base::ByteStream &msg);
|
||||
private:
|
||||
Plat_Unicode::String m_name;
|
||||
Plat_Unicode::String m_address;
|
||||
Plat_Unicode::String m_server;
|
||||
Plat_Unicode::String m_gateway;
|
||||
Plat_Unicode::String m_loginLocation;
|
||||
Plat_Unicode::String m_email;
|
||||
Plat_Unicode::String m_statusMessage;
|
||||
|
||||
unsigned long m_attributes;
|
||||
unsigned long m_inboxLimit;
|
||||
int m_loginPriority;
|
||||
|
||||
unsigned m_userID;
|
||||
unsigned m_avatarID;
|
||||
unsigned m_serverID;
|
||||
unsigned m_gatewayID;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
#include "ChatEnum.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace ChatSystem {
|
||||
|
||||
using namespace std;
|
||||
using namespace Plat_Unicode;
|
||||
|
||||
Plat_Unicode::String ChatUnicodeString::getEmptyString()
|
||||
{
|
||||
return narrowToWide("");
|
||||
}
|
||||
|
||||
ChatUnicodeString::ChatUnicodeString()
|
||||
{
|
||||
m_wideString = getEmptyString();
|
||||
m_cString = wideToNarrow(m_wideString);
|
||||
}
|
||||
|
||||
ChatUnicodeString::ChatUnicodeString(const unsigned short *data, unsigned length)
|
||||
{
|
||||
m_wideString.assign(data, length);
|
||||
m_cString = wideToNarrow(m_wideString);
|
||||
}
|
||||
|
||||
ChatUnicodeString::ChatUnicodeString(const char *nData, unsigned length)
|
||||
{
|
||||
m_cString.assign(nData, length);
|
||||
m_wideString = narrowToWide(m_cString);
|
||||
}
|
||||
|
||||
ChatUnicodeString::ChatUnicodeString(const Plat_Unicode::String& src)
|
||||
{
|
||||
m_wideString = src;
|
||||
m_cString = wideToNarrow(m_wideString);
|
||||
}
|
||||
|
||||
ChatUnicodeString::ChatUnicodeString(const std::string& nSrc)
|
||||
{
|
||||
m_cString = nSrc;
|
||||
m_wideString = narrowToWide(m_cString);
|
||||
}
|
||||
|
||||
ChatUnicodeString::ChatUnicodeString(const char *nStrSrc)
|
||||
{
|
||||
if (nStrSrc==NULL)
|
||||
{
|
||||
m_wideString = getEmptyString();
|
||||
m_cString = wideToNarrow(m_wideString);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cString.assign(nStrSrc);
|
||||
m_wideString = narrowToWide(m_cString);
|
||||
}
|
||||
}
|
||||
|
||||
ChatUnicodeString::ChatUnicodeString(const ChatUnicodeString& src)
|
||||
{
|
||||
m_wideString = src.m_wideString;
|
||||
m_cString = wideToNarrow(m_wideString);
|
||||
}
|
||||
|
||||
// = operator
|
||||
ChatUnicodeString& ChatUnicodeString::operator=(const Plat_Unicode::String& src)
|
||||
{
|
||||
m_wideString = src;
|
||||
m_cString = wideToNarrow(m_wideString);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ChatUnicodeString& ChatUnicodeString::operator=(const std::string& nSrc)
|
||||
{
|
||||
m_cString = nSrc;
|
||||
m_wideString = narrowToWide(m_cString);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ChatUnicodeString& ChatUnicodeString::operator=(const char * nStrSrc)
|
||||
{
|
||||
m_cString = nStrSrc;
|
||||
m_wideString = narrowToWide(m_cString);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ChatUnicodeString& ChatUnicodeString::operator=(const ChatUnicodeString& src)
|
||||
{
|
||||
if (this != &src) {
|
||||
m_wideString = src.m_wideString;
|
||||
m_cString = wideToNarrow(m_wideString);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
// += operator
|
||||
ChatUnicodeString& ChatUnicodeString::operator+=(const ChatUnicodeString& src)
|
||||
{
|
||||
m_wideString += src.m_wideString;
|
||||
m_cString = wideToNarrow(m_wideString);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
// + operator
|
||||
ChatUnicodeString ChatUnicodeString::operator+(const ChatUnicodeString& src)
|
||||
{
|
||||
ChatUnicodeString tmp;
|
||||
|
||||
tmp.m_wideString = m_wideString + src.m_wideString;
|
||||
m_cString = wideToNarrow(m_wideString);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
const char *ChatUnicodeString::c_str() const {
|
||||
return m_cString.c_str();
|
||||
}
|
||||
|
||||
AvatarSnoopPair::AvatarSnoopPair(const Plat_Unicode::String &name, const Plat_Unicode::String &address)
|
||||
: m_name(name),
|
||||
m_address(address)
|
||||
{
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,214 @@
|
||||
#if !defined (CHATENUM_H_)
|
||||
#define CHATENUM_H_
|
||||
|
||||
#include <Unicode/Unicode.h>
|
||||
#include <Unicode/UnicodeUtils.h>
|
||||
|
||||
#pragma warning ( disable : 4786 )
|
||||
|
||||
// Defining _chatdebug_
|
||||
#ifdef _DEBUG
|
||||
#ifdef WIN32
|
||||
#define _chatdebug_ ::printf
|
||||
#else
|
||||
#define _chatdebug_ ::printf
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _DEBUG
|
||||
#ifdef WIN32
|
||||
#define _chatdebug_
|
||||
#else
|
||||
#define _chatdebug_
|
||||
#endif
|
||||
#endif
|
||||
// END: "Defining _chatdebug_"
|
||||
|
||||
|
||||
// Use AVATAR_PRIORITY_NOFORCELOGOUT on RequestAvatarLogin if you want to override the
|
||||
// "last login wins" rule, switching that given avatar's session to use "first login wins"
|
||||
#define AVATAR_PRIORITY_NOFORCELOGOUT ((int) 0x80000000) /*-2147483648*/
|
||||
|
||||
#define ASSERT_VALID_STRING_LENGTH(X) if (X ==0) return;
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
|
||||
enum eResultCodes
|
||||
{
|
||||
CHATRESULT_SUCCESS,
|
||||
|
||||
CHATRESULT_TIMEOUT = 1,
|
||||
CHATRESULT_DUPLICATELOGIN,
|
||||
CHATRESULT_SRCAVATARDOESNTEXIST,
|
||||
CHATRESULT_DESTAVATARDOESNTEXIST,
|
||||
CHATRESULT_ADDRESSDOESNTEXIST, // 5
|
||||
CHATRESULT_ADDRESSNOTROOM,
|
||||
CHATRESULT_ADDRESSNOTAID,
|
||||
CHATRESULT_FRIENDNOTFOUND,
|
||||
CHATRESULT_ROOM_UNKNOWNFAILURE,
|
||||
CHATRESULT_ROOM_SRCNOTINROOM, // 10
|
||||
CHATRESULT_ROOM_DESTNOTINROOM,
|
||||
CHATRESULT_ROOM_BANNEDAVATAR,
|
||||
CHATRESULT_ROOM_PRIVATEROOM,
|
||||
CHATRESULT_ROOM_MODERATEDROOM,
|
||||
CHATRESULT_ROOM_NOTINROOM, // 15
|
||||
CHATRESULT_ROOM_NOPRIVILEGES,
|
||||
CHATRESULT_DATABASE,
|
||||
CHATRESULT_CANNOTGETAVATARID,
|
||||
CHATRESULT_CANNOTGETNODEID,
|
||||
CHATRESULT_CANNOTGETPMSGID, // 20
|
||||
CHATRESULT_PMSGNOTFOUND,
|
||||
CHATRESULT_ROOMMAXAVATARSREACHED,
|
||||
CHATRESULT_IGNORING,
|
||||
CHATRESULT_ROOM_ALREADYEXISTS,
|
||||
CHATRESULT_NOTHINGTOCONFIRM, // 25
|
||||
CHATRESULT_DUPLICATEFRIEND,
|
||||
CHATRESULT_IGNORENOTFOUND,
|
||||
CHATRESULT_DUPLICATEIGNORE,
|
||||
CHATRESULT_DBFAIL,
|
||||
CHATRESULT_ROOM_DESTAVATARNOTMODERATOR, // 30
|
||||
CHATRESULT_ROOM_DESTAVATARNOTINVITED,
|
||||
CHATRESULT_ROOM_DESTAVATARNOTBANNED,
|
||||
CHATRESULT_ROOM_DUPLICATEBAN,
|
||||
CHATRESULT_ROOM_DUPLICATEMODERATOR,
|
||||
CHATRESULT_ROOM_DUPLICATEINVITE, // 35
|
||||
CHATRESULT_ROOM_ALREADYINROOM,
|
||||
CHATRESULT_ROOM_PARENTNONPERSISTENT,
|
||||
CHATRESULT_ROOM_PARENTBADNODETYPE,
|
||||
CHATRESULT_NOFANCLUBHANDLE,
|
||||
CHATRESULT_AIDALREADYEXISTS, // 40
|
||||
CHATRESULT_UIDALREADYEXISTS,
|
||||
CHATRESULT_WRONGCHATSERVERFORREQUEST,
|
||||
CHATRESULT_SUCCESSBADDATA,
|
||||
CHATRESULT_NULLNAMELOGIN,
|
||||
CHATRESULT_SERVER_IDENTITY_EMPTY, // 45
|
||||
CHATRESULT_SERVER_IDENTITY_TAKEN,
|
||||
CHATRESULT_REMOTESERVERDOWN,
|
||||
CHATRESULT_NODEIDCONFLICT,
|
||||
CHATRESULT_INVALIDNODENAME,
|
||||
CHATRESULT_INSUFFICIENTGMPRIVS, // 50
|
||||
CHATRESULT_SNOOPALREADYADDED,
|
||||
CHATRESULT_NOTSNOOPING,
|
||||
CHATRESULT_ROOM_DESTAVATARNOTTEMPORARYMODERATOR,
|
||||
CHATRESULT_ROOM_DESTAVATARNOTVOICE,
|
||||
CHATRESULT_ROOM_DUPLICATETEMPORARYMODERATOR, // 55
|
||||
CHATRESULT_ROOM_DUPLICATEVOICE,
|
||||
CHATRESULT_AVATARMUSTBELOGGEDOUT,
|
||||
CHATRESULT_NOTHINGTODO,
|
||||
CHATRESULT_TRANSFERNAMENULL,
|
||||
CHATRESULT_TRANSFERUSERIDZERO, // 60
|
||||
CHATRESULT_TRANSFERADDRESSNULL,
|
||||
CHATRESULT_OUTOFIDS,
|
||||
CHATRESULT_ROOM_LOCALROOM,
|
||||
CHATRESULT_ROOM_GAMEROOM,
|
||||
CHATRESULT_ROOM_DESTAVATARNOTENTERING, // 65
|
||||
CHATRESULT_INSUFFICIENTPRIORITY,
|
||||
CHATRESULT_ROOM_WAITINGFORENTRY,
|
||||
CHATRESULT_INBOXLIMITEXCEEDED,
|
||||
CHATRESULT_DUPLICATEDESTINATION,
|
||||
CHATRESULT_CATEGORYLIMITEXCEEDED, // 70
|
||||
CHATRESULT_MESSAGE_FILTER_FAILURE,
|
||||
CHATRESULT_INVALID_INPUT,
|
||||
|
||||
};
|
||||
|
||||
// Status for PersistentHeader objects as found in PersistentMessage.h
|
||||
enum PersistentStatus
|
||||
{
|
||||
PERSISTENT_NEW = 1,
|
||||
PERSISTENT_UNREAD,
|
||||
PERSISTENT_READ,
|
||||
PERSISTENT_TRASH,
|
||||
PERSISTENT_DELETED
|
||||
};
|
||||
|
||||
// Bit flags for persistent message alterations. These are used in RequestAlterPersistentMessage
|
||||
enum PersistentAlterationTypes
|
||||
{
|
||||
ALTER_SENDER = 1,
|
||||
ALTER_SUBJECT = 2,
|
||||
ALTER_MSG = 4,
|
||||
ALTER_OOB = 8,
|
||||
ALTER_SENT_TIME = 16,
|
||||
ALTER_CATEGORY = 32
|
||||
};
|
||||
|
||||
// Types of Snoop messages for OnReceiveSnoopMessage() callback in ChatAPI.h
|
||||
enum SnoopTypes
|
||||
{
|
||||
SNOOP_INSTANTMESSAGE,
|
||||
SNOOP_ROOMMESSAGE,
|
||||
SNOOP_PERSISTENTMESSAGE,
|
||||
SNOOP_END
|
||||
};
|
||||
|
||||
#define CHATUNICODESTRING_COMP_OPER_DECL(__oper__) \
|
||||
inline bool operator __oper__(const ChatUnicodeString &src) const \
|
||||
{ \
|
||||
return (m_wideString __oper__ src.m_wideString); \
|
||||
}
|
||||
|
||||
#define string_data data()
|
||||
#define string_length length()
|
||||
|
||||
class ChatUnicodeString {
|
||||
|
||||
private:
|
||||
Plat_Unicode::String m_wideString;
|
||||
Plat_Unicode::String getEmptyString();
|
||||
|
||||
std::string m_cString;
|
||||
|
||||
// const unsigned short *string_data;
|
||||
// unsigned string_length;
|
||||
|
||||
public:
|
||||
|
||||
ChatUnicodeString();
|
||||
ChatUnicodeString(const unsigned short *data, unsigned length);
|
||||
ChatUnicodeString(const char *nData, unsigned length);
|
||||
ChatUnicodeString(const Plat_Unicode::String& src);
|
||||
ChatUnicodeString(const std::string& nSrc);
|
||||
ChatUnicodeString(const char *nStrSrc);
|
||||
ChatUnicodeString(const ChatUnicodeString& src);
|
||||
|
||||
ChatUnicodeString& operator=(const std::string& nSrc);
|
||||
ChatUnicodeString& operator=(const Plat_Unicode::String& src);
|
||||
ChatUnicodeString& operator=(const char *nStrSrc);
|
||||
ChatUnicodeString& operator=(const ChatUnicodeString& src);
|
||||
|
||||
ChatUnicodeString& operator+=(const ChatUnicodeString& src);
|
||||
ChatUnicodeString operator+(const ChatUnicodeString& src);
|
||||
CHATUNICODESTRING_COMP_OPER_DECL(<)
|
||||
CHATUNICODESTRING_COMP_OPER_DECL(<=)
|
||||
CHATUNICODESTRING_COMP_OPER_DECL(==)
|
||||
CHATUNICODESTRING_COMP_OPER_DECL(!=)
|
||||
CHATUNICODESTRING_COMP_OPER_DECL(>=)
|
||||
CHATUNICODESTRING_COMP_OPER_DECL(>)
|
||||
inline unsigned length() const { return (unsigned)m_wideString.length(); }
|
||||
inline const unsigned short * data() const { return m_wideString.data(); }
|
||||
const char * c_str() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// class for OnGetSnoopList() callback to summarize a name/address pair
|
||||
class AvatarSnoopPair
|
||||
{
|
||||
public:
|
||||
AvatarSnoopPair(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
~AvatarSnoopPair() {}
|
||||
|
||||
const ChatUnicodeString &getAvatarName() const { return m_name; }
|
||||
const ChatUnicodeString &getAvatarAddress() const { return m_address; }
|
||||
|
||||
private:
|
||||
ChatUnicodeString m_name;
|
||||
ChatUnicodeString m_address;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#if !defined (CHATFRIENDSTATUS_H_)
|
||||
#define CHATFRIENDSTATUS_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ChatEnum.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
class ChatFriendStatusCore;
|
||||
|
||||
class ChatFriendStatus
|
||||
{
|
||||
public:
|
||||
ChatFriendStatus();
|
||||
~ChatFriendStatus();
|
||||
const ChatUnicodeString &getName() const;
|
||||
const ChatUnicodeString &getAddress() const;
|
||||
const ChatUnicodeString &getComment() const;
|
||||
short getStatus() const; // 0 = offline, else = online
|
||||
|
||||
friend class ChatFriendStatusCore;
|
||||
private:
|
||||
ChatUnicodeString m_name;
|
||||
ChatUnicodeString m_address;
|
||||
ChatUnicodeString m_comment;
|
||||
|
||||
ChatFriendStatusCore *m_core;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
#include "ChatFriendStatusCore.h"
|
||||
#include "ChatFriendStatus.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
|
||||
using namespace Base;
|
||||
using namespace Plat_Unicode;
|
||||
ChatFriendStatusCore::ChatFriendStatusCore()
|
||||
: m_interface(NULL),
|
||||
m_status(0)
|
||||
{
|
||||
}
|
||||
|
||||
void ChatFriendStatusCore::load(ByteStream::ReadIterator &iter, ChatFriendStatus *inf)
|
||||
{
|
||||
m_interface = inf;
|
||||
inf->m_core = this;
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_name));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_address));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_comment));
|
||||
get(iter, m_status);
|
||||
|
||||
m_interface->m_name = m_name;
|
||||
m_interface->m_address = m_address;
|
||||
m_interface->m_comment = m_comment;
|
||||
}
|
||||
|
||||
ChatFriendStatusCore::~ChatFriendStatusCore()
|
||||
{
|
||||
}
|
||||
|
||||
ChatFriendStatus::ChatFriendStatus()
|
||||
: m_core(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
ChatFriendStatus::~ChatFriendStatus()
|
||||
{
|
||||
}
|
||||
|
||||
const ChatUnicodeString &ChatFriendStatus::getName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
const ChatUnicodeString &ChatFriendStatus::getAddress() const
|
||||
{
|
||||
return m_address;
|
||||
}
|
||||
|
||||
const ChatUnicodeString &ChatFriendStatus::getComment() const
|
||||
{
|
||||
return m_comment;
|
||||
}
|
||||
|
||||
short ChatFriendStatus::getStatus() const
|
||||
{
|
||||
return m_core->getStatus();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#if !defined (CHATFRIENDSTATUSCORE_H_)
|
||||
#define CHATFRIENDSTATUSCORE_H_
|
||||
|
||||
#include <Base/Archive.h>
|
||||
#include <Unicode/Unicode.h>
|
||||
#include <Unicode/UnicodeUtils.h>
|
||||
|
||||
#include "ChatEnum.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
|
||||
|
||||
class ChatFriendStatus;
|
||||
|
||||
class ChatFriendStatusCore
|
||||
{
|
||||
public:
|
||||
ChatFriendStatusCore();
|
||||
~ChatFriendStatusCore();
|
||||
|
||||
const Plat_Unicode::String &getName() const { return m_name; }
|
||||
const Plat_Unicode::String &getAddress() const { return m_address; }
|
||||
short getStatus() const { return m_status; }
|
||||
|
||||
void load(Base::ByteStream::ReadIterator &iter, ChatFriendStatus *inf);
|
||||
|
||||
private:
|
||||
ChatFriendStatus *m_interface;
|
||||
Plat_Unicode::String m_name;
|
||||
Plat_Unicode::String m_address;
|
||||
Plat_Unicode::String m_comment;
|
||||
|
||||
short m_status;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#if !defined (CHATIGNORESTATUS_H_)
|
||||
#define CHATIGNORESTATUS_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ChatEnum.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
class ChatIgnoreStatusCore;
|
||||
|
||||
class ChatIgnoreStatus
|
||||
{
|
||||
public:
|
||||
ChatIgnoreStatus();
|
||||
~ChatIgnoreStatus();
|
||||
const ChatUnicodeString &getName() const { return m_name; }
|
||||
const ChatUnicodeString &getAddress() const { return m_address; }
|
||||
|
||||
friend class ChatIgnoreStatusCore;
|
||||
private:
|
||||
ChatUnicodeString m_name;
|
||||
ChatUnicodeString m_address;
|
||||
|
||||
ChatIgnoreStatusCore *m_core;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#include "ChatIgnoreStatusCore.h"
|
||||
#include "ChatIgnoreStatus.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
using namespace Base;
|
||||
using namespace Plat_Unicode;
|
||||
|
||||
ChatIgnoreStatus::ChatIgnoreStatus()
|
||||
: m_core(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
ChatIgnoreStatus::~ChatIgnoreStatus()
|
||||
{
|
||||
}
|
||||
|
||||
ChatIgnoreStatusCore::ChatIgnoreStatusCore()
|
||||
: m_interface(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
ChatIgnoreStatusCore::~ChatIgnoreStatusCore()
|
||||
{
|
||||
}
|
||||
|
||||
void ChatIgnoreStatusCore::load(Base::ByteStream::ReadIterator &iter, ChatIgnoreStatus *inf)
|
||||
{
|
||||
m_interface = inf;
|
||||
inf->m_core = this;
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_name));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_address));
|
||||
|
||||
m_interface->m_name = m_name;
|
||||
m_interface->m_address = m_address;
|
||||
}
|
||||
};
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#if !defined (CHATIGNORESTATUSCORE_H_)
|
||||
#define CHATIGNORESTATUSCORE_H_
|
||||
|
||||
#include <Base/Archive.h>
|
||||
#include <Unicode/Unicode.h>
|
||||
#include <Unicode/UnicodeUtils.h>
|
||||
|
||||
#include "ChatEnum.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
|
||||
|
||||
class ChatIgnoreStatus;
|
||||
|
||||
class ChatIgnoreStatusCore
|
||||
{
|
||||
public:
|
||||
ChatIgnoreStatusCore();
|
||||
~ChatIgnoreStatusCore();
|
||||
|
||||
const Plat_Unicode::String &getName() const { return m_name; }
|
||||
const Plat_Unicode::String &getAddress() const { return m_address; }
|
||||
|
||||
void load(Base::ByteStream::ReadIterator &iter, ChatIgnoreStatus *inf);
|
||||
|
||||
private:
|
||||
ChatIgnoreStatus *m_interface;
|
||||
Plat_Unicode::String m_name;
|
||||
Plat_Unicode::String m_address;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,777 @@
|
||||
#include "ChatRoom.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "AvatarIteratorCore.h"
|
||||
#include "ChatRoomCore.h"
|
||||
#include "ChatAvatar.h"
|
||||
#include "ChatAvatarCore.h"
|
||||
#include "RoomParamsCore.h"
|
||||
#include "RoomSummaryCore.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
using namespace Plat_Unicode;
|
||||
using namespace std;
|
||||
|
||||
|
||||
// AVATAR ITERATOR
|
||||
|
||||
AvatarIterator::AvatarIterator()
|
||||
{
|
||||
m_core = new AvatarIteratorCore();
|
||||
}
|
||||
|
||||
AvatarIterator::AvatarIterator(const AvatarIteratorCore &core)
|
||||
{
|
||||
m_core = new AvatarIteratorCore();
|
||||
|
||||
(*m_core) = core;
|
||||
}
|
||||
|
||||
AvatarIterator::~AvatarIterator()
|
||||
{
|
||||
delete m_core;
|
||||
}
|
||||
|
||||
AvatarIterator &AvatarIterator::operator=(const AvatarIterator &rhs)
|
||||
{
|
||||
(*m_core) = *(rhs.m_core);
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void AvatarIterator::operator++()
|
||||
{
|
||||
m_core->increment();
|
||||
}
|
||||
|
||||
void AvatarIterator::operator++(int dummyForPostfix)
|
||||
{
|
||||
m_core->increment();
|
||||
}
|
||||
|
||||
void AvatarIterator::operator--()
|
||||
{
|
||||
m_core->decrement();
|
||||
}
|
||||
|
||||
void AvatarIterator::operator--(int dummyForPostfix)
|
||||
{
|
||||
m_core->decrement();
|
||||
}
|
||||
|
||||
ChatAvatar *AvatarIterator::operator*()
|
||||
{
|
||||
return (m_core->getCurAvatar());
|
||||
}
|
||||
|
||||
bool AvatarIterator::outOfBounds()
|
||||
{
|
||||
return (m_core->outOfBounds());
|
||||
}
|
||||
|
||||
// MODERATOR ITERATOR
|
||||
|
||||
ModeratorIterator::ModeratorIterator()
|
||||
{
|
||||
m_core = new ModeratorIteratorCore();
|
||||
}
|
||||
|
||||
ModeratorIterator::ModeratorIterator(const ModeratorIteratorCore &core)
|
||||
{
|
||||
m_core = new ModeratorIteratorCore();
|
||||
|
||||
(*m_core) = core;
|
||||
}
|
||||
|
||||
ModeratorIterator::~ModeratorIterator()
|
||||
{
|
||||
delete m_core;
|
||||
}
|
||||
|
||||
ModeratorIterator &ModeratorIterator::operator=(const ModeratorIterator &rhs)
|
||||
{
|
||||
(*m_core) = *(rhs.m_core);
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void ModeratorIterator::operator++()
|
||||
{
|
||||
m_core->increment();
|
||||
}
|
||||
|
||||
void ModeratorIterator::operator++(int dummyForPostfix)
|
||||
{
|
||||
m_core->increment();
|
||||
}
|
||||
|
||||
void ModeratorIterator::operator--()
|
||||
{
|
||||
m_core->decrement();
|
||||
}
|
||||
|
||||
void ModeratorIterator::operator--(int dummyForPostfix)
|
||||
{
|
||||
m_core->decrement();
|
||||
}
|
||||
ChatAvatar *ModeratorIterator::operator*()
|
||||
{
|
||||
return (m_core->getCurAvatar());
|
||||
}
|
||||
|
||||
bool ModeratorIterator::outOfBounds()
|
||||
{
|
||||
return (m_core->outOfBounds());
|
||||
}
|
||||
|
||||
// TEMPORARY MODERATOR ITERATOR
|
||||
|
||||
TemporaryModeratorIterator::TemporaryModeratorIterator()
|
||||
{
|
||||
m_core = new TemporaryModeratorIteratorCore();
|
||||
}
|
||||
|
||||
TemporaryModeratorIterator::TemporaryModeratorIterator(const TemporaryModeratorIteratorCore &core)
|
||||
{
|
||||
m_core = new TemporaryModeratorIteratorCore();
|
||||
|
||||
(*m_core) = core;
|
||||
}
|
||||
|
||||
TemporaryModeratorIterator::~TemporaryModeratorIterator()
|
||||
{
|
||||
delete m_core;
|
||||
}
|
||||
|
||||
TemporaryModeratorIterator &TemporaryModeratorIterator::operator=(const TemporaryModeratorIterator &rhs)
|
||||
{
|
||||
(*m_core) = *(rhs.m_core);
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void TemporaryModeratorIterator::operator++()
|
||||
{
|
||||
m_core->increment();
|
||||
}
|
||||
|
||||
void TemporaryModeratorIterator::operator++(int dummyForPostfix)
|
||||
{
|
||||
m_core->increment();
|
||||
}
|
||||
|
||||
void TemporaryModeratorIterator::operator--()
|
||||
{
|
||||
m_core->decrement();
|
||||
}
|
||||
|
||||
void TemporaryModeratorIterator::operator--(int dummyForPostfix)
|
||||
{
|
||||
m_core->decrement();
|
||||
}
|
||||
ChatAvatar *TemporaryModeratorIterator::operator*()
|
||||
{
|
||||
return (m_core->getCurAvatar());
|
||||
}
|
||||
|
||||
bool TemporaryModeratorIterator::outOfBounds()
|
||||
{
|
||||
return (m_core->outOfBounds());
|
||||
}
|
||||
|
||||
// VOICE ITERATOR
|
||||
|
||||
VoiceIterator::VoiceIterator()
|
||||
{
|
||||
m_core = new VoiceIteratorCore();
|
||||
}
|
||||
|
||||
VoiceIterator::VoiceIterator(const VoiceIteratorCore &core)
|
||||
{
|
||||
m_core = new VoiceIteratorCore();
|
||||
|
||||
(*m_core) = core;
|
||||
}
|
||||
|
||||
VoiceIterator::~VoiceIterator()
|
||||
{
|
||||
delete m_core;
|
||||
}
|
||||
|
||||
VoiceIterator &VoiceIterator::operator=(const VoiceIterator &rhs)
|
||||
{
|
||||
(*m_core) = *(rhs.m_core);
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void VoiceIterator::operator++()
|
||||
{
|
||||
m_core->increment();
|
||||
}
|
||||
|
||||
void VoiceIterator::operator++(int dummyForPostfix)
|
||||
{
|
||||
m_core->increment();
|
||||
}
|
||||
|
||||
void VoiceIterator::operator--()
|
||||
{
|
||||
m_core->decrement();
|
||||
}
|
||||
|
||||
void VoiceIterator::operator--(int dummyForPostfix)
|
||||
{
|
||||
m_core->decrement();
|
||||
}
|
||||
|
||||
ChatAvatar *VoiceIterator::operator*()
|
||||
{
|
||||
return (m_core->getCurAvatar());
|
||||
}
|
||||
|
||||
bool VoiceIterator::outOfBounds()
|
||||
{
|
||||
return (m_core->outOfBounds());
|
||||
}
|
||||
|
||||
// INVITE ITERATOR
|
||||
|
||||
InviteIterator::InviteIterator()
|
||||
{
|
||||
m_core = new InviteIteratorCore();
|
||||
}
|
||||
|
||||
InviteIterator::InviteIterator(const InviteIteratorCore &core)
|
||||
{
|
||||
m_core = new InviteIteratorCore();
|
||||
|
||||
(*m_core) = core;
|
||||
}
|
||||
|
||||
InviteIterator::~InviteIterator()
|
||||
{
|
||||
delete m_core;
|
||||
}
|
||||
|
||||
InviteIterator &InviteIterator::operator=(const InviteIterator &rhs)
|
||||
{
|
||||
(*m_core) = *(rhs.m_core);
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void InviteIterator::operator++()
|
||||
{
|
||||
m_core->increment();
|
||||
}
|
||||
|
||||
void InviteIterator::operator++(int dummyForPostfix)
|
||||
{
|
||||
m_core->increment();
|
||||
}
|
||||
|
||||
void InviteIterator::operator--()
|
||||
{
|
||||
m_core->decrement();
|
||||
}
|
||||
|
||||
void InviteIterator::operator--(int dummyForPostfix)
|
||||
{
|
||||
m_core->decrement();
|
||||
}
|
||||
|
||||
ChatAvatar *InviteIterator::operator*()
|
||||
{
|
||||
return (m_core->getCurAvatar());
|
||||
}
|
||||
|
||||
bool InviteIterator::outOfBounds()
|
||||
{
|
||||
return (m_core->outOfBounds());
|
||||
}
|
||||
|
||||
// BAN ITERATOR
|
||||
|
||||
BanIterator::BanIterator()
|
||||
{
|
||||
m_core = new BanIteratorCore();
|
||||
}
|
||||
|
||||
BanIterator::BanIterator(const BanIteratorCore &core)
|
||||
{
|
||||
m_core = new BanIteratorCore();
|
||||
|
||||
(*m_core) = core;
|
||||
}
|
||||
|
||||
BanIterator::~BanIterator()
|
||||
{
|
||||
delete m_core;
|
||||
}
|
||||
|
||||
BanIterator &BanIterator::operator=(const BanIterator &rhs)
|
||||
{
|
||||
(*m_core) = *(rhs.m_core);
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void BanIterator::operator++()
|
||||
{
|
||||
m_core->increment();
|
||||
}
|
||||
|
||||
void BanIterator::operator++(int dummyForPostfix)
|
||||
{
|
||||
m_core->increment();
|
||||
}
|
||||
|
||||
void BanIterator::operator--()
|
||||
{
|
||||
m_core->decrement();
|
||||
}
|
||||
|
||||
void BanIterator::operator--(int dummyForPostfix)
|
||||
{
|
||||
m_core->decrement();
|
||||
}
|
||||
|
||||
ChatAvatar *BanIterator::operator*()
|
||||
{
|
||||
return (m_core->getCurAvatar());
|
||||
}
|
||||
|
||||
bool BanIterator::outOfBounds()
|
||||
{
|
||||
return (m_core->outOfBounds());
|
||||
}
|
||||
|
||||
|
||||
// ROOM PARAMS
|
||||
|
||||
RoomParams::RoomParams()
|
||||
{
|
||||
m_core = new struct RoomParamsCore;
|
||||
m_core->m_attributes = 0;
|
||||
m_core->m_size = 0;
|
||||
}
|
||||
|
||||
|
||||
RoomParams::RoomParams(const ChatUnicodeString &name, const ChatUnicodeString &topic, unsigned attributes, unsigned maxSize)
|
||||
{
|
||||
m_core = new struct RoomParamsCore;
|
||||
|
||||
m_core->m_name.assign(name.string_data, name.string_length);
|
||||
m_cName = m_core->m_name;
|
||||
|
||||
m_core->m_topic.assign(topic.string_data, topic.string_length);
|
||||
m_cTopic = m_core->m_topic;
|
||||
|
||||
m_cPassword = m_core->m_password;
|
||||
|
||||
m_core->m_attributes = attributes;
|
||||
m_core->m_size = maxSize;
|
||||
}
|
||||
|
||||
RoomParams::RoomParams(const ChatUnicodeString &name, const ChatUnicodeString &topic, const ChatUnicodeString &password, unsigned attributes, unsigned maxSize)
|
||||
{
|
||||
m_core = new struct RoomParamsCore;
|
||||
|
||||
m_core->m_name.assign(name.string_data, name.string_length);
|
||||
m_cName = m_core->m_name;
|
||||
|
||||
m_core->m_topic.assign(topic.string_data, topic.string_length);
|
||||
m_cTopic = m_core->m_topic;
|
||||
|
||||
m_core->m_password.assign(password.string_data, password.string_length);
|
||||
m_cPassword = m_core->m_password;
|
||||
|
||||
m_core->m_attributes = attributes;
|
||||
m_core->m_size = maxSize;
|
||||
}
|
||||
|
||||
RoomParams::RoomParams(const RoomParams &orig) : m_core(new struct RoomParamsCore)
|
||||
{
|
||||
this->setRoomName(orig.getRoomName());
|
||||
this->setRoomTopic(orig.getRoomTopic());
|
||||
this->setRoomPassword(orig.getRoomPassword());
|
||||
this->setRoomAttributes(orig.getRoomAttributes());
|
||||
this->setRoomMaxSize(orig.getRoomMaxSize());
|
||||
}
|
||||
|
||||
RoomParams::~RoomParams()
|
||||
{
|
||||
delete m_core;
|
||||
}
|
||||
|
||||
RoomParams &RoomParams::operator=(const RoomParams &rhs)
|
||||
{
|
||||
this->setRoomName(rhs.getRoomName());
|
||||
this->setRoomTopic(rhs.getRoomTopic());
|
||||
this->setRoomPassword(rhs.getRoomPassword());
|
||||
this->setRoomAttributes(rhs.getRoomAttributes());
|
||||
this->setRoomMaxSize(rhs.getRoomMaxSize());
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void RoomParams::setRoomName(const ChatUnicodeString &name)
|
||||
{
|
||||
m_core->m_name.assign(name.string_data, name.string_length);
|
||||
m_cName = m_core->m_name;
|
||||
}
|
||||
|
||||
void RoomParams::setRoomTopic(const ChatUnicodeString &topic)
|
||||
{
|
||||
m_core->m_topic.assign(topic.string_data, topic.string_length);
|
||||
m_cTopic = m_core->m_topic;
|
||||
}
|
||||
|
||||
void RoomParams::setRoomPassword(const ChatUnicodeString &password)
|
||||
{
|
||||
m_core->m_password.assign(password.string_data, password.string_length);
|
||||
m_cPassword = m_core->m_password;
|
||||
}
|
||||
|
||||
void RoomParams::setRoomAttributes(unsigned attributes)
|
||||
{
|
||||
m_core->m_attributes = attributes;
|
||||
}
|
||||
|
||||
void RoomParams::setRoomMaxSize(unsigned size)
|
||||
{
|
||||
m_core->m_size = size;
|
||||
}
|
||||
|
||||
const ChatUnicodeString &RoomParams::getRoomName() const
|
||||
{
|
||||
m_cName = m_core->m_name;
|
||||
return (m_cName);
|
||||
}
|
||||
|
||||
const ChatUnicodeString &RoomParams::getRoomTopic() const
|
||||
{
|
||||
m_cTopic = m_core->m_topic;
|
||||
return (m_cTopic);
|
||||
}
|
||||
|
||||
const ChatUnicodeString &RoomParams::getRoomPassword() const
|
||||
{
|
||||
m_cPassword = m_core->m_password;
|
||||
return (m_cPassword);
|
||||
}
|
||||
|
||||
unsigned RoomParams::getRoomAttributes() const
|
||||
{
|
||||
return (m_core->m_attributes);
|
||||
}
|
||||
|
||||
unsigned RoomParams::getRoomMaxSize() const
|
||||
{
|
||||
return (m_core->m_size);
|
||||
}
|
||||
|
||||
// ROOM SUMMARY
|
||||
|
||||
RoomSummary::RoomSummary()
|
||||
{
|
||||
m_core = new struct RoomSummaryCore;
|
||||
m_core->m_attributes = 0;
|
||||
m_core->m_curSize = 0;
|
||||
m_core->m_maxSize = 0;
|
||||
}
|
||||
|
||||
RoomSummary::RoomSummary(const ChatUnicodeString &address, const ChatUnicodeString &topic, unsigned attributes, unsigned curSize, unsigned maxSize)
|
||||
{
|
||||
m_core = new struct RoomSummaryCore;
|
||||
|
||||
m_core->m_address.assign(address.string_data, address.string_length);
|
||||
m_cAddress = m_core->m_address;
|
||||
|
||||
m_core->m_topic.assign(address.string_data, address.string_length);
|
||||
m_cTopic = m_core->m_address;
|
||||
|
||||
m_core->m_attributes = attributes;
|
||||
m_core->m_curSize = curSize;
|
||||
m_core->m_maxSize = maxSize;
|
||||
}
|
||||
|
||||
RoomSummary::~RoomSummary()
|
||||
{
|
||||
delete m_core;
|
||||
}
|
||||
|
||||
RoomSummary &RoomSummary::operator=(const RoomSummary &rhs)
|
||||
{
|
||||
this->setRoomAddress(rhs.getRoomAddress());
|
||||
m_cAddress= m_core->m_address;
|
||||
|
||||
this->setRoomTopic(rhs.getRoomTopic());
|
||||
m_cTopic = m_core->m_address;
|
||||
|
||||
this->setRoomAttributes(rhs.getRoomAttributes());
|
||||
this->setRoomCurSize(rhs.getRoomCurSize());
|
||||
this->setRoomMaxSize(rhs.getRoomMaxSize());
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void RoomSummary::setRoomAddress(const ChatUnicodeString &address)
|
||||
{
|
||||
m_core->m_address.assign(address.string_data, address.string_length);
|
||||
m_cAddress = m_core->m_address;
|
||||
|
||||
}
|
||||
|
||||
void RoomSummary::setRoomTopic(const ChatUnicodeString &topic)
|
||||
{
|
||||
m_core->m_topic.assign(topic.string_data, topic.string_length);
|
||||
m_cTopic = m_core->m_address;
|
||||
}
|
||||
|
||||
void RoomSummary::setRoomAttributes(unsigned attributes)
|
||||
{
|
||||
m_core->m_attributes = attributes;
|
||||
}
|
||||
|
||||
void RoomSummary::setRoomCurSize(unsigned curSize)
|
||||
{
|
||||
m_core->m_curSize = curSize;
|
||||
}
|
||||
|
||||
void RoomSummary::setRoomMaxSize(unsigned maxSize)
|
||||
{
|
||||
m_core->m_maxSize = maxSize;
|
||||
}
|
||||
|
||||
const ChatUnicodeString &RoomSummary::getRoomAddress() const
|
||||
{
|
||||
m_cAddress = m_core->m_address;
|
||||
|
||||
return (m_cAddress);
|
||||
}
|
||||
|
||||
const ChatUnicodeString &RoomSummary::getRoomTopic() const
|
||||
{
|
||||
m_cTopic = m_core->m_topic;
|
||||
|
||||
return (m_cTopic);
|
||||
}
|
||||
|
||||
unsigned RoomSummary::getRoomAttributes() const
|
||||
{
|
||||
return (m_core->m_attributes);
|
||||
}
|
||||
|
||||
unsigned RoomSummary::getRoomCurSize() const
|
||||
{
|
||||
return (m_core->m_curSize);
|
||||
}
|
||||
|
||||
unsigned RoomSummary::getRoomMaxSize() const
|
||||
{
|
||||
return (m_core->m_maxSize);
|
||||
}
|
||||
|
||||
|
||||
// CHAT ROOM
|
||||
|
||||
ChatRoom::ChatRoom()
|
||||
{
|
||||
m_core = NULL;
|
||||
}
|
||||
|
||||
ChatRoom::ChatRoom(ChatRoomCore *core)
|
||||
: m_core(core)
|
||||
{
|
||||
}
|
||||
|
||||
ChatRoom::~ChatRoom()
|
||||
{
|
||||
}
|
||||
|
||||
const ChatUnicodeString &ChatRoom::getCreatorName() const
|
||||
{
|
||||
m_cCreatorName = m_core->getCreatorName();
|
||||
|
||||
return (m_cCreatorName);
|
||||
}
|
||||
|
||||
const ChatUnicodeString &ChatRoom::getCreatorAddress() const
|
||||
{
|
||||
m_cCreatorAddress = m_core->getCreatorAddress();
|
||||
|
||||
return (m_cCreatorAddress);
|
||||
}
|
||||
|
||||
unsigned ChatRoom::getCreatorID() const
|
||||
{
|
||||
return (m_core->getCreatorID());
|
||||
}
|
||||
|
||||
unsigned ChatRoom::getRoomID() const
|
||||
{
|
||||
return (m_core->getRoomID());
|
||||
}
|
||||
|
||||
const ChatUnicodeString &ChatRoom::getRoomName() const
|
||||
{
|
||||
m_cRoomName = m_core->getRoomName();
|
||||
|
||||
return(m_cRoomName);
|
||||
}
|
||||
|
||||
const ChatUnicodeString &ChatRoom::getRoomTopic() const
|
||||
{
|
||||
m_cRoomTopic = m_core->getRoomTopic();
|
||||
|
||||
return(m_cRoomTopic);
|
||||
}
|
||||
|
||||
const ChatUnicodeString &ChatRoom::getRoomPassword() const
|
||||
{
|
||||
m_cRoomPassword = m_core->getRoomPassword();
|
||||
|
||||
return(m_cRoomPassword);
|
||||
}
|
||||
|
||||
unsigned ChatRoom::getRoomAttributes() const
|
||||
{
|
||||
return (m_core->getRoomAttributes());
|
||||
}
|
||||
|
||||
unsigned ChatRoom::getMaxRoomSize() const
|
||||
{
|
||||
return (m_core->getMaxRoomSize());
|
||||
}
|
||||
|
||||
const ChatUnicodeString &ChatRoom::getAddress() const
|
||||
{
|
||||
m_cRoomAddress = m_core->getAddress();
|
||||
|
||||
return (m_cRoomAddress);
|
||||
}
|
||||
|
||||
unsigned ChatRoom::getAvatarCount() const
|
||||
{
|
||||
return (m_core->getAvatarCount());
|
||||
}
|
||||
|
||||
unsigned ChatRoom::getBanCount() const
|
||||
{
|
||||
return (m_core->getBanCount());
|
||||
}
|
||||
|
||||
unsigned ChatRoom::getInviteCount() const
|
||||
{
|
||||
return (m_core->getInviteCount());
|
||||
}
|
||||
|
||||
unsigned ChatRoom::getModeratorCount() const
|
||||
{
|
||||
return (m_core->getModeratorCount());
|
||||
}
|
||||
|
||||
unsigned ChatRoom::getTemporaryModeratorCount() const
|
||||
{
|
||||
return (m_core->getTemporaryModeratorCount());
|
||||
}
|
||||
|
||||
unsigned ChatRoom::getVoiceCount() const
|
||||
{
|
||||
return (m_core->getVoiceCount());
|
||||
}
|
||||
|
||||
AvatarIterator ChatRoom::getFirstAvatar() const
|
||||
{
|
||||
return (AvatarIterator(m_core->getFirstAvatar()));
|
||||
}
|
||||
|
||||
AvatarIterator ChatRoom::findAvatar(unsigned avatarID) const
|
||||
{
|
||||
return (AvatarIterator(m_core->findAvatar(avatarID)));
|
||||
}
|
||||
|
||||
AvatarIterator ChatRoom::findAvatar(const ChatUnicodeString &name, const ChatUnicodeString &address) const
|
||||
{
|
||||
String uni_name(name.string_data, name.string_length);
|
||||
String uni_addr(address.string_data, address.string_length);
|
||||
|
||||
return (AvatarIterator(m_core->findAvatar(uni_name, uni_addr)));
|
||||
}
|
||||
|
||||
ModeratorIterator ChatRoom::getFirstModerator() const
|
||||
{
|
||||
return (ModeratorIterator(m_core->getFirstModerator()));
|
||||
}
|
||||
|
||||
ModeratorIterator ChatRoom::findModerator(const ChatUnicodeString &name, const ChatUnicodeString &address) const
|
||||
{
|
||||
String uni_name(name.string_data, name.string_length);
|
||||
String uni_addr(address.string_data, address.string_length);
|
||||
|
||||
return (ModeratorIterator(m_core->findModerator(uni_name, uni_addr)));
|
||||
}
|
||||
|
||||
TemporaryModeratorIterator ChatRoom::getFirstTemporaryModerator() const
|
||||
{
|
||||
return (TemporaryModeratorIterator(m_core->getFirstTemporaryModerator()));
|
||||
}
|
||||
|
||||
TemporaryModeratorIterator ChatRoom::findTemporaryModerator(const ChatUnicodeString &name, const ChatUnicodeString &address) const
|
||||
{
|
||||
String uni_name(name.string_data, name.string_length);
|
||||
String uni_addr(address.string_data, address.string_length);
|
||||
|
||||
return (TemporaryModeratorIterator(m_core->findTemporaryModerator(uni_name, uni_addr)));
|
||||
}
|
||||
|
||||
BanIterator ChatRoom::getFirstBanned() const
|
||||
{
|
||||
return (BanIterator(m_core->getFirstBanned()));
|
||||
}
|
||||
|
||||
BanIterator ChatRoom::findBanned(const ChatUnicodeString &name, const ChatUnicodeString &address) const
|
||||
{
|
||||
String uni_name(name.string_data, name.string_length);
|
||||
String uni_addr(address.string_data, address.string_length);
|
||||
|
||||
return (BanIterator(m_core->findBanned(uni_name, uni_addr)));
|
||||
}
|
||||
|
||||
InviteIterator ChatRoom::getFirstInvited() const
|
||||
{
|
||||
return (InviteIterator(m_core->getFirstInvited()));
|
||||
}
|
||||
|
||||
InviteIterator ChatRoom::findInvited(const ChatUnicodeString &name, const ChatUnicodeString &address) const
|
||||
{
|
||||
String uni_name(name.string_data, name.string_length);
|
||||
String uni_addr(address.string_data, address.string_length);
|
||||
|
||||
return (InviteIterator(m_core->findInvited(uni_name, uni_addr)));
|
||||
}
|
||||
|
||||
VoiceIterator ChatRoom::getFirstVoice() const
|
||||
{
|
||||
return (VoiceIterator(m_core->getFirstVoice()));
|
||||
}
|
||||
|
||||
VoiceIterator ChatRoom::findVoice(const ChatUnicodeString &name, const ChatUnicodeString &address) const
|
||||
{
|
||||
String uni_name(name.string_data, name.string_length);
|
||||
String uni_addr(address.string_data, address.string_length);
|
||||
|
||||
return (VoiceIterator(m_core->findVoice(uni_name, uni_addr)));
|
||||
}
|
||||
|
||||
void ChatRoom::setRoomMessageID(unsigned roomMessageID)
|
||||
{
|
||||
m_core->setRoomMessageID(roomMessageID);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -0,0 +1,422 @@
|
||||
#if !defined (CHATROOM_H_)
|
||||
#define CHATROOM_H_
|
||||
|
||||
#pragma warning (disable : 4786)
|
||||
#pragma warning (disable : 4620)
|
||||
|
||||
#include "ChatEnum.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
|
||||
|
||||
class ChatAvatar;
|
||||
class ChatRoomCore;
|
||||
class AvatarIteratorCore;
|
||||
class ModeratorIteratorCore;
|
||||
class TemporaryModeratorIteratorCore;
|
||||
class VoiceIteratorCore;
|
||||
class InviteIteratorCore;
|
||||
class BanIteratorCore;
|
||||
struct RoomParamsCore;
|
||||
struct RoomSummaryCore;
|
||||
|
||||
|
||||
// Room attribute test macros
|
||||
// example: IS_SET(myRoomAttributes, ROOMATTR_PERSISTENT)
|
||||
inline unsigned IS_SET(unsigned var, unsigned bit)
|
||||
{
|
||||
return (var & bit);
|
||||
}
|
||||
|
||||
inline unsigned SET_BIT(unsigned &var, unsigned bit)
|
||||
{
|
||||
var |= bit;
|
||||
return(var);
|
||||
}
|
||||
|
||||
inline unsigned REMOVE_BIT(unsigned &var, unsigned bit)
|
||||
{
|
||||
var &= ~bit;
|
||||
return(var);
|
||||
}
|
||||
|
||||
enum RoomAttributes
|
||||
{
|
||||
ROOMATTR_PRIVATE = 1<<0,
|
||||
ROOMATTR_MODERATED = 1<<1,
|
||||
ROOMATTR_PERSISTENT = 1<<2,
|
||||
ROOMATTR_LOCAL_WORLD = 1<<4,
|
||||
ROOMATTR_LOCAL_GAME = 1<<5
|
||||
};
|
||||
|
||||
|
||||
// class RoomParams
|
||||
//
|
||||
// Description:
|
||||
// This class stores the basic room parameters for creating a room.
|
||||
//
|
||||
// Usage:
|
||||
// A RoomParams object is required for creating a room.
|
||||
// It can be copied and there are get__ and set__ methods for retrieving
|
||||
// and storing values.
|
||||
//
|
||||
class RoomParams
|
||||
{
|
||||
public:
|
||||
RoomParams();
|
||||
RoomParams(const ChatUnicodeString &name, const ChatUnicodeString &topic, unsigned attributes, unsigned maxSize);
|
||||
RoomParams(const ChatUnicodeString &name, const ChatUnicodeString &topic, const ChatUnicodeString &password, unsigned attributes, unsigned maxSize);
|
||||
RoomParams(const RoomParams &orig);
|
||||
~RoomParams();
|
||||
|
||||
RoomParams & operator=(const RoomParams &rhs);
|
||||
|
||||
void setRoomName(const ChatUnicodeString &name);
|
||||
void setRoomTopic(const ChatUnicodeString &topic);
|
||||
void setRoomPassword(const ChatUnicodeString &name);
|
||||
void setRoomAttributes(unsigned attributes);
|
||||
void setRoomMaxSize(unsigned size);
|
||||
|
||||
const ChatUnicodeString &getRoomName() const;
|
||||
const ChatUnicodeString &getRoomTopic() const;
|
||||
const ChatUnicodeString &getRoomPassword() const;
|
||||
unsigned getRoomAttributes() const;
|
||||
unsigned getRoomMaxSize() const;
|
||||
|
||||
private:
|
||||
RoomParamsCore *m_core;
|
||||
mutable ChatUnicodeString m_cName;
|
||||
mutable ChatUnicodeString m_cTopic;
|
||||
mutable ChatUnicodeString m_cPassword;
|
||||
};
|
||||
|
||||
|
||||
// class RoomSummary
|
||||
//
|
||||
// Description:
|
||||
// This class stores the basic room parameters to describe a room.
|
||||
// It is useful for describing a room with less byte resources than
|
||||
// a full ChatRoom.
|
||||
//
|
||||
// Usage:
|
||||
// A RoomSummary object is passed through OnGetRoomSummaries().
|
||||
// It can be copied and there are get__ and set__ methods for retrieving
|
||||
// and storing values.
|
||||
//
|
||||
class RoomSummary
|
||||
{
|
||||
public:
|
||||
RoomSummary();
|
||||
RoomSummary(const ChatUnicodeString &name, const ChatUnicodeString &topic, unsigned attributes, unsigned curSize, unsigned maxSize);
|
||||
~RoomSummary();
|
||||
|
||||
RoomSummary & operator=(const RoomSummary &rhs);
|
||||
|
||||
void setRoomAddress(const ChatUnicodeString &address);
|
||||
void setRoomTopic(const ChatUnicodeString &topic);
|
||||
void setRoomAttributes(unsigned attributes);
|
||||
void setRoomCurSize(unsigned curSize);
|
||||
void setRoomMaxSize(unsigned maxSize);
|
||||
|
||||
const ChatUnicodeString &getRoomAddress() const;
|
||||
const ChatUnicodeString &getRoomTopic() const;
|
||||
unsigned getRoomAttributes() const;
|
||||
unsigned getRoomCurSize() const;
|
||||
unsigned getRoomMaxSize() const;
|
||||
|
||||
private:
|
||||
RoomSummaryCore *m_core;
|
||||
mutable ChatUnicodeString m_cAddress;
|
||||
mutable ChatUnicodeString m_cTopic;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// class AvatarIterator
|
||||
//
|
||||
// Description:
|
||||
// This class implements an iterator for the ChatRoom avatar container.
|
||||
//
|
||||
// Usage:
|
||||
// An AvatarIterator will originate from getFirstAvatar() or findAvatar().
|
||||
// It can be copied, incremented, decremented, and dereferenced to get the
|
||||
// ChatAvatar* it points to. To check the validity of the iterator while
|
||||
// iterating to know whether the end of the container has been reached,
|
||||
// use outOfBounds() method.
|
||||
// example:
|
||||
// AvatarIterator iter;
|
||||
// for (iter = room->getFirstAvatar(); iter.outOfBounds() == false; iter++)
|
||||
// {
|
||||
// ChatAvatar *avatar = (*iter);
|
||||
// // do stuff with avatar info
|
||||
// }
|
||||
//
|
||||
class AvatarIterator
|
||||
{
|
||||
public:
|
||||
AvatarIterator();
|
||||
AvatarIterator(const AvatarIteratorCore &core);
|
||||
~AvatarIterator();
|
||||
|
||||
AvatarIterator & operator=(const AvatarIterator &rhs);
|
||||
|
||||
// Bi-directional container navigation
|
||||
void operator++();
|
||||
void operator++(int dummyForPostfix);
|
||||
void operator--();
|
||||
void operator--(int dummyForPostfix);
|
||||
|
||||
// Dereference to ChatAvatar* value
|
||||
ChatAvatar * operator*();
|
||||
|
||||
// Test movement past beginning or end of container
|
||||
bool outOfBounds();
|
||||
|
||||
private:
|
||||
AvatarIteratorCore *m_core;
|
||||
};
|
||||
|
||||
// class ModeratorIterator
|
||||
//
|
||||
// Description:
|
||||
// This class implements an iterator for the ChatRoom moderator container.
|
||||
//
|
||||
// Usage:
|
||||
// A ModeratorIterator will originate from getFirstModerator() or findModerator().
|
||||
// Same as AvatarIterator usage.
|
||||
//
|
||||
class ModeratorIterator
|
||||
{
|
||||
public:
|
||||
ModeratorIterator();
|
||||
ModeratorIterator(const ModeratorIteratorCore &core);
|
||||
~ModeratorIterator();
|
||||
|
||||
ModeratorIterator & operator=(const ModeratorIterator &rhs);
|
||||
|
||||
// Bi-directional container navigation
|
||||
void operator++();
|
||||
void operator++(int dummyForPostfix);
|
||||
void operator--();
|
||||
void operator--(int dummyForPostfix);
|
||||
|
||||
// Dereference to ChatAvatar* value
|
||||
ChatAvatar * operator*();
|
||||
|
||||
// Test movement past beginning or end of container
|
||||
bool outOfBounds();
|
||||
|
||||
private:
|
||||
ModeratorIteratorCore *m_core;
|
||||
};
|
||||
|
||||
// class TemporaryModeratorIterator
|
||||
//
|
||||
// Description:
|
||||
// This class implements an iterator for the ChatRoom temporary moderator container.
|
||||
//
|
||||
// Usage:
|
||||
// A TemporaryModeratorIterator will originate from getFirstModerator() or findModerator().
|
||||
// Same as AvatarIterator usage.
|
||||
//
|
||||
class TemporaryModeratorIterator
|
||||
{
|
||||
public:
|
||||
TemporaryModeratorIterator();
|
||||
TemporaryModeratorIterator(const TemporaryModeratorIteratorCore &core);
|
||||
~TemporaryModeratorIterator();
|
||||
|
||||
TemporaryModeratorIterator & operator=(const TemporaryModeratorIterator &rhs);
|
||||
|
||||
// Bi-directional container navigation
|
||||
void operator++();
|
||||
void operator++(int dummyForPostfix);
|
||||
void operator--();
|
||||
void operator--(int dummyForPostfix);
|
||||
|
||||
// Dereference to ChatAvatar* value
|
||||
ChatAvatar * operator*();
|
||||
|
||||
// Test movement past beginning or end of container
|
||||
bool outOfBounds();
|
||||
|
||||
private:
|
||||
TemporaryModeratorIteratorCore *m_core;
|
||||
};
|
||||
|
||||
// class VoiceIterator
|
||||
//
|
||||
// Description:
|
||||
// This class implements an iterator for the ChatRoom Voice container.
|
||||
//
|
||||
// Usage:
|
||||
// An VoiceIterator will originate from getFirstVoice() or findVoice().
|
||||
// Same as AvatarIterator usage.
|
||||
//
|
||||
class VoiceIterator
|
||||
{
|
||||
public:
|
||||
VoiceIterator();
|
||||
VoiceIterator(const VoiceIteratorCore &core);
|
||||
~VoiceIterator();
|
||||
|
||||
VoiceIterator & operator=(const VoiceIterator &rhs);
|
||||
|
||||
// Bi-directional container navigation
|
||||
void operator++();
|
||||
void operator++(int dummyForPostfix);
|
||||
void operator--();
|
||||
void operator--(int dummyForPostfix);
|
||||
|
||||
// Dereference to ChatAvatar* value
|
||||
ChatAvatar * operator*();
|
||||
|
||||
// Test movement past beginning or end of container
|
||||
bool outOfBounds();
|
||||
|
||||
private:
|
||||
VoiceIteratorCore *m_core;
|
||||
};
|
||||
|
||||
// class InviteIterator
|
||||
//
|
||||
// Description:
|
||||
// This class implements an iterator for the ChatRoom invite container.
|
||||
//
|
||||
// Usage:
|
||||
// An InviteIterator will originate from getFirstInvite() or findInvite().
|
||||
// Same as AvatarIterator usage.
|
||||
//
|
||||
class InviteIterator
|
||||
{
|
||||
public:
|
||||
InviteIterator();
|
||||
InviteIterator(const InviteIteratorCore &core);
|
||||
~InviteIterator();
|
||||
|
||||
InviteIterator & operator=(const InviteIterator &rhs);
|
||||
|
||||
// Bi-directional container navigation
|
||||
void operator++();
|
||||
void operator++(int dummyForPostfix);
|
||||
void operator--();
|
||||
void operator--(int dummyForPostfix);
|
||||
|
||||
// Dereference to ChatAvatar* value
|
||||
ChatAvatar * operator*();
|
||||
|
||||
// Test movement past beginning or end of container
|
||||
bool outOfBounds();
|
||||
|
||||
private:
|
||||
InviteIteratorCore *m_core;
|
||||
};
|
||||
|
||||
// class BanIterator
|
||||
//
|
||||
// Description:
|
||||
// This class implements an iterator for the ChatRoom ban container.
|
||||
//
|
||||
// Usage:
|
||||
// A BanIterator will originate from getFirstBan() or findBan().
|
||||
// Same as AvatarIterator usage.
|
||||
//
|
||||
class BanIterator
|
||||
{
|
||||
public:
|
||||
BanIterator();
|
||||
BanIterator(const BanIteratorCore &core);
|
||||
~BanIterator();
|
||||
|
||||
BanIterator & operator=(const BanIterator &rhs);
|
||||
|
||||
// Bi-directional container navigation
|
||||
void operator++();
|
||||
void operator++(int dummyForPostfix);
|
||||
void operator--();
|
||||
void operator--(int dummyForPostfix);
|
||||
|
||||
// Dereference to ChatAvatar* value
|
||||
ChatAvatar * operator*();
|
||||
|
||||
// Test movement past beginning or end of container
|
||||
bool outOfBounds();
|
||||
|
||||
private:
|
||||
BanIteratorCore *m_core;
|
||||
};
|
||||
|
||||
// class ChatRoom
|
||||
//
|
||||
// Description:
|
||||
// This class stores the information about a room in the ChatSystem that
|
||||
// is relevant to the API.
|
||||
//
|
||||
// Usage:
|
||||
// A ChatRoom will originate from an API callback method.
|
||||
// The ChatRoom object cannot be copied however all of its member data can
|
||||
// be retrived either by get__ methods or iterator methods (see comments
|
||||
// for AvatarIterator class).
|
||||
//
|
||||
class ChatRoom
|
||||
{
|
||||
public:
|
||||
ChatRoom();
|
||||
ChatRoom(ChatRoomCore *core);
|
||||
~ChatRoom();
|
||||
|
||||
const ChatUnicodeString &getCreatorName() const;
|
||||
const ChatUnicodeString &getCreatorAddress() const;
|
||||
unsigned getCreatorID() const;
|
||||
|
||||
unsigned getRoomID() const;
|
||||
const ChatUnicodeString &getRoomName() const;
|
||||
const ChatUnicodeString &getRoomTopic() const;
|
||||
const ChatUnicodeString &getRoomPassword() const;
|
||||
unsigned getRoomAttributes() const;
|
||||
unsigned getMaxRoomSize() const;
|
||||
const ChatUnicodeString &getAddress() const;
|
||||
|
||||
unsigned getAvatarCount() const;
|
||||
unsigned getBanCount() const;
|
||||
unsigned getInviteCount() const;
|
||||
unsigned getModeratorCount() const;
|
||||
unsigned getTemporaryModeratorCount() const;
|
||||
unsigned getVoiceCount() const;
|
||||
|
||||
AvatarIterator getFirstAvatar() const;
|
||||
AvatarIterator findAvatar(unsigned avatarID) const;
|
||||
AvatarIterator findAvatar(const ChatUnicodeString &name, const ChatUnicodeString &address) const;
|
||||
|
||||
ModeratorIterator getFirstModerator() const;
|
||||
ModeratorIterator findModerator(const ChatUnicodeString &name, const ChatUnicodeString &address) const;
|
||||
|
||||
TemporaryModeratorIterator getFirstTemporaryModerator() const;
|
||||
TemporaryModeratorIterator findTemporaryModerator(const ChatUnicodeString &name, const ChatUnicodeString &address) const;
|
||||
|
||||
BanIterator getFirstBanned() const;
|
||||
BanIterator findBanned(const ChatUnicodeString &name, const ChatUnicodeString &address) const;
|
||||
|
||||
InviteIterator getFirstInvited() const;
|
||||
InviteIterator findInvited(const ChatUnicodeString &name, const ChatUnicodeString &address) const;
|
||||
|
||||
VoiceIterator getFirstVoice() const;
|
||||
VoiceIterator findVoice(const ChatUnicodeString &name, const ChatUnicodeString &address) const;
|
||||
|
||||
void setRoomMessageID(unsigned roomMessageID);
|
||||
|
||||
private:
|
||||
ChatRoomCore *m_core;
|
||||
mutable ChatUnicodeString m_cCreatorAddress;
|
||||
mutable ChatUnicodeString m_cCreatorName;
|
||||
mutable ChatUnicodeString m_cRoomName;
|
||||
mutable ChatUnicodeString m_cRoomTopic;
|
||||
mutable ChatUnicodeString m_cRoomPassword;
|
||||
mutable ChatUnicodeString m_cRoomAddress;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,159 @@
|
||||
#if !defined (CHATROOMCORE_H_)
|
||||
#define CHATROOMCORE_H_
|
||||
|
||||
#pragma warning (disable : 4786)
|
||||
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
#include <Base/Archive.h>
|
||||
#include <Unicode/Unicode.h>
|
||||
#include <Unicode/UnicodeUtils.h>
|
||||
|
||||
#include "ChatRoom.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
class ChatAvatar;
|
||||
class ChatAvatarCore;
|
||||
class AvatarIteratorCore;
|
||||
class ModeratorIteratorCore;
|
||||
class TemporaryModeratorIteratorCore;
|
||||
class VoiceIteratorCore;
|
||||
class InviteIteratorCore;
|
||||
class BanIteratorCore;
|
||||
class RoomParams;
|
||||
|
||||
|
||||
class ChatRoomCore
|
||||
{
|
||||
public:
|
||||
ChatRoomCore();
|
||||
ChatRoomCore(Base::ByteStream::ReadIterator &iter);
|
||||
ChatRoomCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address, const Plat_Unicode::String &topic, const unsigned attributes, const unsigned maxSize);
|
||||
|
||||
~ChatRoomCore();
|
||||
|
||||
const Plat_Unicode::String &getCreatorName() const { return m_creatorName; }
|
||||
const Plat_Unicode::String &getCreatorAddress() const { return m_creatorAddress; }
|
||||
unsigned getCreatorID() const { return m_creatorID; }
|
||||
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
const Plat_Unicode::String &getRoomName() const { return m_roomName; }
|
||||
const Plat_Unicode::String &getRoomTopic() const { return m_roomTopic; }
|
||||
const Plat_Unicode::String &getRoomPassword() const { return m_roomPassword; }
|
||||
unsigned getRoomAttributes() const { return m_roomAttributes; }
|
||||
unsigned getMaxRoomSize() const { return m_maxRoomSize; }
|
||||
const Plat_Unicode::String &getAddress() const { return m_roomAddress; }
|
||||
unsigned getNodeLevel() const { return m_nodeLevel; }
|
||||
|
||||
unsigned getAvatarCount() const;
|
||||
unsigned getBanCount() const;
|
||||
unsigned getInviteCount() const;
|
||||
unsigned getModeratorCount() const;
|
||||
unsigned getTemporaryModeratorCount() const;
|
||||
unsigned getVoiceCount() const;
|
||||
|
||||
|
||||
void setName(const Plat_Unicode::String &name) { m_roomName = name; }
|
||||
void setTopic(const Plat_Unicode::String &topic) { m_roomTopic = topic; }
|
||||
void setPassword(const Plat_Unicode::String &password) { m_roomPassword = password; }
|
||||
void setAttributes(unsigned attributes) { m_roomAttributes = attributes; }
|
||||
void setMaxRoomSize(unsigned size) { m_maxRoomSize = size; }
|
||||
void setID(unsigned id) { m_roomID = id; }
|
||||
void setCreator(unsigned creatorID, const Plat_Unicode::String &creatorName, const Plat_Unicode::String &creatorAddress);
|
||||
|
||||
void setRoomMessageID(unsigned roomMessageID) { m_roomMessageID = roomMessageID; }
|
||||
|
||||
ChatAvatarCore *getAvatarCore(unsigned avatarID);
|
||||
ChatAvatar *getAvatar(unsigned avatarID);
|
||||
ChatAvatarCore *getModeratorCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
ChatAvatar *getModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
ChatAvatarCore *getTemporaryModeratorCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
ChatAvatar *getTemporaryModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
ChatAvatarCore *getBannedCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
ChatAvatar *getBanned(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
ChatAvatarCore *getInvitedCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
ChatAvatar *getInvited(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
ChatAvatarCore *getVoiceCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
ChatAvatar *getVoice(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
|
||||
ChatAvatarCore *addAvatar(ChatAvatarCore *newAvatar, bool local);
|
||||
void addLocalAvatar(unsigned avatarID);
|
||||
ChatAvatarCore *removeAvatar(unsigned avatarID);
|
||||
|
||||
ChatAvatarCore *addAdministrator(ChatAvatarCore *newAvatar);
|
||||
ChatAvatarCore *removeAdministrator(unsigned avatarID);
|
||||
|
||||
ChatAvatarCore *addModerator(ChatAvatarCore *newAvatar);
|
||||
ChatAvatarCore *removeModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
|
||||
ChatAvatarCore *addTempModerator(ChatAvatarCore *newAvatar);
|
||||
ChatAvatarCore *removeTempModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
|
||||
ChatAvatarCore *addBan(ChatAvatarCore *newAvatar);
|
||||
ChatAvatarCore *removeBan(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
|
||||
ChatAvatarCore *addInvite(ChatAvatarCore *newAvatar);
|
||||
ChatAvatarCore *removeInvite(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
|
||||
ChatAvatarCore *addVoice(ChatAvatarCore *newAvatar);
|
||||
ChatAvatarCore *removeVoice(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
|
||||
AvatarIteratorCore getFirstAvatar();
|
||||
AvatarIteratorCore findAvatar(unsigned avatarID);
|
||||
AvatarIteratorCore findAvatar(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
|
||||
ModeratorIteratorCore getFirstModerator();
|
||||
ModeratorIteratorCore findModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
|
||||
TemporaryModeratorIteratorCore getFirstTemporaryModerator();
|
||||
TemporaryModeratorIteratorCore findTemporaryModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
|
||||
BanIteratorCore getFirstBanned();
|
||||
BanIteratorCore findBanned(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
|
||||
InviteIteratorCore getFirstInvited();
|
||||
InviteIteratorCore findInvited(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
|
||||
VoiceIteratorCore getFirstVoice();
|
||||
VoiceIteratorCore findVoice(const Plat_Unicode::String &name, const Plat_Unicode::String &address);
|
||||
|
||||
void serializeWithLocalAvatarsOnly(Base::ByteStream &msg);
|
||||
|
||||
private:
|
||||
Plat_Unicode::String m_creatorName;
|
||||
Plat_Unicode::String m_creatorAddress;
|
||||
Plat_Unicode::String m_roomName;
|
||||
Plat_Unicode::String m_roomTopic;
|
||||
Plat_Unicode::String m_roomPassword;
|
||||
Plat_Unicode::String m_roomPrefix;
|
||||
Plat_Unicode::String m_roomAddress;
|
||||
|
||||
unsigned m_creatorID;
|
||||
unsigned m_roomAttributes;
|
||||
unsigned m_maxRoomSize;
|
||||
unsigned m_roomID;
|
||||
unsigned m_createTime;
|
||||
unsigned m_nodeLevel;
|
||||
unsigned m_roomMessageID;
|
||||
|
||||
std::map<unsigned, ChatAvatarCore *> m_inroomAvatarsCore;
|
||||
std::map<unsigned, ChatAvatar *> m_inroomAvatars;
|
||||
std::set<unsigned> m_inroomAvatarsLocal;
|
||||
std::map<unsigned, ChatAvatarCore *> m_adminAvatarsCore;
|
||||
std::map<unsigned, ChatAvatar *> m_adminAvatars;
|
||||
std::set<ChatAvatarCore *> m_moderatorAvatarsCore;
|
||||
std::set<ChatAvatarCore *> m_tempModeratorAvatarsCore;
|
||||
std::set<ChatAvatar *> m_moderatorAvatars;
|
||||
std::set<ChatAvatar *> m_tempModeratorAvatars;
|
||||
std::set<ChatAvatarCore *> m_banAvatarsCore;
|
||||
std::set<ChatAvatar *> m_banAvatars;
|
||||
std::set<ChatAvatarCore *> m_inviteAvatarsCore;
|
||||
std::set<ChatAvatar *> m_inviteAvatars;
|
||||
std::set<ChatAvatarCore *> m_voiceAvatarsCore;
|
||||
std::set<ChatAvatar *> m_voiceAvatars;
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,515 @@
|
||||
#include "Message.h"
|
||||
#include "PersistentMessage.h"
|
||||
#include "PersistentMessageCore.h"
|
||||
|
||||
|
||||
unsigned numRead;
|
||||
namespace ChatSystem
|
||||
{
|
||||
using namespace std;
|
||||
using namespace Base;
|
||||
using namespace Plat_Unicode;
|
||||
|
||||
MInstantMessage::MInstantMessage(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_INSTANTMESSAGE),
|
||||
m_srcAvatar(iter)
|
||||
{
|
||||
get(iter, m_destAvatarID);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_msg));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_oob));
|
||||
}
|
||||
|
||||
MRoomMessage::MRoomMessage(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_ROOMMESSAGE),
|
||||
m_destList(NULL),
|
||||
m_srcAvatar(iter),
|
||||
m_messageID(0)
|
||||
{
|
||||
get(iter, m_roomID);
|
||||
get(iter, m_listLength);
|
||||
|
||||
m_destList = new unsigned[m_listLength];
|
||||
for(unsigned i = 0; i < m_listLength; i++)
|
||||
{
|
||||
get(iter, m_destList[i]);
|
||||
}
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_msg));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_oob));
|
||||
|
||||
if (iter.getSize() >= sizeof(unsigned))
|
||||
{
|
||||
get(iter, m_messageID);
|
||||
}
|
||||
}
|
||||
|
||||
MRoomMessage::~MRoomMessage()
|
||||
{
|
||||
delete[] m_destList;
|
||||
m_destList = NULL;
|
||||
}
|
||||
|
||||
MBroadcastMessage::MBroadcastMessage(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_BROADCASTMESSAGE),
|
||||
m_srcAvatar(iter),
|
||||
m_destList(NULL)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_srcAddress));
|
||||
get(iter, m_listLength);
|
||||
|
||||
m_destList = new unsigned[m_listLength];
|
||||
for(unsigned i = 0; i < m_listLength; i++)
|
||||
{
|
||||
get(iter, m_destList[i]);
|
||||
}
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_msg));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_oob));
|
||||
}
|
||||
|
||||
MBroadcastMessage::~MBroadcastMessage()
|
||||
{
|
||||
delete[] m_destList;
|
||||
m_destList = NULL;
|
||||
}
|
||||
|
||||
MFilterMessage::MFilterMessage(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_FILTERMESSAGE)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_inmsg));
|
||||
}
|
||||
|
||||
MFriendLogin::MFriendLogin(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_FRIENDLOGIN),
|
||||
m_friendAvatar(iter)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_friendAddress));
|
||||
get(iter, m_destAvatarID);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_friendStatus));
|
||||
}
|
||||
|
||||
MFriendLogout::MFriendLogout(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_FRIENDLOGOUT),
|
||||
m_friendAvatar(iter)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_friendAddress));
|
||||
get(iter, m_destAvatarID);
|
||||
}
|
||||
|
||||
MFriendStatus::MFriendStatus(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_FRIENDSTATUS),
|
||||
m_friendAvatar(iter)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_friendAddress));
|
||||
get(iter, m_destAvatarID);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_friendStatus));
|
||||
}
|
||||
|
||||
MKickRoom::MKickRoom(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_KICKROOM),
|
||||
m_srcAvatar(iter),
|
||||
m_destAvatar(iter)
|
||||
{
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MKickAvatar::MKickAvatar(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_KICKAVATAR),
|
||||
m_srcAvatar(iter),
|
||||
m_destAvatar(iter)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomAddress));
|
||||
}
|
||||
|
||||
MAddModeratorRoom::MAddModeratorRoom(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_ADDMODERATORROOM)
|
||||
{
|
||||
get(iter, m_srcAvatarID);
|
||||
m_destAvatar = new ChatAvatarCore(iter);
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MAddModeratorAvatar::MAddModeratorAvatar(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_ADDMODERATORAVATAR),
|
||||
m_srcAvatar(iter),
|
||||
m_destAvatar(iter)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomAddress));
|
||||
}
|
||||
|
||||
MRemoveModeratorRoom::MRemoveModeratorRoom(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_REMOVEMODERATORROOM)
|
||||
{
|
||||
get(iter, m_srcAvatarID);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_destAvatarName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_destAvatarAddress));
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MRemoveModeratorAvatar::MRemoveModeratorAvatar(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_REMOVEMODERATORAVATAR),
|
||||
m_srcAvatar(iter),
|
||||
m_destAvatar(iter)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomAddress));
|
||||
}
|
||||
|
||||
MAddTemporaryModeratorRoom::MAddTemporaryModeratorRoom(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_ADDMODERATORROOM)
|
||||
{
|
||||
get(iter, m_srcAvatarID);
|
||||
m_destAvatar = new ChatAvatarCore(iter);
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MAddTemporaryModeratorAvatar::MAddTemporaryModeratorAvatar(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_ADDMODERATORAVATAR),
|
||||
m_srcAvatar(iter),
|
||||
m_destAvatar(iter)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomAddress));
|
||||
}
|
||||
|
||||
MRemoveTemporaryModeratorRoom::MRemoveTemporaryModeratorRoom(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_REMOVEMODERATORROOM)
|
||||
{
|
||||
get(iter, m_srcAvatarID);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_destAvatarName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_destAvatarAddress));
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MRemoveTemporaryModeratorAvatar::MRemoveTemporaryModeratorAvatar(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_REMOVEMODERATORAVATAR),
|
||||
m_srcAvatar(iter),
|
||||
m_destAvatar(iter)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomAddress));
|
||||
}
|
||||
|
||||
MAddBanRoom::MAddBanRoom(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_ADDBANROOM),
|
||||
m_srcAvatar(iter)
|
||||
{
|
||||
m_destAvatar = new ChatAvatarCore(iter);
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MAddBanAvatar::MAddBanAvatar(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_ADDBANAVATAR),
|
||||
m_srcAvatar(iter),
|
||||
m_destAvatar(iter)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomAddress));
|
||||
}
|
||||
|
||||
MRemoveBanRoom::MRemoveBanRoom(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_REMOVEBANROOM)
|
||||
{
|
||||
get(iter, m_srcAvatarID);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_destAvatarName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_destAvatarAddress));
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MRemoveBanAvatar::MRemoveBanAvatar(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_REMOVEBANAVATAR),
|
||||
m_srcAvatar(iter),
|
||||
m_destAvatar(iter)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomAddress));
|
||||
}
|
||||
|
||||
MAddInviteRoom::MAddInviteRoom(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_ADDINVITEROOM),
|
||||
m_srcAvatar(iter)
|
||||
{
|
||||
m_destAvatar = new ChatAvatarCore(iter);
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MAddInviteAvatar::MAddInviteAvatar(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_ADDINVITEAVATAR),
|
||||
m_srcAvatar(iter),
|
||||
m_destAvatar(iter)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomAddress));
|
||||
}
|
||||
|
||||
MRemoveInviteRoom::MRemoveInviteRoom(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_REMOVEINVITEROOM)
|
||||
{
|
||||
get(iter, m_srcAvatarID);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_destAvatarName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_destAvatarAddress));
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MRemoveInviteAvatar::MRemoveInviteAvatar(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_REMOVEINVITEAVATAR),
|
||||
m_srcAvatar(iter),
|
||||
m_destAvatar(iter)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomAddress));
|
||||
}
|
||||
|
||||
MGrantVoiceRoom::MGrantVoiceRoom(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_ADDINVITEROOM),
|
||||
m_srcAvatar(iter)
|
||||
{
|
||||
m_destAvatar = new ChatAvatarCore(iter);
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MGrantVoiceAvatar::MGrantVoiceAvatar(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_ADDINVITEAVATAR),
|
||||
m_srcAvatar(iter),
|
||||
m_destAvatar(iter)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomAddress));
|
||||
}
|
||||
|
||||
MRevokeVoiceRoom::MRevokeVoiceRoom(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_REMOVEINVITEROOM)
|
||||
{
|
||||
get(iter, m_srcAvatarID);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_destAvatarName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_destAvatarAddress));
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MRevokeVoiceAvatar::MRevokeVoiceAvatar(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_REMOVEINVITEAVATAR),
|
||||
m_srcAvatar(iter),
|
||||
m_destAvatar(iter)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomAddress));
|
||||
}
|
||||
|
||||
MEnterRoom::MEnterRoom(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_ENTERROOM),
|
||||
m_srcAvatar(new ChatAvatarCore(iter))
|
||||
{
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MLeaveRoom::MLeaveRoom(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_LEAVEROOM)
|
||||
{
|
||||
get(iter, m_avatarID);
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MDestroyRoom::MDestroyRoom(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_DESTROYROOM),
|
||||
m_srcAvatar(iter)
|
||||
{
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MSetRoomParams::MSetRoomParams(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_SETROOMPARAMS),
|
||||
m_srcAvatar(iter)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomTopic));
|
||||
get(iter, m_roomAttributes);
|
||||
get(iter, m_maxRoomSize);
|
||||
get(iter, m_roomID);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_roomPassword));
|
||||
}
|
||||
|
||||
MPersistentMessage::MPersistentMessage(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_PERSISTENTMESSAGE)
|
||||
{
|
||||
m_core = new PersistentHeaderCore();
|
||||
m_header = new PersistentHeader();
|
||||
get(iter, m_destAvatarID);
|
||||
|
||||
// unpack messageID,
|
||||
// destAvatarID,
|
||||
// fromName,
|
||||
// fromAddress,
|
||||
// subject,
|
||||
// sentTime, and
|
||||
// status into PersistentHeaderCore object
|
||||
m_core->load(iter, m_header);
|
||||
|
||||
if (iter.getSize() > 0)
|
||||
{
|
||||
m_core->setCategory(iter);
|
||||
}
|
||||
}
|
||||
|
||||
MPersistentMessage::~MPersistentMessage()
|
||||
{
|
||||
delete m_core;
|
||||
delete m_header;
|
||||
}
|
||||
|
||||
MForcedLogout::MForcedLogout(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_FORCEDLOGOUT)
|
||||
{
|
||||
get(iter, m_avatarID);
|
||||
}
|
||||
|
||||
MUnregisterRoomReady::MUnregisterRoomReady(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_UNREGISTERROOMREADY)
|
||||
{
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MAddAdmin::MAddAdmin(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_ADDADMIN),
|
||||
m_avatar(new ChatAvatarCore(iter))
|
||||
{
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MRemoveAdmin::MRemoveAdmin(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_REMOVEADMIN)
|
||||
{
|
||||
get(iter, m_avatarID);
|
||||
get(iter, m_roomID);
|
||||
}
|
||||
|
||||
MFriendConfirmRequest::MFriendConfirmRequest(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_FRIENDCONFIRMREQUEST),
|
||||
m_srcAvatar(iter)
|
||||
{
|
||||
get(iter, m_destAvatarID);
|
||||
}
|
||||
|
||||
MFriendConfirmResponse::MFriendConfirmResponse(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_FRIENDCONFIRMRESPONSE),
|
||||
m_srcAvatar(iter)
|
||||
{
|
||||
get(iter, m_destAvatarID);
|
||||
get(iter, m_confirm);
|
||||
}
|
||||
|
||||
MFriendConfirmReciprocateRequest::MFriendConfirmReciprocateRequest(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_FRIENDCONFIRMRECIPROCATE_REQUEST),
|
||||
m_srcAvatar(iter)
|
||||
{
|
||||
get(iter, m_destAvatarID);
|
||||
}
|
||||
|
||||
MFriendConfirmReciprocateResponse::MFriendConfirmReciprocateResponse(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_FRIENDCONFIRMRECIPROCATE_RESPONSE),
|
||||
m_srcAvatar(iter)
|
||||
{
|
||||
get(iter, m_destAvatarID);
|
||||
get(iter, m_confirm);
|
||||
}
|
||||
|
||||
MChangeRoomOwner::MChangeRoomOwner(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_CHANGEROOMOWNER)
|
||||
{
|
||||
get(iter, m_destRoomID);
|
||||
get(iter, m_newRoomOwnerID);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_newRoomOwnerName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_newRoomOwnerAddress));
|
||||
}
|
||||
|
||||
MRoomEntryRequest::MRoomEntryRequest(Base::ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_REQUESTROOMENTRY),
|
||||
m_requestorAvatar(iter)
|
||||
{
|
||||
get(iter, m_roomOwnerID);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_requestedRoomAddress));
|
||||
}
|
||||
|
||||
MDelayedRoomEntry::MDelayedRoomEntry(Base::ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_DELAYEDROOMENTRY)
|
||||
{
|
||||
int numExtraRooms = 0;
|
||||
|
||||
get(iter, m_avatarID);
|
||||
get(iter, m_roomID);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_enteredAddress));
|
||||
get(iter, numExtraRooms);
|
||||
|
||||
while (numExtraRooms > 0)
|
||||
{
|
||||
m_setExtraRooms.insert(new ChatRoomCore(iter));
|
||||
numExtraRooms--;
|
||||
}
|
||||
}
|
||||
|
||||
MDeniedRoomEntry::MDeniedRoomEntry(Base::ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_DENIEDROOMENTRY)
|
||||
{
|
||||
get(iter, m_requestorAvatarID);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_requestedRoomAddress));
|
||||
}
|
||||
|
||||
MForceRoomFailover::MForceRoomFailover(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_FORCEROOMFAILOVER)
|
||||
{
|
||||
unsigned numAIDs(0);
|
||||
get(iter, numAIDs);
|
||||
|
||||
String aid;
|
||||
for (unsigned i = 0; i < numAIDs; i++)
|
||||
{
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, aid));
|
||||
m_aidList.push_back(aid);
|
||||
}
|
||||
}
|
||||
|
||||
MSnoop::MSnoop(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_SNOOP)
|
||||
{
|
||||
get(iter, m_snoopType);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_snooperName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_snooperAddr));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_srcName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_srcAddr));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_destName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_destAddr));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_message));
|
||||
}
|
||||
|
||||
MUIDList::MUIDList(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_UIDLIST)
|
||||
{
|
||||
unsigned numUIDs;
|
||||
get(iter, numUIDs);
|
||||
for (unsigned i = 0; i < numUIDs; i++)
|
||||
{
|
||||
Plat_Unicode::String uid;
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, uid));
|
||||
m_uidList.insert(toUpper(uid));
|
||||
}
|
||||
}
|
||||
|
||||
MNotifyFriendIsRemoved::MNotifyFriendIsRemoved(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_NOTIFY_FRIEND_IS_REMOVED)
|
||||
{
|
||||
get(iter, m_avatarID);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_destName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_destAddress));
|
||||
|
||||
}
|
||||
|
||||
MNotifyFriendsListChange::MNotifyFriendsListChange(ByteStream::ReadIterator &iter)
|
||||
: GenericMessage(MESSAGE_NOTIFY_FRIENDS_LIST_CHANGE)
|
||||
{
|
||||
get(iter, m_avatarID);
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_originalName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_originalAddress));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_newName));
|
||||
ASSERT_VALID_STRING_LENGTH(get(iter, m_newAddress));
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,929 @@
|
||||
#if !defined (MESSAGE_H_)
|
||||
#define MESSAGE_H_
|
||||
#pragma warning (disable : 4786)
|
||||
|
||||
#include <GenericAPI/GenericMessage.h>
|
||||
#include <Unicode/Unicode.h>
|
||||
|
||||
#include "ChatRoomCore.h"
|
||||
#include "ChatAvatarCore.h"
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <set>
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
|
||||
class PersistentHeader;
|
||||
class PersistentHeaderCore;
|
||||
|
||||
enum eMessageType
|
||||
{
|
||||
// ChatAvatar message types
|
||||
MESSAGE_INSTANTMESSAGE, // 0
|
||||
MESSAGE_ROOMMESSAGE,
|
||||
MESSAGE_BROADCASTMESSAGE,
|
||||
MESSAGE_FRIENDLOGIN,
|
||||
MESSAGE_FRIENDLOGOUT,
|
||||
MESSAGE_KICKROOM, // 5
|
||||
|
||||
// ChatRoom message types
|
||||
MESSAGE_ADDMODERATORROOM,
|
||||
MESSAGE_REMOVEMODERATORROOM,
|
||||
MESSAGE_REMOVEMODERATORAVATAR,
|
||||
MESSAGE_ADDBANROOM,
|
||||
MESSAGE_REMOVEBANROOM, // 10
|
||||
MESSAGE_REMOVEBANAVATAR,
|
||||
MESSAGE_ADDINVITEROOM,
|
||||
MESSAGE_ADDINVITEAVATAR,
|
||||
MESSAGE_REMOVEINVITEROOM,
|
||||
MESSAGE_REMOVEINVITEAVATAR, // 15
|
||||
MESSAGE_ENTERROOM,
|
||||
MESSAGE_LEAVEROOM,
|
||||
MESSAGE_DESTROYROOM,
|
||||
MESSAGE_SETROOMPARAMS,
|
||||
MESSAGE_PERSISTENTMESSAGE, // 20
|
||||
MESSAGE_FORCEDLOGOUT,
|
||||
MESSAGE_UNREGISTERROOMREADY,
|
||||
MESSAGE_KICKAVATAR,
|
||||
MESSAGE_ADDMODERATORAVATAR,
|
||||
MESSAGE_ADDBANAVATAR, // 25
|
||||
MESSAGE_ADDADMIN,
|
||||
MESSAGE_REMOVEADMIN,
|
||||
MESSAGE_FRIENDCONFIRMREQUEST,
|
||||
MESSAGE_FRIENDCONFIRMRESPONSE,
|
||||
MESSAGE_CHANGEROOMOWNER, // 30
|
||||
MESSAGE_FORCEROOMFAILOVER,
|
||||
MESSAGE_ADDTEMPORARYMODERATORROOM,
|
||||
MESSAGE_ADDTEMPORARYMODERATORAVATAR,
|
||||
MESSAGE_REMOVETEMPORARYMODERATORROOM,
|
||||
MESSAGE_REMOVETEMPORARYMODERATORAVATAR, // 35
|
||||
MESSAGE_GRANTVOICEROOM,
|
||||
MESSAGE_GRANTVOICEAVATAR,
|
||||
MESSAGE_REVOKEVOICEROOM,
|
||||
MESSAGE_REVOKEVOICEAVATAR,
|
||||
MESSAGE_SNOOP, // 40
|
||||
MESSAGE_UIDLIST,
|
||||
MESSAGE_REQUESTROOMENTRY,
|
||||
MESSAGE_DELAYEDROOMENTRY,
|
||||
MESSAGE_DENIEDROOMENTRY,
|
||||
MESSAGE_FRIENDSTATUS, // 45
|
||||
MESSAGE_FRIENDCONFIRMRECIPROCATE_REQUEST,
|
||||
MESSAGE_FRIENDCONFIRMRECIPROCATE_RESPONSE,
|
||||
MESSAGE_FILTERMESSAGE,
|
||||
MESSAGE_FAILOVER_AVATAR_LIST,
|
||||
MESSAGE_NOTIFY_FRIENDS_LIST_CHANGE, // 50
|
||||
MESSAGE_NOTIFY_FRIEND_IS_REMOVED
|
||||
|
||||
};
|
||||
|
||||
class MInstantMessage : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MInstantMessage(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MInstantMessage() {};
|
||||
|
||||
unsigned getDestAvatarID() const { return m_destAvatarID; }
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
const Plat_Unicode::String &getMsg() const { return m_msg; }
|
||||
const Plat_Unicode::String &getOOB() const { return m_oob; }
|
||||
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
unsigned m_destAvatarID;
|
||||
Plat_Unicode::String m_msg;
|
||||
Plat_Unicode::String m_oob;
|
||||
};
|
||||
|
||||
class MRoomMessage : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MRoomMessage(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MRoomMessage();
|
||||
|
||||
unsigned getListLength() const { return m_listLength; }
|
||||
const unsigned *getDestList() const { return m_destList; }
|
||||
ChatAvatarCore *getSrcAvatar() { return &m_srcAvatar; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
const Plat_Unicode::String &getMsg() const { return m_msg; }
|
||||
const Plat_Unicode::String &getOOB() const { return m_oob; }
|
||||
unsigned getMessageID() const { return m_messageID; }
|
||||
|
||||
private:
|
||||
unsigned m_listLength;
|
||||
unsigned *m_destList;
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
unsigned m_roomID;
|
||||
Plat_Unicode::String m_msg;
|
||||
Plat_Unicode::String m_oob;
|
||||
unsigned m_messageID;
|
||||
};
|
||||
|
||||
class MBroadcastMessage : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MBroadcastMessage(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MBroadcastMessage();
|
||||
|
||||
unsigned getListLength() const { return m_listLength; }
|
||||
const unsigned *getDestList() const { return m_destList; }
|
||||
ChatAvatarCore *getSrcAvatar() { return &m_srcAvatar; }
|
||||
const Plat_Unicode::String &getSrcAddress() const { return m_srcAddress; }
|
||||
const Plat_Unicode::String &getMsg() const { return m_msg; }
|
||||
const Plat_Unicode::String &getOOB() const { return m_oob; }
|
||||
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
unsigned m_listLength;
|
||||
unsigned *m_destList;
|
||||
Plat_Unicode::String m_srcAddress;
|
||||
Plat_Unicode::String m_msg;
|
||||
Plat_Unicode::String m_oob;
|
||||
};
|
||||
|
||||
class MFilterMessage : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MFilterMessage(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MFilterMessage() {};
|
||||
|
||||
const Plat_Unicode::String &getMsg() const { return m_inmsg; }
|
||||
|
||||
private:
|
||||
Plat_Unicode::String m_inmsg;
|
||||
};
|
||||
|
||||
class MFriendLogin : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MFriendLogin(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MFriendLogin() {};
|
||||
|
||||
const ChatAvatarCore *getFriendAvatar() const { return &m_friendAvatar; }
|
||||
unsigned getDestAvatarID() const { return m_destAvatarID; }
|
||||
const Plat_Unicode::String &getFriendAddress() const { return m_friendAddress; }
|
||||
const Plat_Unicode::String &getFriendStatusMessage() const { return m_friendStatus; }
|
||||
|
||||
private:
|
||||
ChatAvatarCore m_friendAvatar;
|
||||
unsigned m_destAvatarID;
|
||||
Plat_Unicode::String m_friendAddress;
|
||||
Plat_Unicode::String m_friendStatus;
|
||||
};
|
||||
|
||||
class MFriendLogout : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MFriendLogout(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MFriendLogout() {};
|
||||
|
||||
const ChatAvatarCore *getFriendAvatar() const { return &m_friendAvatar; }
|
||||
unsigned getDestAvatarID() const { return m_destAvatarID; }
|
||||
const Plat_Unicode::String &getFriendAddress() const { return m_friendAddress; }
|
||||
|
||||
private:
|
||||
ChatAvatarCore m_friendAvatar;
|
||||
unsigned m_destAvatarID;
|
||||
Plat_Unicode::String m_friendAddress;
|
||||
};
|
||||
|
||||
class MFriendStatus : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MFriendStatus(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MFriendStatus() {};
|
||||
|
||||
const ChatAvatarCore *getFriendAvatar() const { return &m_friendAvatar; }
|
||||
unsigned getDestAvatarID() const { return m_destAvatarID; }
|
||||
const Plat_Unicode::String &getFriendAddress() const { return m_friendAddress; }
|
||||
const Plat_Unicode::String &getFriendStatusMessage() const { return m_friendStatus; }
|
||||
|
||||
private:
|
||||
ChatAvatarCore m_friendAvatar;
|
||||
unsigned m_destAvatarID;
|
||||
Plat_Unicode::String m_friendAddress;
|
||||
Plat_Unicode::String m_friendStatus;
|
||||
};
|
||||
|
||||
class MKickRoom : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MKickRoom(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MKickRoom() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
const ChatAvatarCore *getDestAvatar() const { return &m_destAvatar; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
ChatAvatarCore m_destAvatar;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MKickAvatar : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MKickAvatar(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MKickAvatar() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
const ChatAvatarCore *getDestAvatar() const { return &m_destAvatar; }
|
||||
|
||||
const Plat_Unicode::String &getRoomName() const { return m_roomName; }
|
||||
const Plat_Unicode::String &getRoomAddress() const { return m_roomAddress; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
ChatAvatarCore m_destAvatar;
|
||||
|
||||
Plat_Unicode::String m_roomName;
|
||||
Plat_Unicode::String m_roomAddress;
|
||||
};
|
||||
|
||||
class MAddModeratorRoom : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MAddModeratorRoom(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MAddModeratorRoom() {};
|
||||
|
||||
unsigned getSrcAvatarID() const { return m_srcAvatarID; }
|
||||
ChatAvatarCore *getDestAvatar() const { return m_destAvatar; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
unsigned m_srcAvatarID;
|
||||
ChatAvatarCore *m_destAvatar;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MAddModeratorAvatar : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MAddModeratorAvatar(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MAddModeratorAvatar() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
const ChatAvatarCore *getDestAvatar() const { return &m_destAvatar; }
|
||||
|
||||
const Plat_Unicode::String &getRoomName() const { return m_roomName; }
|
||||
const Plat_Unicode::String &getRoomAddress() const { return m_roomAddress; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
ChatAvatarCore m_destAvatar;
|
||||
|
||||
Plat_Unicode::String m_roomName;
|
||||
Plat_Unicode::String m_roomAddress;
|
||||
};
|
||||
|
||||
class MRemoveModeratorRoom : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MRemoveModeratorRoom(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MRemoveModeratorRoom() {};
|
||||
|
||||
unsigned getSrcAvatarID() const { return m_srcAvatarID; }
|
||||
const Plat_Unicode::String &getDestAvatarName() const { return m_destAvatarName; }
|
||||
const Plat_Unicode::String &getDestAvatarAddress() const { return m_destAvatarAddress; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
unsigned m_srcAvatarID;
|
||||
Plat_Unicode::String m_destAvatarName;
|
||||
Plat_Unicode::String m_destAvatarAddress;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MRemoveModeratorAvatar : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MRemoveModeratorAvatar(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MRemoveModeratorAvatar() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
const ChatAvatarCore *getDestAvatar() const { return &m_destAvatar; }
|
||||
|
||||
const Plat_Unicode::String &getRoomName() const { return m_roomName; }
|
||||
const Plat_Unicode::String &getRoomAddress() const { return m_roomAddress; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
ChatAvatarCore m_destAvatar;
|
||||
|
||||
Plat_Unicode::String m_roomName;
|
||||
Plat_Unicode::String m_roomAddress;
|
||||
};
|
||||
|
||||
class MAddTemporaryModeratorRoom : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MAddTemporaryModeratorRoom(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MAddTemporaryModeratorRoom() {};
|
||||
|
||||
unsigned getSrcAvatarID() const { return m_srcAvatarID; }
|
||||
ChatAvatarCore *getDestAvatar() const { return m_destAvatar; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
unsigned m_srcAvatarID;
|
||||
ChatAvatarCore *m_destAvatar;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MAddTemporaryModeratorAvatar : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MAddTemporaryModeratorAvatar(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MAddTemporaryModeratorAvatar() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
const ChatAvatarCore *getDestAvatar() const { return &m_destAvatar; }
|
||||
|
||||
const Plat_Unicode::String &getRoomName() const { return m_roomName; }
|
||||
const Plat_Unicode::String &getRoomAddress() const { return m_roomAddress; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
ChatAvatarCore m_destAvatar;
|
||||
|
||||
Plat_Unicode::String m_roomName;
|
||||
Plat_Unicode::String m_roomAddress;
|
||||
};
|
||||
|
||||
class MRemoveTemporaryModeratorRoom : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MRemoveTemporaryModeratorRoom(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MRemoveTemporaryModeratorRoom() {};
|
||||
|
||||
unsigned getSrcAvatarID() const { return m_srcAvatarID; }
|
||||
const Plat_Unicode::String &getDestAvatarName() const { return m_destAvatarName; }
|
||||
const Plat_Unicode::String &getDestAvatarAddress() const { return m_destAvatarAddress; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
unsigned m_srcAvatarID;
|
||||
Plat_Unicode::String m_destAvatarName;
|
||||
Plat_Unicode::String m_destAvatarAddress;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MRemoveTemporaryModeratorAvatar : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MRemoveTemporaryModeratorAvatar(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MRemoveTemporaryModeratorAvatar() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
const ChatAvatarCore *getDestAvatar() const { return &m_destAvatar; }
|
||||
|
||||
const Plat_Unicode::String &getRoomName() const { return m_roomName; }
|
||||
const Plat_Unicode::String &getRoomAddress() const { return m_roomAddress; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
ChatAvatarCore m_destAvatar;
|
||||
|
||||
Plat_Unicode::String m_roomName;
|
||||
Plat_Unicode::String m_roomAddress;
|
||||
};
|
||||
|
||||
class MAddBanRoom : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MAddBanRoom(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MAddBanRoom() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
ChatAvatarCore *getDestAvatar() const { return m_destAvatar; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
ChatAvatarCore *m_destAvatar;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MAddBanAvatar : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MAddBanAvatar(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MAddBanAvatar() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
const ChatAvatarCore *getDestAvatar() const { return &m_destAvatar; }
|
||||
|
||||
const Plat_Unicode::String &getRoomName() const { return m_roomName; }
|
||||
const Plat_Unicode::String &getRoomAddress() const { return m_roomAddress; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
ChatAvatarCore m_destAvatar;
|
||||
|
||||
Plat_Unicode::String m_roomName;
|
||||
Plat_Unicode::String m_roomAddress;
|
||||
};
|
||||
|
||||
class MRemoveBanRoom : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MRemoveBanRoom(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MRemoveBanRoom() {};
|
||||
|
||||
unsigned getSrcAvatarID() const { return m_srcAvatarID; }
|
||||
const Plat_Unicode::String &getDestAvatarName() const { return m_destAvatarName; }
|
||||
const Plat_Unicode::String &getDestAvatarAddress() const { return m_destAvatarAddress; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
unsigned m_srcAvatarID;
|
||||
Plat_Unicode::String m_destAvatarName;
|
||||
Plat_Unicode::String m_destAvatarAddress;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MRemoveBanAvatar : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MRemoveBanAvatar(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MRemoveBanAvatar() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
const ChatAvatarCore *getDestAvatar() const { return &m_destAvatar; }
|
||||
|
||||
const Plat_Unicode::String &getRoomName() const { return m_roomName; }
|
||||
const Plat_Unicode::String &getRoomAddress() const { return m_roomAddress; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
ChatAvatarCore m_destAvatar;
|
||||
|
||||
Plat_Unicode::String m_roomName;
|
||||
Plat_Unicode::String m_roomAddress;
|
||||
};
|
||||
|
||||
class MAddInviteRoom : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MAddInviteRoom(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MAddInviteRoom() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
ChatAvatarCore *getDestAvatar() const { return m_destAvatar; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
ChatAvatarCore *m_destAvatar;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MAddInviteAvatar : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MAddInviteAvatar(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MAddInviteAvatar() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
const ChatAvatarCore *getDestAvatar() const { return &m_destAvatar; }
|
||||
|
||||
const Plat_Unicode::String &getRoomName() const { return m_roomName; }
|
||||
const Plat_Unicode::String &getRoomAddress() const { return m_roomAddress; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
ChatAvatarCore m_destAvatar;
|
||||
|
||||
Plat_Unicode::String m_roomName;
|
||||
Plat_Unicode::String m_roomAddress;
|
||||
};
|
||||
|
||||
class MRemoveInviteRoom : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MRemoveInviteRoom(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MRemoveInviteRoom() {};
|
||||
|
||||
unsigned getSrcAvatarID() const { return m_srcAvatarID; }
|
||||
const Plat_Unicode::String &getDestAvatarName() const { return m_destAvatarName; }
|
||||
const Plat_Unicode::String &getDestAvatarAddress() const { return m_destAvatarAddress; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
unsigned m_srcAvatarID;
|
||||
Plat_Unicode::String m_destAvatarName;
|
||||
Plat_Unicode::String m_destAvatarAddress;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MRemoveInviteAvatar : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MRemoveInviteAvatar(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MRemoveInviteAvatar() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
const ChatAvatarCore *getDestAvatar() const { return &m_destAvatar; }
|
||||
|
||||
const Plat_Unicode::String &getRoomName() const { return m_roomName; }
|
||||
const Plat_Unicode::String &getRoomAddress() const { return m_roomAddress; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
ChatAvatarCore m_destAvatar;
|
||||
|
||||
Plat_Unicode::String m_roomName;
|
||||
Plat_Unicode::String m_roomAddress;
|
||||
};
|
||||
|
||||
class MGrantVoiceRoom : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MGrantVoiceRoom(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MGrantVoiceRoom() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
ChatAvatarCore *getDestAvatar() const { return m_destAvatar; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
ChatAvatarCore *m_destAvatar;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MGrantVoiceAvatar : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MGrantVoiceAvatar(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MGrantVoiceAvatar() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
const ChatAvatarCore *getDestAvatar() const { return &m_destAvatar; }
|
||||
|
||||
const Plat_Unicode::String &getRoomName() const { return m_roomName; }
|
||||
const Plat_Unicode::String &getRoomAddress() const { return m_roomAddress; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
ChatAvatarCore m_destAvatar;
|
||||
|
||||
Plat_Unicode::String m_roomName;
|
||||
Plat_Unicode::String m_roomAddress;
|
||||
};
|
||||
|
||||
class MRevokeVoiceRoom : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MRevokeVoiceRoom(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MRevokeVoiceRoom() {};
|
||||
|
||||
unsigned getSrcAvatarID() const { return m_srcAvatarID; }
|
||||
const Plat_Unicode::String &getDestAvatarName() const { return m_destAvatarName; }
|
||||
const Plat_Unicode::String &getDestAvatarAddress() const { return m_destAvatarAddress; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
unsigned m_srcAvatarID;
|
||||
Plat_Unicode::String m_destAvatarName;
|
||||
Plat_Unicode::String m_destAvatarAddress;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MRevokeVoiceAvatar : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MRevokeVoiceAvatar(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MRevokeVoiceAvatar() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
const ChatAvatarCore *getDestAvatar() const { return &m_destAvatar; }
|
||||
|
||||
const Plat_Unicode::String &getRoomName() const { return m_roomName; }
|
||||
const Plat_Unicode::String &getRoomAddress() const { return m_roomAddress; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
ChatAvatarCore m_destAvatar;
|
||||
|
||||
Plat_Unicode::String m_roomName;
|
||||
Plat_Unicode::String m_roomAddress;
|
||||
};
|
||||
|
||||
class MEnterRoom : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MEnterRoom(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MEnterRoom() {};
|
||||
|
||||
ChatAvatarCore *getSrcAvatar() const { return m_srcAvatar; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
ChatAvatarCore *m_srcAvatar;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MLeaveRoom : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MLeaveRoom(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MLeaveRoom() {};
|
||||
|
||||
unsigned getAvatarID() const { return m_avatarID; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
unsigned m_avatarID;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MDestroyRoom : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MDestroyRoom(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MDestroyRoom() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MSetRoomParams : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MSetRoomParams(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MSetRoomParams() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
const Plat_Unicode::String &getRoomName() const { return m_roomName; }
|
||||
const Plat_Unicode::String &getRoomTopic() const { return m_roomTopic; }
|
||||
const Plat_Unicode::String &getRoomPassword() const { return m_roomPassword; }
|
||||
unsigned getRoomAttributes() const { return m_roomAttributes; }
|
||||
unsigned getRoomSize() const { return m_maxRoomSize; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
Plat_Unicode::String m_roomName;
|
||||
Plat_Unicode::String m_roomTopic;
|
||||
Plat_Unicode::String m_roomPassword;
|
||||
unsigned m_roomAttributes;
|
||||
unsigned m_maxRoomSize;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MPersistentMessage : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MPersistentMessage(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MPersistentMessage();
|
||||
|
||||
unsigned getDestAvatarID() const { return m_destAvatarID; }
|
||||
const PersistentHeader *getHeader() const { return m_header; }
|
||||
|
||||
private:
|
||||
unsigned m_destAvatarID;
|
||||
PersistentHeaderCore *m_core;
|
||||
PersistentHeader *m_header;
|
||||
};
|
||||
|
||||
class MForcedLogout : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MForcedLogout(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MForcedLogout() {};
|
||||
|
||||
unsigned getAvatarID() const { return m_avatarID; }
|
||||
|
||||
private:
|
||||
unsigned m_avatarID;
|
||||
};
|
||||
|
||||
class MUnregisterRoomReady : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MUnregisterRoomReady(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MUnregisterRoomReady() {};
|
||||
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MAddAdmin : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MAddAdmin(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MAddAdmin() {};
|
||||
|
||||
ChatAvatarCore *getAvatar() const { return m_avatar; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
ChatAvatarCore *m_avatar;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MRemoveAdmin : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MRemoveAdmin(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MRemoveAdmin() {};
|
||||
|
||||
unsigned getAvatarID() const { return m_avatarID; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
private:
|
||||
unsigned m_avatarID;
|
||||
unsigned m_roomID;
|
||||
};
|
||||
|
||||
class MFriendConfirmRequest : GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MFriendConfirmRequest(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MFriendConfirmRequest() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
unsigned getDestAvatarID() const { return m_destAvatarID; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
unsigned m_destAvatarID;
|
||||
};
|
||||
|
||||
class MFriendConfirmResponse : GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MFriendConfirmResponse(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MFriendConfirmResponse() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
unsigned getDestAvatarID() const { return m_destAvatarID; }
|
||||
bool getConfirm() const { return m_confirm != 0; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
unsigned m_destAvatarID;
|
||||
short m_confirm;
|
||||
};
|
||||
|
||||
class MFriendConfirmReciprocateRequest : GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MFriendConfirmReciprocateRequest(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MFriendConfirmReciprocateRequest() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
unsigned getDestAvatarID() const { return m_destAvatarID; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
unsigned m_destAvatarID;
|
||||
};
|
||||
|
||||
class MFriendConfirmReciprocateResponse : GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MFriendConfirmReciprocateResponse(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MFriendConfirmReciprocateResponse() {};
|
||||
|
||||
const ChatAvatarCore *getSrcAvatar() const { return &m_srcAvatar; }
|
||||
unsigned getDestAvatarID() const { return m_destAvatarID; }
|
||||
bool getConfirm() const { return m_confirm != 0; }
|
||||
private:
|
||||
ChatAvatarCore m_srcAvatar;
|
||||
unsigned m_destAvatarID;
|
||||
short m_confirm;
|
||||
};
|
||||
|
||||
class MChangeRoomOwner: GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MChangeRoomOwner(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MChangeRoomOwner() {};
|
||||
|
||||
unsigned getDestRoomID() const { return m_destRoomID; }
|
||||
unsigned getNewRoomOwnerID() const { return m_newRoomOwnerID; }
|
||||
const Plat_Unicode::String &getNewRoomOwnerName() const { return m_newRoomOwnerName; }
|
||||
const Plat_Unicode::String &getNewRoomOwnerAddress() const { return m_newRoomOwnerAddress; }
|
||||
|
||||
private:
|
||||
unsigned m_destRoomID;
|
||||
unsigned m_newRoomOwnerID;
|
||||
Plat_Unicode::String m_newRoomOwnerName;
|
||||
Plat_Unicode::String m_newRoomOwnerAddress;
|
||||
};
|
||||
|
||||
class MRoomEntryRequest : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MRoomEntryRequest(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MRoomEntryRequest() {};
|
||||
|
||||
unsigned getRoomOwnerID() const { return m_roomOwnerID; }
|
||||
const ChatAvatarCore *getRequestorAvatar() const { return &m_requestorAvatar; }
|
||||
const Plat_Unicode::String &getRequestedRoomAddress() const { return m_requestedRoomAddress; }
|
||||
|
||||
private:
|
||||
unsigned m_roomOwnerID;
|
||||
ChatAvatarCore m_requestorAvatar;
|
||||
Plat_Unicode::String m_requestedRoomAddress;
|
||||
};
|
||||
|
||||
class MDelayedRoomEntry : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MDelayedRoomEntry(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MDelayedRoomEntry() {};
|
||||
|
||||
unsigned getAvatarID() const { return m_avatarID; }
|
||||
unsigned getRoomID() const { return m_roomID; }
|
||||
const Plat_Unicode::String &getEnteredAddress() { return m_enteredAddress; }
|
||||
ChatRoomCore *getRoom() const { return m_room; }
|
||||
const std::set<ChatRoomCore *> &getExtraRooms() { return m_setExtraRooms; }
|
||||
|
||||
private:
|
||||
unsigned m_avatarID;
|
||||
unsigned m_roomID;
|
||||
Plat_Unicode::String m_enteredAddress;
|
||||
ChatRoomCore* m_room;
|
||||
std::set<ChatRoomCore *> m_setExtraRooms;
|
||||
};
|
||||
|
||||
class MDeniedRoomEntry : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MDeniedRoomEntry(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MDeniedRoomEntry() {};
|
||||
|
||||
unsigned getRequestorID() const { return m_requestorAvatarID; }
|
||||
const Plat_Unicode::String &getRequestedRoomAddress() const { return m_requestedRoomAddress; }
|
||||
|
||||
private:
|
||||
unsigned m_requestorAvatarID;
|
||||
Plat_Unicode::String m_requestedRoomAddress;
|
||||
};
|
||||
|
||||
class MForceRoomFailover : GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MForceRoomFailover(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MForceRoomFailover() {};
|
||||
|
||||
const std::list<Plat_Unicode::String> &getAIDList() const { return m_aidList; }
|
||||
private:
|
||||
std::list <Plat_Unicode::String> m_aidList;
|
||||
};
|
||||
|
||||
class MSnoop : GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MSnoop(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MSnoop() {};
|
||||
|
||||
unsigned getSnoopType() const { return m_snoopType; }
|
||||
const Plat_Unicode::String &getSnooperName() const { return m_snooperName; }
|
||||
const Plat_Unicode::String &getSnooperAddr() const { return m_snooperAddr; }
|
||||
const Plat_Unicode::String &getSrcName() const { return m_srcName; }
|
||||
const Plat_Unicode::String &getSrcAddr() const { return m_srcAddr; }
|
||||
const Plat_Unicode::String &getDestName() const { return m_destName; }
|
||||
const Plat_Unicode::String &getDestAddr() const { return m_destAddr; }
|
||||
const Plat_Unicode::String &getMessage() const { return m_message; }
|
||||
private:
|
||||
unsigned m_snoopType;
|
||||
Plat_Unicode::String m_snooperName;
|
||||
Plat_Unicode::String m_snooperAddr;
|
||||
Plat_Unicode::String m_srcName;
|
||||
Plat_Unicode::String m_srcAddr;
|
||||
Plat_Unicode::String m_destName;
|
||||
Plat_Unicode::String m_destAddr;
|
||||
Plat_Unicode::String m_message;
|
||||
};
|
||||
|
||||
class MUIDList : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MUIDList(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MUIDList() {};
|
||||
|
||||
const std::set<Plat_Unicode::String> &getUIDList() const { return m_uidList; }
|
||||
private:
|
||||
std::set<Plat_Unicode::String> m_uidList;
|
||||
};
|
||||
|
||||
class MNotifyFriendIsRemoved : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MNotifyFriendIsRemoved(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MNotifyFriendIsRemoved() {};
|
||||
|
||||
const unsigned &getAvatarID() const { return m_avatarID; }
|
||||
const Plat_Unicode::String &getDestName() const { return m_destName; }
|
||||
const Plat_Unicode::String &getDestAddress() const { return m_destAddress; }
|
||||
private:
|
||||
unsigned m_avatarID;
|
||||
Plat_Unicode::String m_destName;
|
||||
Plat_Unicode::String m_destAddress;
|
||||
};
|
||||
|
||||
class MNotifyFriendsListChange : public GenericAPI::GenericMessage
|
||||
{
|
||||
public:
|
||||
MNotifyFriendsListChange(Base::ByteStream::ReadIterator &iter);
|
||||
virtual ~MNotifyFriendsListChange() {};
|
||||
|
||||
const unsigned &getAvatarID() const { return m_avatarID; }
|
||||
const Plat_Unicode::String &getOriginalName() const { return m_originalName; }
|
||||
const Plat_Unicode::String &getOriginalAddress() const { return m_originalAddress; }
|
||||
const Plat_Unicode::String &getNewName() const { return m_newName; }
|
||||
const Plat_Unicode::String &getNewAddress() const { return m_newAddress; }
|
||||
private:
|
||||
|
||||
unsigned m_avatarID;
|
||||
Plat_Unicode::String m_originalName;
|
||||
Plat_Unicode::String m_originalAddress;
|
||||
Plat_Unicode::String m_newName;
|
||||
Plat_Unicode::String m_newAddress;
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
#include "PersistentMessage.h"
|
||||
#include "PersistentMessageCore.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
|
||||
using namespace Base;
|
||||
using namespace Plat_Unicode;
|
||||
|
||||
PersistentHeader::PersistentHeader()
|
||||
: m_core(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
PersistentHeader::~PersistentHeader()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned PersistentHeader::getMessageID() const
|
||||
{
|
||||
return m_core->getMessageID();
|
||||
}
|
||||
|
||||
unsigned PersistentHeader::getAvatarID() const
|
||||
{
|
||||
return m_core->getAvatarID();
|
||||
}
|
||||
|
||||
const ChatUnicodeString &PersistentHeader::getFromName() const
|
||||
{
|
||||
return m_fromName;
|
||||
}
|
||||
|
||||
const ChatUnicodeString &PersistentHeader::getFromAddress() const
|
||||
{
|
||||
return m_fromAddress;
|
||||
}
|
||||
|
||||
const ChatUnicodeString &PersistentHeader::getSubject() const
|
||||
{
|
||||
return m_subject;
|
||||
}
|
||||
|
||||
const ChatUnicodeString &PersistentHeader::getFolder() const
|
||||
{
|
||||
return m_folder;
|
||||
}
|
||||
|
||||
const ChatUnicodeString &PersistentHeader::getCategory() const
|
||||
{
|
||||
return m_category;
|
||||
}
|
||||
|
||||
unsigned PersistentHeader::getSentTime() const
|
||||
{
|
||||
return m_core->getSentTime();
|
||||
}
|
||||
|
||||
unsigned PersistentHeader::getStatus() const
|
||||
{
|
||||
return m_core->getStatus();
|
||||
}
|
||||
|
||||
PersistentHeaderCore::PersistentHeaderCore()
|
||||
: m_messageID(0),
|
||||
m_avatarID(0),
|
||||
m_sentTime(0),
|
||||
m_status(0),
|
||||
m_interface(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
PersistentHeaderCore::~PersistentHeaderCore()
|
||||
{
|
||||
}
|
||||
|
||||
void PersistentHeaderCore::load(ByteStream::ReadIterator &iter, PersistentHeader *inf)
|
||||
{
|
||||
m_interface = inf;
|
||||
inf->m_core = this;
|
||||
get(iter, m_messageID);
|
||||
get(iter, m_avatarID);
|
||||
get(iter, m_fromName);
|
||||
get(iter, m_fromAddress);
|
||||
get(iter, m_subject);
|
||||
get(iter, m_sentTime);
|
||||
get(iter, m_status);
|
||||
|
||||
m_interface->m_fromName = m_fromName;
|
||||
m_interface->m_fromAddress = m_fromAddress;
|
||||
m_interface->m_subject = m_subject;
|
||||
}
|
||||
|
||||
void PersistentHeaderCore::setFolder(Base::ByteStream::ReadIterator &iter)
|
||||
{
|
||||
get(iter, m_folder);
|
||||
|
||||
m_interface->m_folder = m_folder;
|
||||
}
|
||||
|
||||
|
||||
void PersistentHeaderCore::setCategory(Base::ByteStream::ReadIterator &iter)
|
||||
{
|
||||
get(iter, m_category);
|
||||
|
||||
m_interface->m_category = m_category;
|
||||
}
|
||||
|
||||
PersistentMessageCore::PersistentMessageCore()
|
||||
: m_messageID(0),
|
||||
m_avatarID(0),
|
||||
m_sentTime(0),
|
||||
m_status(0),
|
||||
m_fetchResult(0)
|
||||
{
|
||||
}
|
||||
|
||||
PersistentMessageCore::~PersistentMessageCore()
|
||||
{
|
||||
}
|
||||
|
||||
void PersistentMessageCore::load(Base::ByteStream::ReadIterator &iter)
|
||||
{
|
||||
Plat_Unicode::String wideString;
|
||||
|
||||
get(iter, m_messageID);
|
||||
get(iter, m_avatarID);
|
||||
|
||||
get(iter, wideString);
|
||||
m_fromName = wideString;
|
||||
|
||||
get(iter, wideString);
|
||||
m_fromAddress = wideString;
|
||||
|
||||
get(iter, wideString);
|
||||
m_subject = wideString;
|
||||
|
||||
get(iter, m_sentTime);
|
||||
get(iter, m_status);
|
||||
|
||||
get(iter, wideString);
|
||||
m_folder = wideString;
|
||||
|
||||
get(iter, wideString);
|
||||
m_category = wideString;
|
||||
|
||||
get(iter, m_fetchResult);
|
||||
|
||||
get(iter, wideString);
|
||||
m_msg = wideString;
|
||||
|
||||
get(iter, wideString);
|
||||
m_oob = wideString;
|
||||
}
|
||||
|
||||
};
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
#if !defined (PERSISTENTMESSAGE_H_)
|
||||
#define PERSISTENTMESSAGE_H_
|
||||
|
||||
#include "ChatEnum.h"
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
class PersistentHeaderCore;
|
||||
|
||||
class PersistentHeader
|
||||
{
|
||||
public:
|
||||
PersistentHeader();
|
||||
~PersistentHeader();
|
||||
|
||||
unsigned getMessageID() const;
|
||||
unsigned getAvatarID() const;
|
||||
const ChatUnicodeString &getFromName() const;
|
||||
const ChatUnicodeString &getFromAddress() const;
|
||||
const ChatUnicodeString &getSubject() const;
|
||||
const ChatUnicodeString &getFolder() const;
|
||||
const ChatUnicodeString &getCategory() const;
|
||||
|
||||
unsigned getSentTime() const;
|
||||
unsigned getStatus() const;
|
||||
|
||||
friend class PersistentHeaderCore;
|
||||
private:
|
||||
ChatUnicodeString m_fromName;
|
||||
ChatUnicodeString m_fromAddress;
|
||||
ChatUnicodeString m_subject;
|
||||
ChatUnicodeString m_folder;
|
||||
ChatUnicodeString m_category;
|
||||
|
||||
PersistentHeaderCore *m_core;
|
||||
};
|
||||
|
||||
class PersistentMessage
|
||||
{
|
||||
public:
|
||||
virtual unsigned getMessageID() const = 0;
|
||||
virtual unsigned getAvatarID() const = 0;
|
||||
virtual const ChatUnicodeString &getFromName() const = 0;
|
||||
virtual const ChatUnicodeString &getFromAddress() const = 0;
|
||||
virtual const ChatUnicodeString &getSubject() const = 0;
|
||||
virtual const ChatUnicodeString &getFolder() const = 0;
|
||||
virtual const ChatUnicodeString &getCategory() const = 0;
|
||||
|
||||
virtual unsigned getSentTime() const = 0;
|
||||
virtual unsigned getStatus() const = 0;
|
||||
|
||||
virtual const ChatUnicodeString &getMsg() const = 0;
|
||||
virtual const ChatUnicodeString &getOOB() const = 0;
|
||||
};
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
#if !defined (PERSISTENTHEADERCORE_H_)
|
||||
#define PERSISTENTHEADERCORE_H_
|
||||
|
||||
#include <Base/Archive.h>
|
||||
#include <Unicode/Unicode.h>
|
||||
#include <Unicode/UnicodeUtils.h>
|
||||
|
||||
namespace ChatSystem
|
||||
{
|
||||
|
||||
class PersistentHeader;
|
||||
|
||||
class PersistentHeaderCore
|
||||
{
|
||||
public:
|
||||
PersistentHeaderCore();
|
||||
~PersistentHeaderCore();
|
||||
|
||||
unsigned getMessageID() const { return m_messageID; }
|
||||
unsigned getAvatarID() const { return m_avatarID; }
|
||||
const Plat_Unicode::String &getFromName() const { return m_fromName; }
|
||||
const Plat_Unicode::String &getFromAddress() const { return m_fromAddress; }
|
||||
const Plat_Unicode::String &getSubject() const { return m_subject; }
|
||||
const Plat_Unicode::String &getFolder() const { return m_folder; }
|
||||
|
||||
unsigned getSentTime() const { return m_sentTime; }
|
||||
unsigned getStatus() const { return m_status; }
|
||||
void load(Base::ByteStream::ReadIterator &iter, PersistentHeader *inf);
|
||||
void setFolder(Base::ByteStream::ReadIterator &iter);
|
||||
void setCategory(Base::ByteStream::ReadIterator &iter);
|
||||
private:
|
||||
unsigned m_messageID;
|
||||
unsigned m_avatarID;
|
||||
unsigned m_sentTime;
|
||||
unsigned m_status;
|
||||
Plat_Unicode::String m_fromName;
|
||||
Plat_Unicode::String m_fromAddress;
|
||||
Plat_Unicode::String m_subject;
|
||||
Plat_Unicode::String m_folder;
|
||||
Plat_Unicode::String m_category;
|
||||
|
||||
PersistentHeader *m_interface;
|
||||
};
|
||||
|
||||
class PersistentMessageCore : public PersistentMessage
|
||||
{
|
||||
public:
|
||||
PersistentMessageCore();
|
||||
virtual ~PersistentMessageCore();
|
||||
|
||||
// PersistentMessage implementations
|
||||
virtual unsigned getMessageID() const { return m_messageID; }
|
||||
virtual unsigned getAvatarID() const { return m_avatarID; }
|
||||
virtual const ChatUnicodeString &getFromName() const { return m_fromName; }
|
||||
virtual const ChatUnicodeString &getFromAddress() const { return m_fromAddress; }
|
||||
virtual const ChatUnicodeString &getSubject() const { return m_subject; }
|
||||
virtual const ChatUnicodeString &getFolder() const { return m_folder; }
|
||||
virtual const ChatUnicodeString &getCategory() const { return m_category; }
|
||||
|
||||
virtual unsigned getSentTime() const { return m_sentTime; }
|
||||
virtual unsigned getStatus() const { return m_status; }
|
||||
|
||||
virtual const ChatUnicodeString &getMsg() const { return m_msg; }
|
||||
virtual const ChatUnicodeString &getOOB() const { return m_oob; }
|
||||
|
||||
void load(Base::ByteStream::ReadIterator &iter);
|
||||
|
||||
private:
|
||||
unsigned m_messageID;
|
||||
unsigned m_avatarID;
|
||||
unsigned m_sentTime;
|
||||
unsigned m_status;
|
||||
unsigned m_fetchResult;
|
||||
ChatUnicodeString m_fromName;
|
||||
ChatUnicodeString m_fromAddress;
|
||||
ChatUnicodeString m_subject;
|
||||
ChatUnicodeString m_folder;
|
||||
ChatUnicodeString m_category;
|
||||
ChatUnicodeString m_msg;
|
||||
ChatUnicodeString m_oob;
|
||||
};
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
#if !defined (ROOMPARAMSCORE_H_)
|
||||
#define ROOMPARAMSCORE_H_
|
||||
|
||||
#include <Unicode/Unicode.h>
|
||||
|
||||
#include "ChatEnum.h"
|
||||
|
||||
namespace ChatSystem {
|
||||
|
||||
|
||||
struct RoomParamsCore
|
||||
{
|
||||
Plat_Unicode::String m_name;
|
||||
ChatUnicodeString m_cName;
|
||||
Plat_Unicode::String m_topic;
|
||||
ChatUnicodeString m_cTopic;
|
||||
Plat_Unicode::String m_password;
|
||||
ChatUnicodeString m_cPassword;
|
||||
|
||||
unsigned m_attributes;
|
||||
unsigned m_size;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#if !defined (ROOMSUMMARYCORE_H_)
|
||||
#define ROOMSUMMARYCORE_H_
|
||||
|
||||
#include <Unicode/Unicode.h>
|
||||
|
||||
#include "ChatEnum.h"
|
||||
|
||||
namespace ChatSystem {
|
||||
|
||||
|
||||
struct RoomSummaryCore
|
||||
{
|
||||
Plat_Unicode::String m_address;
|
||||
Plat_Unicode::String m_topic;
|
||||
|
||||
|
||||
unsigned m_attributes;
|
||||
unsigned m_curSize;
|
||||
unsigned m_maxSize;
|
||||
};
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user