mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-03 14:45:12 -04:00
Improved MessagesDialog:
- corrected calculation of message counts - p3MsgService::checkOutgoingMessages -> notify when message was sent - refill of message list without clear, selected messages and scroll position are not changed - corrected sorting of date with only time for today - changed context menu in message list git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2863 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
5813a6454a
commit
f239e7e4d4
4 changed files with 396 additions and 359 deletions
|
@ -186,66 +186,75 @@ int p3MsgService::checkOutgoingMessages()
|
|||
* if online, send
|
||||
*/
|
||||
|
||||
const std::string ownId = mConnMgr->getOwnId();
|
||||
bool changed = false ;
|
||||
|
||||
std::list<uint32_t>::iterator it;
|
||||
std::list<uint32_t> toErase;
|
||||
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||
for(mit = msgOutgoing.begin(); mit != msgOutgoing.end(); mit++)
|
||||
{
|
||||
const std::string ownId = mConnMgr->getOwnId();
|
||||
|
||||
/* find the certificate */
|
||||
std::string pid = mit->second->PeerId();
|
||||
peerConnectState pstate;
|
||||
bool toSend = false;
|
||||
std::list<uint32_t>::iterator it;
|
||||
std::list<uint32_t> toErase;
|
||||
|
||||
if (mConnMgr->getFriendNetStatus(pid, pstate))
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||
for(mit = msgOutgoing.begin(); mit != msgOutgoing.end(); mit++)
|
||||
{
|
||||
if (pstate.state & RS_PEER_S_CONNECTED)
|
||||
|
||||
/* find the certificate */
|
||||
std::string pid = mit->second->PeerId();
|
||||
peerConnectState pstate;
|
||||
bool toSend = false;
|
||||
|
||||
if (mConnMgr->getFriendNetStatus(pid, pstate))
|
||||
{
|
||||
if (pstate.state & RS_PEER_S_CONNECTED)
|
||||
{
|
||||
toSend = true;
|
||||
}
|
||||
}
|
||||
else if (pid == ownId) /* FEEDBACK Msg to Ourselves */
|
||||
{
|
||||
toSend = true;
|
||||
}
|
||||
}
|
||||
else if (pid == ownId) /* FEEDBACK Msg to Ourselves */
|
||||
{
|
||||
toSend = true;
|
||||
|
||||
if (toSend)
|
||||
{
|
||||
/* send msg */
|
||||
pqioutput(PQL_DEBUG_BASIC, msgservicezone,
|
||||
"p3MsgService::checkOutGoingMessages() Sending out message");
|
||||
/* remove the pending flag */
|
||||
(mit->second)->msgFlags &= ~RS_MSG_FLAGS_PENDING;
|
||||
|
||||
sendItem(mit->second);
|
||||
toErase.push_back(mit->first);
|
||||
|
||||
changed = true ;
|
||||
}
|
||||
else
|
||||
{
|
||||
pqioutput(PQL_DEBUG_BASIC, msgservicezone,
|
||||
"p3MsgService::checkOutGoingMessages() Delaying until available...");
|
||||
}
|
||||
}
|
||||
|
||||
if (toSend)
|
||||
/* clean up */
|
||||
for(it = toErase.begin(); it != toErase.end(); it++)
|
||||
{
|
||||
/* send msg */
|
||||
pqioutput(PQL_DEBUG_BASIC, msgservicezone,
|
||||
"p3MsgService::checkOutGoingMessages() Sending out message");
|
||||
/* remove the pending flag */
|
||||
(mit->second)->msgFlags &= ~RS_MSG_FLAGS_PENDING;
|
||||
|
||||
sendItem(mit->second);
|
||||
toErase.push_back(mit->first);
|
||||
mit = msgOutgoing.find(*it);
|
||||
if (mit != msgOutgoing.end())
|
||||
{
|
||||
msgOutgoing.erase(mit);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (toErase.size() > 0)
|
||||
{
|
||||
pqioutput(PQL_DEBUG_BASIC, msgservicezone,
|
||||
"p3MsgService::checkOutGoingMessages() Delaying until available...");
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
}
|
||||
}
|
||||
|
||||
/* clean up */
|
||||
for(it = toErase.begin(); it != toErase.end(); it++)
|
||||
{
|
||||
mit = msgOutgoing.find(*it);
|
||||
if (mit != msgOutgoing.end())
|
||||
{
|
||||
msgOutgoing.erase(mit);
|
||||
}
|
||||
}
|
||||
|
||||
if (toErase.size() > 0)
|
||||
{
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
}
|
||||
if(changed)
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue