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:
drbob 2008-06-20 12:38:11 +00:00
parent 971ad4fe9b
commit 9f024eaee7
12 changed files with 192 additions and 16 deletions

View file

@ -27,6 +27,9 @@
#include "pqinetwork.h"
/******************** notify of new Cert **************************/
#include "pqinotify.h"
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
@ -1202,6 +1205,14 @@ bool AuthXPGP::ProcessXPGP(XPGP *xpgp, std::string &id)
mToSaveCerts = true;
xpgpMtx.unlock(); /**** UNLOCK ****/
/******************** notify of new Cert **************************/
pqiNotify *pqinotify = getPqiNotify();
if (pqinotify)
{
pqinotify->AddFeedItem(RS_FEED_ITEM_PEER_NEW, xpgpid, "","");
}
/******************** notify of new Cert **************************/
id = xpgpid;
return true;

View file

@ -1056,6 +1056,19 @@ void p3ConnectMgr::tickMonitors()
{
notify->AddPopupMessage(RS_POPUP_CONNECT,
peer.id, "Peer Online: ");
notify->AddFeedItem(RS_FEED_ITEM_PEER_CONNECT, peer.id, "", "");
}
}
if (peer.actions & RS_PEER_DISCONNECTED)
{
pqiNotify *notify = getPqiNotify();
if (notify)
{
notify->AddFeedItem(RS_FEED_ITEM_PEER_DISCONNECT, peer.id, "", "");
}
}
}

View file

@ -132,3 +132,27 @@ bool p3Notify::AddSysMessage(uint32_t sysid, uint32_t type,
return true;
}
bool p3Notify::GetFeedItem(RsFeedItem &item)
{
RsStackMutex stack(noteMtx); /************* LOCK MUTEX ************/
if (pendingNewsFeed.size() > 0)
{
item = pendingNewsFeed.front();
pendingNewsFeed.pop_front();
return true;
}
return false;
}
bool p3Notify::AddFeedItem(uint32_t type, std::string id1, std::string id2, std::string id3)
{
RsStackMutex stack(noteMtx); /************* LOCK MUTEX ************/
pendingNewsFeed.push_back(RsFeedItem(type, id1, id2, id3));
return true;
}

View file

@ -70,10 +70,12 @@ virtual bool GetPopupMessageList(std::map<uint32_t, std::string> &list);
virtual bool SetSysMessageMode(uint32_t sysid, uint32_t mode);
virtual bool SetPopupMessageMode(uint32_t ptype, uint32_t mode);
virtual bool GetFeedItem(RsFeedItem &item);
/* Overloaded from pqiNotify */
virtual bool AddPopupMessage(uint32_t ptype, std::string name, std::string msg);
virtual bool AddSysMessage(uint32_t sysid, uint32_t type, std::string title, std::string msg);
virtual bool AddFeedItem(uint32_t type, std::string id1, std::string id2, std::string id3);
private:
@ -81,6 +83,7 @@ virtual bool AddSysMessage(uint32_t sysid, uint32_t type, std::string title, std
std::list<p3NotifySysMsg> pendingSysMsgs;
std::list<p3NotifyPopupMsg> pendingPopupMsgs;
std::list<RsFeedItem> pendingNewsFeed;
};

View file

@ -42,6 +42,7 @@ virtual ~pqiNotify() { return; }
/* Input from libretroshare */
virtual bool AddPopupMessage(uint32_t ptype, std::string name, std::string msg) = 0;
virtual bool AddSysMessage(uint32_t sysid, uint32_t type, std::string title, std::string msg) = 0;
virtual bool AddFeedItem(uint32_t type, std::string id1, std::string id2, std::string id3) = 0;
};