Updated the notification system. Main changes are:

- the notification system is now a service, p3Notify, that is a public RsNotify.
- RsNotify does nothing except providing a registration system for new notify clients.
- Clients should derive a notify client from the NotifyClient class and register it to rsNotify
- all registered clients get all notifications, so only derive the needed methods. This should allow 
  plugins to get notifications as well.
- updated the code to call RsServer::notify()->[notification method] from inside libretroshare
- pqiNotify has been removed.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6996 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-01-07 22:51:22 +00:00
parent 3cc8c144a8
commit 630824aa1b
47 changed files with 482 additions and 484 deletions

View file

@ -297,8 +297,6 @@ bool p3Blogs::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, const
return true;
}
#include "pqi/pqinotify.h"
bool p3Blogs::locked_eventNewMsg(GroupInfo *grp, RsDistribMsg *msg, const std::string& id, bool historical)
{
std::string grpId = msg->grpId;

View file

@ -25,7 +25,7 @@
#include "services/p3channels.h"
#include "util/rsdir.h"
#include "retroshare/rsiface.h"
#include "rsserver/p3face.h"
std::ostream &operator<<(std::ostream &out, const ChannelInfo &info)
{
@ -342,8 +342,8 @@ bool p3Channels::setMessageStatus(const std::string& cId,const std::string& mId,
} /******* UNLOCKED ********/
if (changed) {
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_MOD);
rsicontrol->getNotify().notifyChannelMsgReadSatusChanged(cId, mId, newStatus);
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_MOD);
RsServer::notify()->notifyChannelMsgReadSatusChanged(cId, mId, newStatus);
}
return true;
@ -898,8 +898,6 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, con
return true;
}
#include "pqi/pqinotify.h"
bool p3Channels::locked_eventNewMsg(GroupInfo *grp, RsDistribMsg *msg, const std::string& id, bool historical)
{
std::string grpId = msg->grpId;
@ -908,7 +906,7 @@ bool p3Channels::locked_eventNewMsg(GroupInfo *grp, RsDistribMsg *msg, const std
if (!historical)
{
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_CHAN_MSG, grpId, msgId, nullId);
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_CHAN_MSG, grpId, msgId, nullId);
}
/* request the files
@ -935,9 +933,9 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags, bool
#endif
if (!historical)
{
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_CHAN_NEW, grpId, msgId, nullId);
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_CHAN_NEW, grpId, msgId, nullId);
}
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
break;
case GRP_UPDATE:
#ifdef CHANNEL_DEBUG
@ -945,9 +943,9 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags, bool
#endif
if (!historical)
{
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_CHAN_UPDATE, grpId, msgId, nullId);
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_CHAN_UPDATE, grpId, msgId, nullId);
}
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_MOD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_MOD);
break;
case GRP_LOAD_KEY:
#ifdef CHANNEL_DEBUG
@ -958,7 +956,7 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags, bool
#ifdef CHANNEL_DEBUG
std::cerr << "p3Channels::locked_notifyGroupChanged() NEW MSG" << std::endl;
#endif
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
break;
case GRP_SUBSCRIBED:
#ifdef CHANNEL_DEBUG
@ -978,13 +976,13 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags, bool
/* check if downloads need to be started? */
}
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
break;
case GRP_UNSUBSCRIBED:
#ifdef CHANNEL_DEBUG
std::cerr << "p3Channels::locked_notifyGroupChanged() UNSUBSCRIBED" << std::endl;
#endif
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_DEL);
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_DEL);
/* won't stop downloads... */

View file

@ -38,10 +38,10 @@
#include "retroshare/rspeers.h"
#include "retroshare/rsstatus.h"
#include "pqi/pqibin.h"
#include "pqi/pqinotify.h"
#include "pqi/pqistore.h"
#include "pqi/p3linkmgr.h"
#include "pqi/p3historymgr.h"
#include "rsserver/p3face.h"
#include "services/p3chatservice.h"
#include "serialiser/rsconfigitems.h"
@ -499,7 +499,7 @@ bool p3ChatService::sendPrivateChat(const std::string &id, const std::wstrin
privateOutgoingList.push_back(ci);
}
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_ADD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_ADD);
IndicateConfigChanged();
@ -912,7 +912,7 @@ void p3ChatService::handleRecvChatLobbyList(RsChatLobbyListItem_deprecated *item
}
}
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
_should_reset_lobby_counts = false ;
}
void p3ChatService::handleRecvChatLobbyList(RsChatLobbyListItem_deprecated2 *item)
@ -944,7 +944,7 @@ void p3ChatService::handleRecvChatLobbyList(RsChatLobbyListItem_deprecated2 *ite
}
}
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
_should_reset_lobby_counts = false ;
}
void p3ChatService::handleRecvChatLobbyList(RsChatLobbyListItem *item)
@ -990,7 +990,7 @@ void p3ChatService::handleRecvChatLobbyList(RsChatLobbyListItem *item)
for (it = chatLobbyToSubscribe.begin(); it != chatLobbyToSubscribe.end(); it++)
joinVisibleChatLobby(*it);
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
_should_reset_lobby_counts = false ;
}
@ -1037,7 +1037,7 @@ void p3ChatService::addTimeShiftStatistics(int D)
#endif
if(expected > 9) // if more than 20 samples
rsicontrol->getNotify().notifyChatLobbyTimeShift( (int)pow(2.0f,expected)) ;
RsServer::notify()->notifyChatLobbyTimeShift( (int)pow(2.0f,expected)) ;
total = 0.0f ;
log_delay_histogram.clear() ;
@ -1144,7 +1144,7 @@ void p3ChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *item)
#endif
}
}
rsicontrol->getNotify().notifyChatLobbyEvent(item->lobby_id,item->event_type,item->nick,item->string1) ;
RsServer::notify()->notifyChatLobbyEvent(item->lobby_id,item->event_type,item->nick,item->string1) ;
}
void p3ChatService::handleRecvChatAvatarItem(RsChatAvatarItem *ca)
@ -1154,7 +1154,7 @@ void p3ChatService::handleRecvChatAvatarItem(RsChatAvatarItem *ca)
#ifdef CHAT_DEBUG
std::cerr << "Received avatar data for peer " << ca->PeerId() << ". Notifying." << std::endl ;
#endif
rsicontrol->getNotify().notifyPeerHasNewAvatar(ca->PeerId()) ;
RsServer::notify()->notifyPeerHasNewAvatar(ca->PeerId()) ;
}
bool p3ChatService::checkForMessageSecurity(RsChatMsgItem *ci)
@ -1356,11 +1356,11 @@ bool p3ChatService::handleRecvChatMsgItem(RsChatMsgItem *ci)
librs::util::ConvertUtf16ToUtf8(ci->message, message);
if (ci->chatFlags & RS_CHAT_FLAG_PRIVATE) {
/* notify private chat message */
getPqiNotify()->AddPopupMessage(popupChatFlag, ci->PeerId(), name, message);
RsServer::notify()->AddPopupMessage(popupChatFlag, ci->PeerId(), name, message);
} else {
/* notify public chat message */
getPqiNotify()->AddPopupMessage(RS_POPUP_GROUPCHAT, ci->PeerId(), "", message);
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_CHAT_NEW, ci->PeerId(), message, "");
RsServer::notify()->AddPopupMessage(RS_POPUP_GROUPCHAT, ci->PeerId(), "", message);
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_CHAT_NEW, ci->PeerId(), message, "");
}
{
@ -1390,10 +1390,10 @@ bool p3ChatService::handleRecvChatMsgItem(RsChatMsgItem *ci)
}
if (publicChanged) {
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_PUBLIC_CHAT, NOTIFY_TYPE_ADD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_PUBLIC_CHAT, NOTIFY_TYPE_ADD);
}
if (privateChanged) {
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_PRIVATE_INCOMING_CHAT, NOTIFY_TYPE_ADD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_PRIVATE_INCOMING_CHAT, NOTIFY_TYPE_ADD);
IndicateConfigChanged(); // only private chat messages are saved
}
@ -1411,7 +1411,7 @@ void p3ChatService::handleRecvChatStatusItem(RsChatStatusItem *cs)
else if(cs->flags & RS_CHAT_FLAG_CUSTOM_STATE) // Check if new custom string is available at peer's.
{ // If so, send a request to get the custom string.
receiveStateString(cs->PeerId(),cs->status_string) ; // store it
rsicontrol->getNotify().notifyCustomState(cs->PeerId(), cs->status_string) ;
RsServer::notify()->notifyCustomState(cs->PeerId(), cs->status_string) ;
}
else if(cs->flags & RS_CHAT_FLAG_CUSTOM_STATE_AVAILABLE)
{
@ -1422,13 +1422,13 @@ void p3ChatService::handleRecvChatStatusItem(RsChatStatusItem *cs)
}
else if(cs->flags & RS_CHAT_FLAG_PRIVATE)
{
rsicontrol->getNotify().notifyChatStatus(cs->PeerId(),cs->status_string,true) ;
RsServer::notify()->notifyChatStatus(cs->PeerId(),cs->status_string,true) ;
if(cs->flags & RS_CHAT_FLAG_CLOSING_DISTANT_CONNECTION)
markDistantChatAsClosed(cs->PeerId()) ;
}
else if(cs->flags & RS_CHAT_FLAG_PUBLIC)
rsicontrol->getNotify().notifyChatStatus(cs->PeerId(),cs->status_string,false) ;
RsServer::notify()->notifyChatStatus(cs->PeerId(),cs->status_string,false) ;
}
void p3ChatService::getListOfNearbyChatLobbies(std::vector<VisibleChatLobbyRecord>& visible_lobbies)
@ -1499,7 +1499,7 @@ bool p3ChatService::getPublicChatQueue(std::list<ChatInfo> &chats)
} /* UNLOCKED */
if (changed) {
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_PUBLIC_CHAT, NOTIFY_TYPE_DEL);
RsServer::notify()->notifyListChange(NOTIFY_LIST_PUBLIC_CHAT, NOTIFY_TYPE_DEL);
}
return true;
@ -1620,7 +1620,7 @@ bool p3ChatService::clearPrivateChatQueue(bool incoming, const std::string &id)
} /* UNLOCKED */
if (changed) {
rsicontrol->getNotify().notifyListChange(incoming ? NOTIFY_LIST_PRIVATE_INCOMING_CHAT : NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_DEL);
RsServer::notify()->notifyListChange(incoming ? NOTIFY_LIST_PRIVATE_INCOMING_CHAT : NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_DEL);
IndicateConfigChanged();
}
@ -1664,7 +1664,7 @@ void p3ChatService::setOwnCustomStateString(const std::string& s)
mLinkMgr->getOnlineList(onlineList);
}
rsicontrol->getNotify().notifyOwnStatusMessageChanged() ;
RsServer::notify()->notifyOwnStatusMessageChanged() ;
// alert your online peers to your newly set status
std::list<std::string>::iterator it(onlineList.begin());
@ -1704,7 +1704,7 @@ void p3ChatService::setOwnAvatarJpegData(const unsigned char *data,int size)
}
IndicateConfigChanged();
rsicontrol->getNotify().notifyOwnAvatarChanged() ;
RsServer::notify()->notifyOwnAvatarChanged() ;
#ifdef CHAT_DEBUG
std::cerr << "p3chatservice:setOwnAvatarJpegData() done." << std::endl ;
@ -2175,7 +2175,7 @@ void p3ChatService::statusChange(const std::list<pqipeer> &plist)
checkSizeAndSendMessage_deprecated(to_send[i]); // delete item
if (changed) {
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_DEL);
RsServer::notify()->notifyListChange(NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_DEL);
IndicateConfigChanged();
}
@ -2616,7 +2616,7 @@ void p3ChatService::handleRecvLobbyInvite(RsChatLobbyInviteItem *item)
_lobby_invites_queue[item->lobby_id] = invite ;
}
// 2 - notify the gui to ask the user.
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_INVITATION, NOTIFY_TYPE_ADD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_INVITATION, NOTIFY_TYPE_ADD);
}
void p3ChatService::getPendingChatLobbyInvites(std::list<ChatLobbyInvite>& invites)
@ -2694,8 +2694,8 @@ bool p3ChatService::acceptLobbyInvite(const ChatLobbyId& lobby_id)
std::cerr << " Notifying of new recvd msg." << std::endl ;
#endif
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_PRIVATE_INCOMING_CHAT, NOTIFY_TYPE_ADD);
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_PRIVATE_INCOMING_CHAT, NOTIFY_TYPE_ADD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD);
// send AKN item
sendLobbyStatusNewPeer(lobby_id) ;
@ -2793,7 +2793,7 @@ bool p3ChatService::joinVisibleChatLobby(const ChatLobbyId& lobby_id)
for(std::list<std::string>::const_iterator it(invited_friends.begin());it!=invited_friends.end();++it)
invitePeerToLobby(lobby_id,*it) ;
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
sendLobbyStatusNewPeer(lobby_id) ;
return true ;
@ -2837,7 +2837,7 @@ ChatLobbyId p3ChatService::createChatLobby(const std::string& lobby_name,const s
for(std::list<std::string>::const_iterator it(invited_friends.begin());it!=invited_friends.end();++it)
invitePeerToLobby(lobby_id,*it) ;
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
return lobby_id ;
}
@ -2870,7 +2870,7 @@ void p3ChatService::handleFriendUnsubscribeLobby(RsChatLobbyUnsubscribeItem *ite
}
}
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_MOD) ;
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_MOD) ;
}
void p3ChatService::unsubscribeChatLobby(const ChatLobbyId& id)
@ -2921,7 +2921,7 @@ void p3ChatService::unsubscribeChatLobby(const ChatLobbyId& id)
}
}
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_DEL) ;
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_DEL) ;
// done!
}
@ -3027,7 +3027,7 @@ void p3ChatService::setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const boo
else
_known_lobbies_flags[lobby_id] &= ~RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE ;
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
IndicateConfigChanged();
}
@ -3137,7 +3137,7 @@ void p3ChatService::cleanLobbyCaches()
// update the gui
for(std::list<ChatLobbyId>::const_iterator it(changed_lobbies.begin());it!=changed_lobbies.end();++it)
rsicontrol->getNotify().notifyChatLobbyEvent(*it,RS_CHAT_LOBBY_EVENT_KEEP_ALIVE,"------------","") ;
RsServer::notify()->notifyChatLobbyEvent(*it,RS_CHAT_LOBBY_EVENT_KEEP_ALIVE,"------------","") ;
// send connection challenges
//
@ -3245,7 +3245,7 @@ void p3ChatService::addVirtualPeer(const TurtleFileHash& hash,const TurtleVirtua
// Notify the GUI that the tunnel is up.
//
rsicontrol->getNotify().notifyChatStatus(hash,"tunnel is up again!",true) ;
RsServer::notify()->notifyChatStatus(hash,"tunnel is up again!",true) ;
}
void p3ChatService::removeVirtualPeer(const TurtleFileHash& hash,const TurtleVirtualPeerId& virtual_peer_id)
@ -3263,8 +3263,8 @@ void p3ChatService::removeVirtualPeer(const TurtleFileHash& hash,const TurtleVir
it->second.status = RS_DISTANT_CHAT_STATUS_TUNNEL_DN ;
}
rsicontrol->getNotify().notifyChatStatus(hash,"tunnel is down...",true) ;
rsicontrol->getNotify().notifyPeerStatusChanged(hash,RS_STATUS_OFFLINE) ;
RsServer::notify()->notifyChatStatus(hash,"tunnel is down...",true) ;
RsServer::notify()->notifyPeerStatusChanged(hash,RS_STATUS_OFFLINE) ;
}
#ifdef DEBUG_DISTANT_CHAT
@ -3366,7 +3366,7 @@ void p3ChatService::receiveTurtleData( RsTurtleGenericTunnelItem *gitem,const st
// Setup the virtual peer to be the origin, and pass it on.
//
citem->PeerId(hash) ;
//rsicontrol->getNotify().notifyPeerStatusChanged(hash,RS_STATUS_ONLINE) ;
//RsServer::notify()->notifyPeerStatusChanged(hash,RS_STATUS_ONLINE) ;
handleIncomingItem(citem) ; // Treats the item, and deletes it
}
@ -3625,7 +3625,7 @@ bool p3ChatService::initiateDistantChatConnexion(const std::string& encrypted_st
error_code = signature_checked ? RS_DISTANT_CHAT_ERROR_NO_ERROR : RS_DISTANT_CHAT_ERROR_UNKNOWN_KEY;
getPqiNotify()->AddPopupMessage(RS_POPUP_CHAT, hash, "Distant peer", "Conversation starts...");
RsServer::notify()->AddPopupMessage(RS_POPUP_CHAT, hash, "Distant peer", "Conversation starts...");
// Save config, since a new invite was added.
//
@ -3656,7 +3656,7 @@ bool p3ChatService::initiateDistantChatConnexion(const std::string& hash,uint32_
startClientDistantChatConnection(hash,pgp_id,aes_key) ;
getPqiNotify()->AddPopupMessage(RS_POPUP_CHAT, hash, "Distant peer", "Conversation starts...");
RsServer::notify()->AddPopupMessage(RS_POPUP_CHAT, hash, "Distant peer", "Conversation starts...");
error_code = RS_DISTANT_CHAT_ERROR_NO_ERROR ;
return true ;

View file

@ -24,7 +24,7 @@
*/
#include "retroshare/rsiface.h"
#include "rsserver/p3face.h"
#include "retroshare/rspeers.h"
#include "services/p3disc.h"
@ -796,10 +796,10 @@ void p3disc::recvPeerDetails(RsDiscReply *item, const std::string &certGpgId)
}
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
if(should_notify_discovery)
rsicontrol->getNotify().notifyDiscInfoChanged();
RsServer::notify()->notifyDiscInfoChanged();
/* cleanup (handled by caller) */
}

View file

@ -26,7 +26,7 @@
#include "services/p3forums.h"
#include "pqi/authssl.h"
#include "util/rsdir.h"
#include "retroshare/rsiface.h"
#include "rsserver/p3face.h"
uint32_t convertToInternalFlags(uint32_t extFlags);
uint32_t convertToExternalFlags(uint32_t intFlags);
@ -401,8 +401,8 @@ bool p3Forums::setMessageStatus(const std::string& fId,const std::string& mId,co
} /******* UNLOCKED ********/
if (changed) {
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_MOD);
rsicontrol->getNotify().notifyForumMsgReadSatusChanged(fId, mId, newStatus);
RsServer::notify()->notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_MOD);
RsServer::notify()->notifyForumMsgReadSatusChanged(fId, mId, newStatus);
}
return true;
@ -613,8 +613,6 @@ bool p3Forums::getMessageCount(const std::string &fId, unsigned int &newCount, u
/****************** Event Feedback (Overloaded form p3distrib) *************************/
/***************************************************************************************/
#include "pqi/pqinotify.h"
void p3Forums::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags, bool historical)
{
const std::string &grpId = grp.grpId;
@ -626,27 +624,27 @@ void p3Forums::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags, bool h
case GRP_NEW_UPDATE:
if (!historical)
{
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_FORUM_NEW, grpId, msgId, nullId);
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_FORUM_NEW, grpId, msgId, nullId);
}
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
break;
case GRP_UPDATE:
if (!historical)
{
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_FORUM_UPDATE, grpId, msgId, nullId);
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_FORUM_UPDATE, grpId, msgId, nullId);
}
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_MOD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_MOD);
break;
case GRP_LOAD_KEY:
break;
case GRP_NEW_MSG:
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
break;
case GRP_SUBSCRIBED:
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
break;
case GRP_UNSUBSCRIBED:
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_DEL);
RsServer::notify()->notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_DEL);
break;
}
return p3GroupDistrib::locked_notifyGroupChanged(grp, flags, historical);
@ -675,7 +673,7 @@ bool p3Forums::locked_eventNewMsg(GroupInfo */*grp*/, RsDistribMsg *msg, const s
if (!historical)
{
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_FORUM_MSG, grpId, msgId, nullId);
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_FORUM_MSG, grpId, msgId, nullId);
}
return true;

View file

@ -35,7 +35,7 @@
#include "services/p3msgservice.h"
#include "pgp/pgpkeyutil.h"
#include "pqi/p3cfgmgr.h"
#include "pqi/pqinotify.h"
#include "rsserver/p3face.h"
#include "serialiser/rsconfigitems.h"
#include "util/rsdebug.h"
@ -140,7 +140,7 @@ void p3MsgService::processMsg(RsMsgItem *mi, bool incoming)
mi->msgFlags &= (RS_MSG_FLAGS_ENCRYPTED | RS_MSG_FLAGS_SYSTEM); // remove flags except those
mi->msgFlags |= RS_MSG_FLAGS_NEW;
pqiNotify *notify = getPqiNotify();
p3Notify *notify = RsServer::notify();
if (notify)
{
std::string title, message;
@ -170,7 +170,7 @@ void p3MsgService::processMsg(RsMsgItem *mi, bool incoming)
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
}
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_ADD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_ADD);
/**** STACK UNLOCKED ***/
}
@ -241,7 +241,7 @@ void p3MsgService::handleIncomingItem(RsMsgItem *mi)
changed = true ;
}
if(changed)
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
}
void p3MsgService::statusChange(const std::list<pqipeer> &/*plist*/)
@ -409,7 +409,7 @@ int p3MsgService::checkOutgoingMessages()
}
if(changed)
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
return 0;
}
@ -847,7 +847,7 @@ bool p3MsgService::removeMsgId(const std::string &mid)
setMessageTag(mid, 0, false);
setMsgParentId(msgId, 0);
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
}
return changed;
@ -890,7 +890,7 @@ bool p3MsgService::markMsgIdRead(const std::string &mid, bool unreadByUser)
} /* UNLOCKED */
if (changed) {
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
}
return true;
@ -928,7 +928,7 @@ bool p3MsgService::setMsgFlag(const std::string &mid, uint32_t flag, uint32_t
} /* UNLOCKED */
if (changed) {
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
}
return true;
@ -1021,7 +1021,7 @@ int p3MsgService::sendMessage(RsMsgItem *item)
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST, NOTIFY_TYPE_ADD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST, NOTIFY_TYPE_ADD);
checkOutgoingMessages();
@ -1166,7 +1166,7 @@ bool p3MsgService::MessageToDraft(MessageInfo &info, const std::string &msgParen
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
return true;
}
@ -1236,7 +1236,7 @@ bool p3MsgService::setMessageTagType(uint32_t tagId, std::string& text, uint32
if (nNotifyType) {
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGE_TAGS, nNotifyType);
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGE_TAGS, nNotifyType);
return true;
}
@ -1292,7 +1292,7 @@ bool p3MsgService::removeMessageTagType(uint32_t tagId)
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGE_TAGS, NOTIFY_TYPE_DEL);
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGE_TAGS, NOTIFY_TYPE_DEL);
return true;
}
@ -1400,7 +1400,7 @@ bool p3MsgService::setMessageTag(const std::string &msgId, uint32_t tagId, bool
if (nNotifyType) {
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGE_TAGS, nNotifyType);
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGE_TAGS, nNotifyType);
return true;
}
@ -1467,7 +1467,7 @@ bool p3MsgService::MessageToTrash(const std::string &mid, bool bTrash)
checkOutgoingMessages();
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
}
return bFound;
@ -2058,7 +2058,7 @@ bool p3MsgService::decryptMessage(const std::string& mId)
delete item ;
IndicateConfigChanged() ;
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
return true ;
}

View file

@ -25,6 +25,7 @@
#include "services/p3statusservice.h"
#include "serialiser/rsstatusitems.h"
#include "rsserver/p3face.h"
#include "retroshare/rsiface.h"
#include <iostream>
@ -183,7 +184,7 @@ bool p3StatusService::sendStatus(const std::string &id, uint32_t status)
}
/* send notify of own status change */
rsicontrol->getNotify().notifyPeerStatusChanged(statusInfo.id, statusInfo.status);
RsServer::notify()->notifyPeerStatusChanged(statusInfo.id, statusInfo.status);
return true;
}
@ -242,9 +243,9 @@ void p3StatusService::receiveStatusQueue()
if (changed.size()) {
std::map<std::string, uint32_t>::iterator it;
for (it = changed.begin(); it != changed.end(); it++) {
rsicontrol->getNotify().notifyPeerStatusChanged(it->first, it->second);
RsServer::notify()->notifyPeerStatusChanged(it->first, it->second);
}
rsicontrol->getNotify().notifyPeerStatusChangedSummary();
RsServer::notify()->notifyPeerStatusChangedSummary();
}
}
@ -361,7 +362,7 @@ void p3StatusService::statusChange(const std::list<pqipeer> &plist)
} /* UNLOCKED */
changedState = true;
rsicontrol->getNotify().notifyPeerStatusChanged(it->id, RS_STATUS_OFFLINE);
RsServer::notify()->notifyPeerStatusChanged(it->id, RS_STATUS_OFFLINE);
}
if (it->actions & RS_PEER_CONNECTED) {
@ -383,7 +384,7 @@ void p3StatusService::statusChange(const std::list<pqipeer> &plist)
} /* UNLOCKED */
changedState = true;
rsicontrol->getNotify().notifyPeerStatusChanged(it->id, RS_STATUS_ONLINE);
RsServer::notify()->notifyPeerStatusChanged(it->id, RS_STATUS_ONLINE);
}
} else if (it->actions & RS_PEER_MOVED) {
/* now handle remove */
@ -394,12 +395,12 @@ void p3StatusService::statusChange(const std::list<pqipeer> &plist)
} /* UNLOCKED */
changedState = true;
rsicontrol->getNotify().notifyPeerStatusChanged(it->id, RS_STATUS_OFFLINE);
RsServer::notify()->notifyPeerStatusChanged(it->id, RS_STATUS_OFFLINE);
}
}
if (changedState)
{
rsicontrol->getNotify().notifyPeerStatusChangedSummary();
RsServer::notify()->notifyPeerStatusChangedSummary();
}
}