mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-21 21:55:15 -05:00
Merge branch 'badPacketMessage'
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1168 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
16231dea2b
commit
698425ba9e
@ -55,6 +55,27 @@ bool p3Notify::NotifySysMessage(uint32_t &sysid, uint32_t &type,
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Output for retroshare-gui */
|
||||
bool p3Notify::NotifyLogMessage(uint32_t &sysid, uint32_t &type,
|
||||
std::string &title, std::string &msg)
|
||||
{
|
||||
RsStackMutex stack(noteMtx); /************* LOCK MUTEX ************/
|
||||
if (pendingLogMsgs.size() > 0)
|
||||
{
|
||||
p3NotifyLogMsg smsg = pendingLogMsgs.front();
|
||||
pendingLogMsgs.pop_front();
|
||||
|
||||
sysid = smsg.sysid;
|
||||
type = smsg.type;
|
||||
title = smsg.title;
|
||||
msg = smsg.msg;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool p3Notify::NotifyPopupMessage(uint32_t &ptype, std::string &name, std::string &msg)
|
||||
{
|
||||
@ -132,6 +153,23 @@ bool p3Notify::AddSysMessage(uint32_t sysid, uint32_t type,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3Notify::AddLogMessage(uint32_t sysid, uint32_t type,
|
||||
std::string title, std::string msg)
|
||||
{
|
||||
RsStackMutex stack(noteMtx); /************* LOCK MUTEX ************/
|
||||
|
||||
p3NotifyLogMsg smsg;
|
||||
|
||||
smsg.sysid = sysid;
|
||||
smsg.type = type;
|
||||
smsg.title = title;
|
||||
smsg.msg = msg;
|
||||
|
||||
pendingLogMsgs.push_back(smsg);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool p3Notify::GetFeedItem(RsFeedItem &item)
|
||||
{
|
||||
|
@ -41,6 +41,16 @@ class p3NotifySysMsg
|
||||
std::string msg;
|
||||
};
|
||||
|
||||
class p3NotifyLogMsg
|
||||
{
|
||||
public:
|
||||
|
||||
uint32_t sysid;
|
||||
uint32_t type;
|
||||
std::string title;
|
||||
std::string msg;
|
||||
};
|
||||
|
||||
class p3NotifyPopupMsg
|
||||
{
|
||||
public:
|
||||
@ -62,6 +72,7 @@ virtual ~p3Notify() { return; }
|
||||
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 &msg);
|
||||
virtual bool NotifyLogMessage(uint32_t &sysid, uint32_t &type, std::string &title, std::string &msg);
|
||||
|
||||
/* Control over Messages */
|
||||
virtual bool GetSysMessageList(std::map<uint32_t, std::string> &list);
|
||||
@ -75,6 +86,7 @@ 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 AddLogMessage(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:
|
||||
@ -82,6 +94,7 @@ virtual bool AddFeedItem(uint32_t type, std::string id1, std::string id2, std::s
|
||||
RsMutex noteMtx;
|
||||
|
||||
std::list<p3NotifySysMsg> pendingSysMsgs;
|
||||
std::list<p3NotifyLogMsg> pendingLogMsgs;
|
||||
std::list<p3NotifyPopupMsg> pendingPopupMsgs;
|
||||
std::list<RsFeedItem> pendingNewsFeed;
|
||||
};
|
||||
|
@ -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 AddLogMessage(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;
|
||||
|
||||
};
|
||||
|
@ -628,7 +628,7 @@ continue_packet:
|
||||
msgout << "\n";
|
||||
|
||||
std::string msg = msgout.str();
|
||||
notify->AddSysMessage(0, RS_SYS_WARNING, title, msg);
|
||||
notify->AddLogMessage(0, RS_SYS_WARNING, title, msg);
|
||||
}
|
||||
bio->close();
|
||||
reading_state = reading_state_initial ; // restart at state 1.
|
||||
|
@ -106,6 +106,8 @@ virtual ~RsNotify() { return; }
|
||||
virtual bool NotifySysMessage(uint32_t &sysid, uint32_t &type,
|
||||
std::string &title, std::string &msg) = 0;
|
||||
virtual bool NotifyPopupMessage(uint32_t &ptype, std::string &name, std::string &msg) = 0;
|
||||
virtual bool NotifyLogMessage(uint32_t &sysid, uint32_t &type,
|
||||
std::string &title, std::string &msg) = 0;
|
||||
|
||||
/* Control over Messages */
|
||||
virtual bool GetSysMessageList(std::map<uint32_t, std::string> &list) = 0;
|
||||
|
@ -267,6 +267,24 @@ void NotifyQt::UpdateGUI()
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (rsNotify->NotifyLogMessage(sysid, type, title, msg))
|
||||
{
|
||||
/* make a log message */
|
||||
std::string logMesString = title + " " + msg;
|
||||
switch(type)
|
||||
{
|
||||
case RS_SYS_ERROR:
|
||||
cDialog->setLogInfo(QString(logMesString.c_str()));
|
||||
break;
|
||||
case RS_SYS_WARNING:
|
||||
cDialog->setLogInfo(QString(logMesString.c_str()));
|
||||
break;
|
||||
default:
|
||||
case RS_SYS_INFO:
|
||||
cDialog->setLogInfo(QString(logMesString.c_str()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,6 +106,8 @@ virtual ~RsNotify() { return; }
|
||||
virtual bool NotifySysMessage(uint32_t &sysid, uint32_t &type,
|
||||
std::string &title, std::string &msg) = 0;
|
||||
virtual bool NotifyPopupMessage(uint32_t &ptype, std::string &name, std::string &msg) = 0;
|
||||
virtual bool NotifyLogMessage(uint32_t &sysid, uint32_t &type,
|
||||
std::string &title, std::string &msg) = 0;
|
||||
|
||||
/* Control over Messages */
|
||||
virtual bool GetSysMessageList(std::map<uint32_t, std::string> &list) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user