mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-27 00:15:51 -04:00
Changes to support the new NewsFeed.
* added interface to rsnotify/p3notify/pqinotify * added getForumInfo() to forum interface. * added virtual functions to p3distrib for event feedback. New NewsFeed Notification. * Peer Connection/Disconnection. * Failed Certificate connection. * New/Updated Forums and Forum Msgs. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@616 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
971ad4fe9b
commit
9f024eaee7
12 changed files with 192 additions and 16 deletions
|
@ -94,6 +94,28 @@ bool p3Forums::forumsChanged(std::list<std::string> &forumIds)
|
|||
return groupsChanged(forumIds);
|
||||
}
|
||||
|
||||
bool p3Forums::getForumInfo(std::string fId, ForumInfo &fi)
|
||||
{
|
||||
RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/
|
||||
|
||||
/* extract details */
|
||||
GroupInfo *gi = locked_getGroupInfo(fId);
|
||||
|
||||
if (!gi)
|
||||
return false;
|
||||
|
||||
fi.forumId = gi->grpId;
|
||||
fi.forumName = gi->grpName;
|
||||
fi.forumDesc = gi->grpDesc;
|
||||
|
||||
fi.forumFlags = gi->flags;
|
||||
|
||||
fi.pop = gi->sources.size();
|
||||
fi.lastPost = gi->lastPost;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool p3Forums::getForumList(std::list<ForumInfo> &forumList)
|
||||
{
|
||||
|
@ -102,23 +124,13 @@ bool p3Forums::getForumList(std::list<ForumInfo> &forumList)
|
|||
|
||||
getAllGroupList(grpIds);
|
||||
|
||||
RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/
|
||||
for(it = grpIds.begin(); it != grpIds.end(); it++)
|
||||
{
|
||||
/* extract details */
|
||||
GroupInfo *gi = locked_getGroupInfo(*it);
|
||||
|
||||
ForumInfo fi;
|
||||
fi.forumId = gi->grpId;
|
||||
fi.forumName = gi->grpName;
|
||||
fi.forumDesc = gi->grpDesc;
|
||||
|
||||
fi.forumFlags = gi->flags;
|
||||
|
||||
fi.pop = gi->sources.size();
|
||||
fi.lastPost = gi->lastPost;
|
||||
|
||||
forumList.push_back(fi);
|
||||
if (getForumInfo(*it, fi))
|
||||
{
|
||||
forumList.push_back(fi);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -341,6 +353,42 @@ bool p3Forums::forumSubscribe(std::string fId, bool subscribe)
|
|||
}
|
||||
|
||||
|
||||
/***************************************************************************************/
|
||||
/****************** Event Feedback (Overloaded form p3distrib) *************************/
|
||||
/***************************************************************************************/
|
||||
|
||||
#include "pqi/pqinotify.h"
|
||||
|
||||
bool p3Forums::locked_eventUpdateGroup(GroupInfo *info, bool isNew)
|
||||
{
|
||||
std::string grpId = info->grpId;
|
||||
std::string msgId;
|
||||
std::string nullId;
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_FORUM_NEW, grpId, msgId, nullId);
|
||||
}
|
||||
else
|
||||
{
|
||||
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_FORUM_UPDATE, grpId, msgId, nullId);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3Forums::locked_eventNewMsg(RsDistribMsg *msg)
|
||||
{
|
||||
std::string grpId = msg->grpId;
|
||||
std::string msgId = msg->msgId;
|
||||
std::string nullId;
|
||||
|
||||
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_FORUM_MSG, grpId, msgId, nullId);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************/
|
||||
|
||||
void p3Forums::loadDummyData()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue