mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
Removed methods on RsControl for handling id's of chat and messages.
Now the user can write mail messages and two or more parallel MessageComposer's. Recompile needed. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3534 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
752495d239
commit
789ca4ff6b
7 changed files with 73 additions and 271 deletions
|
@ -87,9 +87,6 @@ public:
|
|||
virtual void lockData() = 0;
|
||||
virtual void unlockData() = 0;
|
||||
|
||||
const std::list<FileInfo> &getRecommendList()
|
||||
{ return mRecommendList; }
|
||||
|
||||
const RsConfig &getConfig()
|
||||
{ return mConfig; }
|
||||
/****************************************/
|
||||
|
@ -125,8 +122,6 @@ bool hasChanged(DataFlags set); /* resets it */
|
|||
void fillLists(); /* create some dummy data to display */
|
||||
|
||||
/* Internals */
|
||||
std::list<FileInfo> mRecommendList;
|
||||
|
||||
bool mChanged[NumOfFlags];
|
||||
|
||||
RsConfig mConfig;
|
||||
|
@ -154,19 +149,10 @@ class RsControl /* The Main Interface Class - for controlling the server */
|
|||
/****************************************/
|
||||
|
||||
/* Flagging Persons / Channels / Files in or out of a set (CheckLists) */
|
||||
virtual int SetInChat(std::string id, bool in) = 0; /* friend : chat msgs */
|
||||
virtual int SetInMsg(std::string id, bool in) = 0; /* friend : msg receipients */
|
||||
virtual int SetInBroadcast(std::string id, bool in) = 0; /* channel : channel broadcast */
|
||||
virtual int SetInSubscribe(std::string id, bool in) = 0; /* channel : subscribed channels */
|
||||
virtual int SetInRecommend(std::string id, bool in) = 0; /* file : recommended file */
|
||||
virtual int ClearInChat() = 0;
|
||||
virtual int ClearInMsg() = 0;
|
||||
virtual int ClearInBroadcast() = 0;
|
||||
virtual int ClearInSubscribe() = 0;
|
||||
virtual int ClearInRecommend() = 0;
|
||||
|
||||
virtual bool IsInChat(std::string id) = 0; /* friend : chat msgs */
|
||||
virtual bool IsInMsg(std::string id) = 0; /* friend : msg recpts*/
|
||||
|
||||
/****************************************/
|
||||
/* Config */
|
||||
|
|
|
@ -39,118 +39,6 @@ const int p3facemsgzone = 11453;
|
|||
|
||||
|
||||
/* Flagging Persons / Channels / Files in or out of a set (CheckLists) */
|
||||
int RsServer::ClearInChat()
|
||||
{
|
||||
lockRsCore(); /* LOCK */
|
||||
|
||||
mInChatList.clear();
|
||||
|
||||
unlockRsCore(); /* UNLOCK */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Flagging Persons / Channels / Files in or out of a set (CheckLists) */
|
||||
int RsServer::SetInChat(std::string id, bool in) /* friend : chat msgs */
|
||||
{
|
||||
/* so we send this.... */
|
||||
lockRsCore(); /* LOCK */
|
||||
|
||||
//std::cerr << "Set InChat(" << id << ") to " << (in ? "True" : "False") << std::endl;
|
||||
std::list<std::string>::iterator it;
|
||||
it = std::find(mInChatList.begin(), mInChatList.end(), id);
|
||||
if (it == mInChatList.end())
|
||||
{
|
||||
if (in)
|
||||
{
|
||||
mInChatList.push_back(id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!in)
|
||||
{
|
||||
mInChatList.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
unlockRsCore(); /* UNLOCK */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int RsServer::ClearInMsg()
|
||||
{
|
||||
lockRsCore(); /* LOCK */
|
||||
|
||||
mInMsgList.clear();
|
||||
|
||||
unlockRsCore(); /* UNLOCK */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int RsServer::SetInMsg(std::string id, bool in) /* friend : msgs */
|
||||
{
|
||||
/* so we send this.... */
|
||||
lockRsCore(); /* LOCK */
|
||||
|
||||
//std::cerr << "Set InMsg(" << id << ") to " << (in ? "True" : "False") << std::endl;
|
||||
std::list<std::string>::iterator it;
|
||||
it = std::find(mInMsgList.begin(), mInMsgList.end(), id);
|
||||
if (it == mInMsgList.end())
|
||||
{
|
||||
if (in)
|
||||
{
|
||||
mInMsgList.push_back(id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!in)
|
||||
{
|
||||
mInMsgList.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
unlockRsCore(); /* UNLOCK */
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool RsServer::IsInChat(std::string id) /* friend : chat msgs */
|
||||
{
|
||||
/* so we send this.... */
|
||||
lockRsCore(); /* LOCK */
|
||||
|
||||
std::list<std::string>::iterator it;
|
||||
it = std::find(mInChatList.begin(), mInChatList.end(), id);
|
||||
bool inChat = (it != mInChatList.end());
|
||||
|
||||
unlockRsCore(); /* UNLOCK */
|
||||
|
||||
return inChat;
|
||||
}
|
||||
|
||||
|
||||
bool RsServer::IsInMsg(std::string id) /* friend : msg recpts*/
|
||||
{
|
||||
/* so we send this.... */
|
||||
lockRsCore(); /* LOCK */
|
||||
|
||||
std::list<std::string>::iterator it;
|
||||
it = std::find(mInMsgList.begin(), mInMsgList.end(), id);
|
||||
bool inMsg = (it != mInMsgList.end());
|
||||
|
||||
unlockRsCore(); /* UNLOCK */
|
||||
|
||||
return inMsg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int RsServer::ClearInBroadcast()
|
||||
{
|
||||
|
@ -171,53 +59,3 @@ int RsServer::SetInSubscribe(std::string id, bool in) /* channel : su
|
|||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int RsServer::ClearInRecommend()
|
||||
{
|
||||
/* find in people ... set chat flag */
|
||||
RsIface &iface = getIface();
|
||||
iface.lockData(); /* LOCK IFACE */
|
||||
|
||||
std::list<FileInfo> &recs = iface.mRecommendList;
|
||||
std::list<FileInfo>::iterator it;
|
||||
|
||||
for(it = recs.begin(); it != recs.end(); it++)
|
||||
{
|
||||
it -> inRecommend = false;
|
||||
}
|
||||
|
||||
iface.unlockData(); /* UNLOCK IFACE */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int RsServer::SetInRecommend(std::string id, bool in) /* file : recommended file */
|
||||
{
|
||||
/* find in people ... set chat flag */
|
||||
RsIface &iface = getIface();
|
||||
iface.lockData(); /* LOCK IFACE */
|
||||
|
||||
std::list<FileInfo> &recs = iface.mRecommendList;
|
||||
std::list<FileInfo>::iterator it;
|
||||
|
||||
for(it = recs.begin(); it != recs.end(); it++)
|
||||
{
|
||||
if (it -> fname == id)
|
||||
{
|
||||
/* set flag */
|
||||
it -> inRecommend = in;
|
||||
//std::cerr << "Set InRecommend (" << id << ") to " << (in ? "True" : "False") << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
iface.unlockData(); /* UNLOCK IFACE */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -109,25 +109,13 @@ class RsServer: public RsControl, public RsThread
|
|||
|
||||
public:
|
||||
/* Flagging Persons / Channels / Files in or out of a set (CheckLists) */
|
||||
virtual int SetInChat(std::string id, bool in); /* friend : chat msgs */
|
||||
virtual int SetInMsg(std::string id, bool in); /* friend : msg receipients */
|
||||
virtual int SetInBroadcast(std::string id, bool in); /* channel : channel broadcast */
|
||||
virtual int SetInSubscribe(std::string id, bool in); /* channel : subscribed channels */
|
||||
virtual int SetInRecommend(std::string id, bool in); /* file : recommended file */
|
||||
virtual int ClearInChat();
|
||||
virtual int ClearInMsg();
|
||||
virtual int ClearInBroadcast();
|
||||
virtual int ClearInSubscribe();
|
||||
virtual int ClearInRecommend();
|
||||
|
||||
virtual bool IsInChat(std::string id); /* friend : chat msgs */
|
||||
virtual bool IsInMsg(std::string id); /* friend : msg recpts*/
|
||||
|
||||
|
||||
private:
|
||||
|
||||
std::list<std::string> mInChatList, mInMsgList;
|
||||
|
||||
void initRsMI(RsMsgItem *msg, MessageInfo &mi);
|
||||
|
||||
/****************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue