mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-03 06:35:08 -04:00
Improved the notification model so that it uses Qt signals to avoid core dumps, and improved the gui to increase responsiveness (e.g. forum display, network discovery info, friends, msg deletion and selection)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1050 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
93fa052b58
commit
59cdaba9dc
25 changed files with 298 additions and 292 deletions
|
@ -322,20 +322,32 @@ int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, uint32_t f
|
|||
/* cannot be null -> no files at root level */
|
||||
parent=file->parent;
|
||||
}
|
||||
// Well, yes, it can be null, beleive me. In such a case it may be that
|
||||
// file is a person entry.
|
||||
|
||||
/* NEW add path (to dir - if dir, or parent dir - if file? */
|
||||
details.path = parent->path;
|
||||
|
||||
while(parent->parent)
|
||||
parent = parent->parent;
|
||||
|
||||
/* we should end up on the PersonEntry */
|
||||
if (NULL == (person = dynamic_cast<PersonEntry *>(parent)))
|
||||
if(parent==NULL)
|
||||
{
|
||||
std::cerr << "Major Error- Not PersonEntry!";
|
||||
exit(1);
|
||||
if(NULL == (person = dynamic_cast<PersonEntry *>(file)))
|
||||
{
|
||||
std::cerr << "Major Error- Not PersonEntry!";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* NEW add path (to dir - if dir, or parent dir - if file? */
|
||||
details.path = parent->path;
|
||||
|
||||
while(parent->parent)
|
||||
parent = parent->parent;
|
||||
|
||||
/* we should end up on the PersonEntry */
|
||||
if (NULL == (person = dynamic_cast<PersonEntry *>(parent)))
|
||||
{
|
||||
std::cerr << "Major Error- Not PersonEntry!";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
details.id = person->id;
|
||||
}
|
||||
|
||||
|
|
|
@ -155,6 +155,7 @@ std::string GPGAuthMgr::OwnId()
|
|||
|
||||
bool GPGAuthMgr::getAllList(std::list<std::string> &ids)
|
||||
{
|
||||
std::cout << "344444555533333333" << std::endl ;
|
||||
std::map<std::string, pqiAuthDetails>::iterator it;
|
||||
for(it = mKeyList.begin(); it != mKeyList.end(); it++)
|
||||
{
|
||||
|
|
|
@ -202,13 +202,14 @@ class NotifyBase
|
|||
virtual void notifyHashingInfo(std::string fileinfo) { (void)fileinfo; return ; }
|
||||
};
|
||||
|
||||
const int NOTIFY_LIST_NEIGHBOURS = 1;
|
||||
const int NOTIFY_LIST_FRIENDS = 2;
|
||||
const int NOTIFY_LIST_DIRLIST = 3;
|
||||
const int NOTIFY_LIST_SEARCHLIST = 4;
|
||||
const int NOTIFY_LIST_MESSAGELIST = 5;
|
||||
const int NOTIFY_LIST_CHANNELLIST = 6;
|
||||
const int NOTIFY_LIST_NEIGHBOURS = 1;
|
||||
const int NOTIFY_LIST_FRIENDS = 2;
|
||||
const int NOTIFY_LIST_DIRLIST = 3;
|
||||
const int NOTIFY_LIST_SEARCHLIST = 4;
|
||||
const int NOTIFY_LIST_MESSAGELIST = 5;
|
||||
const int NOTIFY_LIST_CHANNELLIST = 6;
|
||||
const int NOTIFY_LIST_TRANSFERLIST = 7;
|
||||
const int NOTIFY_LIST_CONFIG = 8;
|
||||
|
||||
const int NOTIFY_TYPE_SAME = 0x01;
|
||||
const int NOTIFY_TYPE_MOD = 0x02; /* general purpose, check all */
|
||||
|
|
|
@ -141,7 +141,8 @@ int RsServer::UpdateAllConfig()
|
|||
config.DHTActive = mConnMgr->getDHTEnabled();
|
||||
|
||||
/* Notify of Changes */
|
||||
iface.setChanged(RsIface::Config);
|
||||
// iface.setChanged(RsIface::Config);
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CONFIG, NOTIFY_TYPE_MOD);
|
||||
|
||||
/* unlock Mutexes */
|
||||
iface.unlockData(); /* UNLOCK */
|
||||
|
|
|
@ -480,9 +480,9 @@ void RsServer::intNotifyChangeCert(RsCertId &id)
|
|||
/* send the notify message */
|
||||
if (mods)
|
||||
{
|
||||
NotifyBase &cb = getNotify();
|
||||
cb.notifyListChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
|
||||
cb.notifyListChange(NOTIFY_LIST_FRIENDS, NOTIFY_TYPE_MOD);
|
||||
std::cerr << "************** Notifying neighbor change *******************" << std::endl ;
|
||||
getNotify().notifyListChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
|
||||
getNotify().notifyListChange(NOTIFY_LIST_FRIENDS, NOTIFY_TYPE_MOD);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -668,6 +668,7 @@ int RsServer::UpdateAllNetwork()
|
|||
{
|
||||
/* PreNotify of the Change */
|
||||
NotifyBase &cb = getNotify();
|
||||
std::cerr << "************** Notifying neighbor change 2 *******************" << std::endl ;
|
||||
cb.notifyListPreChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
|
||||
|
||||
lockRsCore(); /* LOCK */
|
||||
|
@ -709,6 +710,7 @@ int RsServer::UpdateAllNetwork()
|
|||
unlockRsCore(); /* UNLOCK */
|
||||
|
||||
/* Now Notify of the Change */
|
||||
std::cerr << "************** Notifying neighbor change 3 *******************" << std::endl ;
|
||||
cb.notifyListChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -352,24 +352,21 @@ bool RsDiscSerialiser::serialiseReply(RsDiscReply *item, void *data, uint32_
|
|||
offset += 8;
|
||||
|
||||
/* add mandatory parts first */
|
||||
ok &= SetTlvIpAddrPortV4(data, tlvsize, &offset,
|
||||
TLV_TYPE_IPV4_LOCAL, &(item->laddr));
|
||||
ok &= SetTlvIpAddrPortV4(data, tlvsize, &offset,
|
||||
TLV_TYPE_IPV4_REMOTE, &(item->saddr));
|
||||
ok &= SetTlvIpAddrPortV4(data, tlvsize, &offset, TLV_TYPE_IPV4_LOCAL, &(item->laddr));
|
||||
ok &= SetTlvIpAddrPortV4(data, tlvsize, &offset, TLV_TYPE_IPV4_REMOTE, &(item->saddr));
|
||||
ok &= setRawUInt16(data, tlvsize, &offset, item->contact_tf);
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, item->discFlags);
|
||||
|
||||
ok &= SetTlvString(data, tlvsize, &offset,
|
||||
TLV_TYPE_STR_PEERID, item->aboutId);
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_PEERID, item->aboutId);
|
||||
|
||||
ok &= item->certDER.SetTlv(data, tlvsize, &offset);
|
||||
|
||||
if (offset != tlvsize)
|
||||
{
|
||||
ok = false;
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
//#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsDiscSerialiser::serialiseReply() Size Error! " << std::endl;
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
return ok;
|
||||
|
|
|
@ -93,10 +93,10 @@ bool RsChatSerialiser::serialiseItem(RsChatItem *item, void *data, uint32_t
|
|||
|
||||
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
|
||||
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
//#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsChatSerialiser::serialiseItem() Header: " << ok << std::endl;
|
||||
std::cerr << "RsChatSerialiser::serialiseItem() Size: " << tlvsize << std::endl;
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
|
@ -109,10 +109,11 @@ bool RsChatSerialiser::serialiseItem(RsChatItem *item, void *data, uint32_t
|
|||
if (offset != tlvsize)
|
||||
{
|
||||
ok = false;
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
//#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsChatSerialiser::serialiseItem() Size Error! " << std::endl;
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
std::cerr << "computed size: " << 256*((unsigned char*)data)[6]+((unsigned char*)data)[7] << std::endl ;
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
|
|
@ -371,7 +371,7 @@ bool setRsItemHeader(void *data, uint32_t size, uint32_t type, uint32_t pktsiz
|
|||
|
||||
uint32_t getRsItemId(void *data)
|
||||
{
|
||||
uint32_t type;
|
||||
uint32_t type = 0;
|
||||
uint32_t offset = 0;
|
||||
getRawUInt32(data, 4, &offset, &type);
|
||||
return type;
|
||||
|
@ -380,7 +380,7 @@ uint32_t getRsItemId(void *data)
|
|||
|
||||
uint32_t getRsItemSize(void *data)
|
||||
{
|
||||
uint32_t size;
|
||||
uint32_t size = 0;
|
||||
uint32_t offset = 4;
|
||||
getRawUInt32(data, 8, &offset, &size);
|
||||
return size;
|
||||
|
|
|
@ -75,13 +75,14 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
/* cleanup */
|
||||
CRYPTO_cleanup_all_ex_data();
|
||||
ERR_free_strings();
|
||||
ERR_remove_state(0);
|
||||
EVP_cleanup();
|
||||
//CRYPTO_mem_leaks(bio_err);
|
||||
if (bio_err != NULL) BIO_free(bio_err);
|
||||
CRYPTO_cleanup_all_ex_data();
|
||||
ERR_free_strings();
|
||||
ERR_remove_state(0);
|
||||
EVP_cleanup();
|
||||
//CRYPTO_mem_leaks(bio_err);
|
||||
if (bio_err != NULL) BIO_free(bio_err);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -146,5 +147,6 @@ int testForums(p3Forums *forum)
|
|||
#else
|
||||
sleep(1);
|
||||
#endif
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
|
|
|
@ -109,19 +109,25 @@ int p3ChatService::sendChat(std::wstring msg)
|
|||
class p3ChatService::AvatarInfo
|
||||
{
|
||||
public:
|
||||
AvatarInfo()
|
||||
{
|
||||
_peer_is_new = false ; // true when the peer has a new avatar
|
||||
_own_is_new = false ; // true when I myself a new avatar to send to this peer.
|
||||
}
|
||||
|
||||
AvatarInfo(const unsigned char *jpeg_data,int size)
|
||||
{
|
||||
int n_c = size ;
|
||||
int p = sizeof(wchar_t) ;
|
||||
int p = 2 ;// minimum value for sizeof(wchar_t) over win/mac/linux ;
|
||||
int n = n_c/p + 1 ;
|
||||
|
||||
_jpeg_wstring = std::wstring(n,0) ;
|
||||
|
||||
for(int i=0;i<n;++i)
|
||||
{
|
||||
wchar_t h = jpeg_data[p*i] ;
|
||||
wchar_t h = jpeg_data[p*i+p-1] ;
|
||||
|
||||
for(int j=1;j<p;++j)
|
||||
for(int j=p-2;j>=0;--j)
|
||||
{
|
||||
h = h << 8 ;
|
||||
h += jpeg_data[p*i+j] ;
|
||||
|
@ -135,7 +141,7 @@ class p3ChatService::AvatarInfo
|
|||
|
||||
void toUnsignedChar(unsigned char *& data,int& size) const
|
||||
{
|
||||
int p = sizeof(wchar_t) ;
|
||||
int p = 2 ;// minimum value for sizeof(wchar_t) over win/mac/linux ;
|
||||
int n = _jpeg_wstring.size() ;
|
||||
int n_c = p*n ;
|
||||
|
||||
|
@ -146,7 +152,7 @@ class p3ChatService::AvatarInfo
|
|||
{
|
||||
wchar_t h = _jpeg_wstring[i] ;
|
||||
|
||||
for(int j=p-1;j>=0;--j)
|
||||
for(int j=0;j<p;++j)
|
||||
{
|
||||
data[p*i+j] = (unsigned char)(h & 0xff) ;
|
||||
h = h >> 8 ;
|
||||
|
@ -177,16 +183,23 @@ int p3ChatService::sendPrivateChat(std::wstring msg, std::string id)
|
|||
|
||||
std::map<std::string,AvatarInfo*>::iterator it = _avatars.find(id) ;
|
||||
|
||||
if(it == _avatars.end())
|
||||
{
|
||||
_avatars[id] = new AvatarInfo ;
|
||||
it = _avatars.find(id) ;
|
||||
}
|
||||
if(it != _avatars.end() && it->second->_own_is_new)
|
||||
{
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "p3ChatService::sendPrivateChat: new avatar never sent to peer " << id << ". Setting <new> flag to packet." << std::endl;
|
||||
#endif
|
||||
|
||||
ci->chatFlags |= RS_CHAT_FLAG_AVATAR_AVAILABLE ;
|
||||
it->second->_own_is_new = false ;
|
||||
}
|
||||
|
||||
std::cerr << "Sending msg to peer " << id << ", flags = " << ci->chatFlags << std::endl ;
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "Sending msg to peer " << id << ", flags = " << ci->chatFlags << std::endl ;
|
||||
std::cerr << "p3ChatService::sendPrivateChat() Item:";
|
||||
std::cerr << std::endl;
|
||||
ci->print(std::cerr);
|
||||
|
@ -212,8 +225,8 @@ std::list<RsChatItem *> p3ChatService::getChatQueue()
|
|||
std::cerr << std::endl;
|
||||
ci->print(std::cerr);
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
std::cerr << "Got msg. Flags = " << ci->chatFlags << std::endl ;
|
||||
#endif
|
||||
|
||||
if(ci->chatFlags & RS_CHAT_FLAG_CONTAINS_AVATAR) // no msg here. Just an avatar.
|
||||
receiveAvatarJpegData(ci) ;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "services/p3disc.h"
|
||||
|
||||
|
@ -298,13 +299,13 @@ void p3disc::sendOwnDetails(std::string to)
|
|||
|
||||
// Then send message.
|
||||
{
|
||||
//#ifdef P3DISC_DEBUG
|
||||
#ifdef P3DISC_DEBUG
|
||||
std::ostringstream out;
|
||||
out << "p3disc::sendOwnDetails()";
|
||||
out << "Constructing a RsDiscItem Message!" << std::endl;
|
||||
out << "Sending to: " << to;
|
||||
std::cerr << out.str() << std::endl;
|
||||
//#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
// Construct a message
|
||||
|
@ -370,13 +371,13 @@ void p3disc::sendPeerDetails(std::string to, std::string about)
|
|||
|
||||
/* send it off */
|
||||
{
|
||||
//#ifdef P3DISC_DEBUG
|
||||
#ifdef P3DISC_DEBUG
|
||||
std::ostringstream out;
|
||||
out << "p3disc::sendPeerDetails()";
|
||||
out << " Sending details of: " << about;
|
||||
out << " to: " << to << std::endl;
|
||||
std::cerr << out.str() << std::endl;
|
||||
//#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -447,13 +448,19 @@ void p3disc::sendPeerDetails(std::string to, std::string about)
|
|||
if(*it == name)
|
||||
{
|
||||
di->discFlags |= P3DISC_FLAGS_PEER_TRUSTS_ME;
|
||||
#ifdef P3DISC_DEBUG
|
||||
std::cerr << " Peer " << about << "(" << name << ")" << " is trusting " << to << ", sending info." << std::endl ;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t certLen = 0;
|
||||
|
||||
unsigned char **binptr = (unsigned char **) &(di -> certDER.bin_data);
|
||||
|
||||
mAuthMgr->SaveCertificateToBinary(about, binptr, &certLen);
|
||||
#ifdef P3DISC_DEBUG
|
||||
std::cerr << "Saved certificate to binary in p3discReply. Length=" << certLen << std::endl ;
|
||||
#endif
|
||||
if (certLen > 0)
|
||||
{
|
||||
di -> certDER.bin_len = certLen;
|
||||
|
@ -483,9 +490,9 @@ void p3disc::sendPeerDetails(std::string to, std::string about)
|
|||
/*************************************************************************************/
|
||||
void p3disc::recvPeerOwnMsg(RsDiscItem *item)
|
||||
{
|
||||
//#ifdef P3DISC_DEBUG
|
||||
#ifdef P3DISC_DEBUG
|
||||
std::cerr << "p3disc::recvPeerOwnMsg() From: " << item->PeerId() << std::endl;
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
/* tells us their exact address (mConnectMgr can ignore if it looks wrong) */
|
||||
uint32_t type = 0;
|
||||
|
@ -530,8 +537,7 @@ void p3disc::recvPeerOwnMsg(RsDiscItem *item)
|
|||
/* now reply with all details */
|
||||
respondToPeer(item->PeerId());
|
||||
|
||||
addDiscoveryData(item->PeerId(), item->PeerId(),
|
||||
item->laddr, item->saddr, item->discFlags, time(NULL));
|
||||
addDiscoveryData(item->PeerId(), item->PeerId(), item->laddr, item->saddr, item->discFlags, time(NULL));
|
||||
|
||||
/* cleanup (handled by caller) */
|
||||
}
|
||||
|
@ -540,11 +546,11 @@ void p3disc::recvPeerOwnMsg(RsDiscItem *item)
|
|||
void p3disc::recvPeerFriendMsg(RsDiscReply *item)
|
||||
{
|
||||
|
||||
//#ifdef P3DISC_DEBUG
|
||||
#ifdef P3DISC_DEBUG
|
||||
std::cerr << "p3disc::recvPeerFriendMsg() From: " << item->PeerId();
|
||||
std::cerr << " About " << item->aboutId;
|
||||
std::cerr << std::endl;
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
/* tells us their exact address (mConnectMgr can ignore if it looks wrong) */
|
||||
|
||||
|
@ -595,6 +601,8 @@ void p3disc::recvPeerFriendMsg(RsDiscReply *item)
|
|||
|
||||
addDiscoveryData(item->PeerId(), peerId, item->laddr, item->saddr, item->discFlags, time(NULL));
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
|
||||
|
||||
/* cleanup (handled by caller) */
|
||||
}
|
||||
|
||||
|
@ -604,8 +612,7 @@ void p3disc::recvPeerFriendMsg(RsDiscReply *item)
|
|||
/*************************************************************************************/
|
||||
|
||||
|
||||
int p3disc::addDiscoveryData(std::string fromId, std::string aboutId,
|
||||
struct sockaddr_in laddr, struct sockaddr_in raddr, uint32_t flags, time_t ts)
|
||||
int p3disc::addDiscoveryData(std::string fromId, std::string aboutId, struct sockaddr_in laddr, struct sockaddr_in raddr, uint32_t flags, time_t ts)
|
||||
{
|
||||
RsStackMutex stack(mDiscMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
|
||||
#include "pqi/pqibin.h"
|
||||
#include "pqi/pqiarchive.h"
|
||||
#include "pqi/p3connmgr.h"
|
||||
|
@ -121,8 +123,11 @@ int p3MsgService::incomingMsgs()
|
|||
{
|
||||
RsMsgItem *mi;
|
||||
int i = 0;
|
||||
bool changed = false ;
|
||||
|
||||
while((mi = (RsMsgItem *) recvItem()) != NULL)
|
||||
{
|
||||
changed = true ;
|
||||
++i;
|
||||
mi -> recvTime = time(NULL);
|
||||
mi -> msgFlags = RS_MSG_FLAGS_NEW;
|
||||
|
@ -162,6 +167,9 @@ int p3MsgService::incomingMsgs()
|
|||
|
||||
/**** STACK UNLOCKED ***/
|
||||
}
|
||||
if(changed)
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -472,56 +480,70 @@ bool p3MsgService::removeMsgId(std::string mid)
|
|||
{
|
||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||
uint32_t msgId = atoi(mid.c_str());
|
||||
bool changed = false ;
|
||||
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
mit = imsg.find(msgId);
|
||||
if (mit != imsg.end())
|
||||
{
|
||||
RsMsgItem *mi = mit->second;
|
||||
imsg.erase(mit);
|
||||
delete mi;
|
||||
msgChanged.IndicateChanged();
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
mit = imsg.find(msgId);
|
||||
if (mit != imsg.end())
|
||||
{
|
||||
changed = true ;
|
||||
RsMsgItem *mi = mit->second;
|
||||
imsg.erase(mit);
|
||||
delete mi;
|
||||
// msgChanged.IndicateChanged();
|
||||
|
||||
return true;
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
mit = msgOutgoing.find(msgId);
|
||||
if (mit != msgOutgoing.end())
|
||||
{
|
||||
changed = true ;
|
||||
RsMsgItem *mi = mit->second;
|
||||
msgOutgoing.erase(mit);
|
||||
delete mi;
|
||||
// msgChanged.IndicateChanged();
|
||||
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
mit = msgOutgoing.find(msgId);
|
||||
if (mit != msgOutgoing.end())
|
||||
{
|
||||
RsMsgItem *mi = mit->second;
|
||||
msgOutgoing.erase(mit);
|
||||
delete mi;
|
||||
msgChanged.IndicateChanged();
|
||||
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
return true;
|
||||
}
|
||||
if(changed)
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool p3MsgService::markMsgIdRead(std::string mid)
|
||||
{
|
||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||
uint32_t msgId = atoi(mid.c_str());
|
||||
bool changed = false ;
|
||||
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
mit = imsg.find(msgId);
|
||||
if (mit != imsg.end())
|
||||
{
|
||||
RsMsgItem *mi = mit->second;
|
||||
mi -> msgFlags &= ~(RS_MSG_FLAGS_NEW);
|
||||
msgChanged.IndicateChanged();
|
||||
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
return true;
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
mit = imsg.find(msgId);
|
||||
if (mit != imsg.end())
|
||||
{
|
||||
changed = true ;
|
||||
RsMsgItem *mi = mit->second;
|
||||
mi -> msgFlags &= ~(RS_MSG_FLAGS_NEW);
|
||||
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
if(changed) // no need to notify, because the msg is always
|
||||
return true; // marked as read from the gui itself, so the gui
|
||||
else // can mark it as read.
|
||||
return false;
|
||||
}
|
||||
|
||||
/****************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue