2018-05-28 16:03:39 -04:00
/*******************************************************************************
* libretroshare / src / pqi : p3notify . h *
* *
* libretroshare : retroshare core library *
* *
* Copyright 2007 - 2008 by Robert Fernie < retroshare @ lunamutt . com > *
* *
* This program is free software : you can redistribute it and / or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation , either version 3 of the *
* License , or ( at your option ) any later version . *
* *
* This program is distributed in the hope that it will be useful , *
* but WITHOUT ANY WARRANTY ; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the *
* GNU Lesser General Public License for more details . *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program . If not , see < https : //www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2008-03-05 11:32:18 -05:00
# ifndef RS_P3_NOTIFY_INTERFACE_H
# define RS_P3_NOTIFY_INTERFACE_H
2010-08-06 05:40:23 -04:00
# include "retroshare/rsnotify.h"
2014-01-07 17:51:22 -05:00
# include "retroshare/rsturtle.h"
2008-03-05 11:32:18 -05:00
# include "util/rsthreads.h"
class p3NotifySysMsg
{
public :
uint32_t sysid ;
uint32_t type ;
std : : string title ;
std : : string msg ;
} ;
2009-05-05 09:35:36 -04:00
class p3NotifyLogMsg
{
public :
uint32_t sysid ;
uint32_t type ;
std : : string title ;
std : : string msg ;
} ;
2008-03-05 11:32:18 -05:00
class p3NotifyPopupMsg
{
public :
uint32_t type ;
std : : string name ;
2010-06-13 06:12:56 -04:00
std : : string title ;
2008-03-05 11:32:18 -05:00
std : : string msg ;
} ;
2008-03-31 10:06:59 -04:00
2014-01-07 17:51:22 -05:00
class p3Notify : public RsNotify
2008-03-05 11:32:18 -05:00
{
public :
2017-07-19 13:39:21 -04:00
p3Notify ( ) : noteMtx ( " p3Notify " ) , _disableAskPassword ( false ) { return ; }
2014-01-07 17:51:22 -05:00
virtual ~ p3Notify ( ) { return ; }
virtual void registerNotifyClient ( NotifyClient * nc ) ;
2014-08-25 17:07:07 -04:00
virtual bool unregisterNotifyClient ( NotifyClient * nc ) ;
2014-01-07 17:51:22 -05:00
/* Pull output methods for retroshare-gui */
virtual bool NotifySysMessage ( uint32_t & sysid , uint32_t & type , std : : string & title , std : : string & msg ) ;
virtual bool NotifyPopupMessage ( uint32_t & ptype , std : : string & name , std : : string & title , std : : string & msg ) ;
virtual bool NotifyLogMessage ( uint32_t & sysid , uint32_t & type , std : : string & title , std : : string & msg ) ;
virtual bool GetFeedItem ( RsFeedItem & item ) ;
/* Control over Messages */
bool GetSysMessageList ( std : : map < uint32_t , std : : string > & list ) ;
bool GetPopupMessageList ( std : : map < uint32_t , std : : string > & list ) ;
bool SetSysMessageMode ( uint32_t sysid , uint32_t mode ) ;
bool SetPopupMessageMode ( uint32_t ptype , uint32_t mode ) ;
2014-11-11 15:28:45 -05:00
/* Notify messages */
bool AddPopupMessage ( uint32_t ptype , const std : : string & name , const std : : string & title , const std : : string & msg ) ;
bool AddSysMessage ( uint32_t sysid , uint32_t type , const std : : string & title , const std : : string & msg ) ;
bool AddLogMessage ( uint32_t sysid , uint32_t type , const std : : string & title , const std : : string & msg ) ;
2015-06-02 17:36:26 -04:00
bool AddFeedItem ( uint32_t type , const std : : string & id1 , const std : : string & id2 = " " , const std : : string & id3 = " " , const std : : string & id4 = " " , uint32_t result1 = 0 ) ;
2014-11-11 15:28:45 -05:00
bool ClearFeedItems ( uint32_t type ) ;
2014-01-07 17:51:22 -05:00
// Notifications of clients. Can be called from anywhere inside libretroshare.
//
void notifyListPreChange ( int /* list */ , int /* type */ ) ;
void notifyListChange ( int /* list */ , int /* type */ ) ;
void notifyErrorMsg ( int /* list */ , int /* sev */ , std : : string /* msg */ ) ;
2016-03-31 16:52:53 -04:00
void notifyChatMessage ( const ChatMessage & /* msg */ ) ;
void notifyChatStatus ( const ChatId & /* chat_id */ , const std : : string & /* status_string */ ) ;
void notifyChatCleared ( const ChatId & /* chat_id */ ) ;
void notifyChatLobbyEvent ( uint64_t /* lobby id */ , uint32_t /* event type */ , const RsGxsId & /* nickname */ , const std : : string & /* any string */ ) ;
2014-01-07 17:51:22 -05:00
void notifyChatLobbyTimeShift ( int /* time_shift*/ ) ;
void notifyCustomState ( const std : : string & /* peer_id */ , const std : : string & /* status_string */ ) ;
void notifyHashingInfo ( uint32_t /* type */ , const std : : string & /* fileinfo */ ) ;
void notifyTurtleSearchResult ( uint32_t /* search_id */ , const std : : list < TurtleFileInfo > & /* files */ ) ;
2018-06-06 17:15:29 -04:00
# warning MISSING CODE HERE
// void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list<TurtleGxsInfo >& /* groups */) ;
2014-01-07 17:51:22 -05:00
void notifyPeerHasNewAvatar ( std : : string /* peer_id */ ) ;
void notifyOwnAvatarChanged ( ) ;
void notifyOwnStatusMessageChanged ( ) ;
void notifyDiskFull ( uint32_t /* location */ , uint32_t /* size limit in MB */ ) ;
void notifyPeerStatusChanged ( const std : : string & /* peer_id */ , uint32_t /* status */ ) ;
2015-03-20 06:39:17 -04:00
void notifyGxsChange ( const RsGxsChanges & /* changes */ ) ;
2016-10-09 08:32:52 -04:00
void notifyConnectionWithoutCert ( ) ;
2014-01-07 17:51:22 -05:00
void notifyPeerStatusChangedSummary ( ) ;
void notifyDiscInfoChanged ( ) ;
2016-02-14 06:48:52 -05:00
2016-08-08 19:22:14 -04:00
bool askForDeferredSelfSignature ( const void * /* data */ , const uint32_t /* len */ , unsigned char * /* sign */ , unsigned int * /* signlen */ , int & signature_result , std : : string reason = " " ) ;
2014-01-07 17:51:22 -05:00
void notifyDownloadComplete ( const std : : string & /* fileHash */ ) ;
void notifyDownloadCompleteCount ( uint32_t /* count */ ) ;
void notifyHistoryChanged ( uint32_t /* msgId */ , int /* type */ ) ;
2016-08-08 19:22:14 -04:00
bool askForPassword ( const std : : string & title , const std : : string & /* key_details */ , bool /* prev_is_bad */ , std : : string & , bool * cancelled /* password */ ) ;
2017-07-29 17:12:56 -04:00
bool askForPluginConfirmation ( const std : : string & /* plugin_filename */ , const std : : string & /* plugin_file_hash */ , bool first_time ) ;
2008-03-05 11:32:18 -05:00
2017-07-19 13:39:21 -04:00
virtual bool cachePgpPassphrase ( const std : : string & /* pgp_passphrase */ ) ;
virtual bool clearPgpPassphrase ( ) ;
virtual bool setDisableAskPassword ( const bool /*bValue*/ ) ;
2017-02-12 09:27:13 -05:00
2008-03-05 11:32:18 -05:00
private :
2014-01-07 17:51:22 -05:00
RsMutex noteMtx ;
std : : list < p3NotifySysMsg > pendingSysMsgs ;
std : : list < p3NotifyLogMsg > pendingLogMsgs ;
std : : list < p3NotifyPopupMsg > pendingPopupMsgs ;
std : : list < RsFeedItem > pendingNewsFeed ;
2008-03-05 11:32:18 -05:00
2014-01-07 17:51:22 -05:00
std : : list < NotifyClient * > notifyClients ;
2017-02-12 09:27:13 -05:00
2017-07-19 13:39:21 -04:00
std : : string cached_pgp_passphrase ;
bool _disableAskPassword ;
2008-03-05 11:32:18 -05:00
} ;
# endif