Added read/unread state to channel service (copied from forum service).

Added new and missing tests of the RsItems.
Added new notifier on channel changes.
Reworked fill of channels in ChannelFeed. Now the channel tree is updated and not refilled.
Show unread message count in channels tree.
Fixed memory leak in context menu.
Show a new tray icon and action icon in MainWindow, when new channel messages are available.

Recompile of the GUI needed.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3626 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-10-07 00:17:42 +00:00
parent df20d69b29
commit fc0ff38206
22 changed files with 1181 additions and 653 deletions

View file

@ -276,6 +276,51 @@ bool operator==(const RsForumReadStatus& frs1, const RsForumReadStatus& frs2)
RsSerialType* init_item(RsChannelReadStatus& fRdStatus)
{
randString(SHORT_STR, fRdStatus.channelId);
fRdStatus.save_type = rand()%42;
std::map<std::string, uint32_t>::iterator mit = fRdStatus.msgReadStatus.begin();
std::string id;
uint32_t status = 0;
int numMaps = rand()%12;
for(int i = 0; i < numMaps; i++)
{
randString(SHORT_STR, id);
status = rand()%23;
fRdStatus.msgReadStatus.insert(std::pair<std::string, uint32_t>(id, status));
}
return new RsChannelSerialiser();
}
bool operator==(const RsChannelReadStatus& frs1, const RsChannelReadStatus& frs2)
{
if(frs1.channelId != frs2.channelId) return false;
if(frs1.save_type != frs2.save_type) return false;
if(frs1.msgReadStatus.size() != frs2.msgReadStatus.size()) return false;
std::map<std::string, uint32_t>::const_iterator mit
= frs1.msgReadStatus.begin();
for(;mit != frs1.msgReadStatus.end(); mit++)
{
if(mit->second != frs2.msgReadStatus.find(mit->first)->second) return false;
}
return true;
}
bool operator==(const RsBlogMsg& bMsg1,const RsBlogMsg& bMsg2)
{
@ -307,6 +352,7 @@ int main(){
test_RsItem<RsDistribGrpKey>(); REPORT("Serialise/Deserialise RsDistribGrpKey");
test_RsItem<RsDistribSignedMsg>(); REPORT("Serialise/Deserialise RsDistribSignedMsg");
test_RsItem<RsChannelMsg>(); REPORT("Serialise/Deserialise RsChannelMsg");
test_RsItem<RsChannelReadStatus>(); REPORT("Serialise/Deserialise RsChannelReadStatus");
test_RsItem<RsForumMsg>(); REPORT("Serialise/Deserialise RsForumMsg");
test_RsItem<RsForumReadStatus>(); REPORT("Serialise/Deserialise RsForumReadStatus");
test_RsItem<RsBlogMsg>(); REPORT("Serialise/Deserialise RsBlogMsg");

View file

@ -42,6 +42,18 @@ RsSerialType* init_item(RsChatMsgItem& cmi)
return new RsChatSerialiser();
}
RsSerialType* init_item(RsPrivateChatMsgConfigItem& pcmi)
{
randString(SHORT_STR, pcmi.configPeerId);
pcmi.chatFlags = rand()%34;
pcmi.configFlags = rand()%21;
pcmi.sendTime = rand()%422224;
randString(LARGE_STR, pcmi.message);
pcmi.recvTime = rand()%344443;
return new RsChatSerialiser();
}
RsSerialType* init_item(RsChatStatusItem& csi)
{
@ -123,6 +135,19 @@ bool operator ==(const RsChatMsgItem& cmiLeft,const RsChatMsgItem& cmiRight)
return true;
}
bool operator ==(const RsPrivateChatMsgConfigItem& pcmiLeft,const RsPrivateChatMsgConfigItem& pcmiRight)
{
if(pcmiLeft.configPeerId != pcmiRight.configPeerId) return false;
if(pcmiLeft.chatFlags != pcmiRight.chatFlags) return false;
if(pcmiLeft.configFlags != pcmiRight.configFlags) return false;
if(pcmiLeft.message != pcmiRight.message) return false;
if(pcmiLeft.sendTime != pcmiRight.sendTime) return false;
if(pcmiLeft.recvTime != pcmiRight.recvTime) return false;
return true;
}
bool operator ==(const RsChatStatusItem& csiLeft, const RsChatStatusItem& csiRight)
{
if(csiLeft.flags != csiRight.flags) return false;
@ -201,6 +226,7 @@ bool operator ==(const RsMsgSrcId& msLeft, const RsMsgSrcId& msRight)
int main()
{
test_RsItem<RsChatMsgItem >(); REPORT("Serialise/Deserialise RsChatMsgItem");
test_RsItem<RsChatMsgItem >(); REPORT("Serialise/Deserialise RsPrivateChatMsgConfigItem");
test_RsItem<RsChatStatusItem >(); REPORT("Serialise/Deserialise RsChatStatusItem");
test_RsItem<RsChatAvatarItem >(); REPORT("Serialise/Deserialise RsChatAvatarItem");
test_RsItem<RsMsgItem >(); REPORT("Serialise/Deserialise RsMsgItem");