Added read/unread state to channel service (copied from forum service).

Added new and missing tests of the RsItems.
Added new notifier on channel changes.
Reworked fill of channels in ChannelFeed. Now the channel tree is updated and not refilled.
Show unread message count in channels tree.
Fixed memory leak in context menu.
Show a new tray icon and action icon in MainWindow, when new channel messages are available.

Recompile of the GUI needed.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3626 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-10-07 00:17:42 +00:00
parent df20d69b29
commit fc0ff38206
22 changed files with 1181 additions and 653 deletions

View File

@ -34,6 +34,10 @@
#include "rstypes.h"
#include "rsdistrib.h" /* For FLAGS */
#define CHANNEL_MSG_STATUS_MASK 0x000f
#define CHANNEL_MSG_STATUS_READ 0x0001
#define CHANNEL_MSG_STATUS_UNREAD_BY_USER 0x0002
//! Stores information for a give channel id
/*!
* Stores all information for a given channel id
@ -167,6 +171,31 @@ virtual bool getChannelMsgList(std::string cId, std::list<ChannelMsgSummary> &ms
*/
virtual bool getChannelMessage(std::string cId, std::string mId, ChannelMsgInfo &msg) = 0;
/*!
* set message status
* @param cId channel id
* @param mId message id
* @param status status to set
* @param statusMask bitmask to modify
*/
virtual bool setMessageStatus(const std::string& cId,const std::string& mId, const uint32_t status, const uint32_t statusMask) = 0;
/*!
* set message status
* @param cId channel id
* @param mId message id
* @param status status
*/
virtual bool getMessageStatus(const std::string& cId, const std::string& mId, uint32_t& status) = 0;
/*!
* count the new and unread messages
* @param cId channel id
* @param newCount count of new messages
* @param unreadCount count of unread messages
*/
virtual bool getMessageCount(const std::string cId, unsigned int &newCount, unsigned int &unreadCount) = 0;
/*!
* send message contain in message info to the id indicated within it (make sure you set the channel id of the message info)
* @param info message to be sent

View File

@ -198,6 +198,7 @@ class NotifyBase
virtual void notifyPeerStatusChanged(const std::string& /* peer_id */, uint32_t /* status */) {}
/* one or more peers has changed the states */
virtual void notifyPeerStatusChangedSummary() {}
virtual void notifyChannelMsgReadSatusChanged(const std::string& /* channelId */, const std::string& /* msgId */, uint32_t /* status */) {}
virtual std::string askForPassword(const std::string& /* key_details */ ,bool /* prev_is_bad */ ) { return "" ;}
};
@ -217,6 +218,7 @@ const int NOTIFY_LIST_PUBLIC_CHAT = 13;
const int NOTIFY_LIST_PRIVATE_INCOMING_CHAT = 14;
const int NOTIFY_LIST_PRIVATE_OUTGOING_CHAT = 15;
const int NOTIFY_LIST_GROUPLIST = 16;
const int NOTIFY_LIST_CHANNELLIST_LOCKED = 17; // use connect with Qt::QueuedConnection
const int NOTIFY_TYPE_SAME = 0x01;
const int NOTIFY_TYPE_MOD = 0x02; /* general purpose, check all */

View File

@ -74,6 +74,45 @@ std::ostream &RsChannelMsg::print(std::ostream &out, uint16_t indent)
return out;
}
void RsChannelReadStatus::clear()
{
RsDistribChildConfig::clear();
channelId.clear();
msgReadStatus.clear();
return;
}
std::ostream& RsChannelReadStatus::print(std::ostream &out, uint16_t indent = 0)
{
printRsItemBase(out, "RsChannelMsg", indent);
uint16_t int_Indent = indent + 2;
RsDistribChildConfig::print(out, int_Indent);
printIndent(out, int_Indent);
out << "ChannelId: " << channelId << std::endl;
std::map<std::string, uint32_t>::iterator mit = msgReadStatus.begin();
for(; mit != msgReadStatus.end(); mit++)
{
printIndent(out, int_Indent);
out << "msgId : " << mit->first << std::endl;
printIndent(out, int_Indent);
out << " status : " << mit->second << std::endl;
}
printRsItemEnd(out, "RsChannelMsg", indent);
return out;
}
/*************************************************************************/
/*************************************************************************/
@ -204,19 +243,207 @@ RsChannelMsg *RsChannelSerialiser::deserialiseMsg(void *data, uint32_t *pktsize)
}
uint32_t RsChannelSerialiser::sizeReadStatus(RsChannelReadStatus *item)
{
uint32_t s = 8; /* header */
/* RsDistribChildConfig stuff */
s += 4; /* save_type */
/* RsChannelReadStatus stuff */
s += GetTlvStringSize(item->channelId);
std::map<std::string, uint32_t>::iterator mit = item->msgReadStatus.begin();
for(; mit != item->msgReadStatus.end(); mit++)
{
s += GetTlvStringSize(mit->first); /* key */
s += 4; /* value */
}
return s;
}
/* serialise the data to the buffer */
bool RsChannelSerialiser::serialiseReadStatus(RsChannelReadStatus *item, void *data, uint32_t *pktsize)
{
uint32_t tlvsize = sizeReadStatus(item);
uint32_t offset = 0;
if (*pktsize < tlvsize)
return false; /* not enough space */
*pktsize = tlvsize;
bool ok = true;
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
std::cerr << "RsChannelSerialiser::serialiseReadStatus() Header: " << ok << std::endl;
std::cerr << "RsChannelSerialiser::serialiseReadStatus() Size: " << tlvsize << std::endl;
/* skip the header */
offset += 8;
/* RsDistribMsg first */
ok &= setRawUInt32(data, tlvsize, &offset, item->save_type);
std::cerr << "RsChannelSerialiser::serialiseReadStatus() save_type: " << ok << std::endl;
/* RsChannelMsg */
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_GROUPID, item->channelId);
std::cerr << "RsChannelSerialiser::serialiseReadStatus() channelId: " << ok << std::endl;
std::map<std::string, uint32_t>::iterator mit = item->msgReadStatus.begin();
for(; mit != item->msgReadStatus.end(); mit++)
{
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_MSGID, mit->first); /* key */
ok &= setRawUInt32(data, tlvsize, &offset, mit->second); /* value */
}
std::cerr << "RsChannelSerialiser::serialiseReadStatus() msgReadStatus: " << ok << std::endl;
if (offset != tlvsize)
{
ok = false;
std::cerr << "RsChannelSerialiser::serialiseReadStatus() Size Error! " << std::endl;
}
return ok;
}
RsChannelReadStatus *RsChannelSerialiser::deserialiseReadStatus(void *data, uint32_t *pktsize)
{
/* get the type and size */
uint32_t rstype = getRsItemId(data);
uint32_t rssize = getRsItemSize(data);
uint32_t offset = 0;
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
(RS_SERVICE_TYPE_CHANNEL != getRsItemService(rstype)) ||
(RS_PKT_SUBTYPE_CHANNEL_READ_STATUS != getRsItemSubType(rstype)))
{
return NULL; /* wrong type */
}
if (*pktsize < rssize) /* check size */
return NULL; /* not enough data */
/* set the packet length */
*pktsize = rssize;
bool ok = true;
/* ready to load */
RsChannelReadStatus *item = new RsChannelReadStatus();
item->clear();
/* skip the header */
offset += 8;
/* RsDistribMsg first */
ok &= getRawUInt32(data, rssize, &offset, &(item->save_type));
/* RschannelMsg */
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_GROUPID, item->channelId);
std::string key;
uint32_t value;
while(offset != rssize)
{
key.clear();
value = 0;
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_MSGID, key); /* key */
/* incomplete key value pair? then fail*/
if(offset == rssize)
{
delete item;
return NULL;
}
ok &= getRawUInt32(data, rssize, &offset, &value); /* value */
item->msgReadStatus.insert(std::pair<std::string, uint32_t>(key, value));
}
if (!ok)
{
delete item;
return NULL;
}
return item;
}
/************************************************************/
uint32_t RsChannelSerialiser::size(RsItem *item)
{
return sizeMsg((RsChannelMsg *) item);
RsChannelMsg* dcm;
RsChannelReadStatus* drs;
if( NULL != ( dcm = dynamic_cast<RsChannelMsg*>(item)))
{
return sizeMsg(dcm);
}
else if(NULL != (drs = dynamic_cast<RsChannelReadStatus* >(item)))
{
return sizeReadStatus(drs);
}
return false;
}
bool RsChannelSerialiser::serialise(RsItem *item, void *data, uint32_t *pktsize)
{
return serialiseMsg((RsChannelMsg *) item, data, pktsize);
RsChannelMsg* dcm;
RsChannelReadStatus* drs;
if( NULL != ( dcm = dynamic_cast<RsChannelMsg*>(item)))
{
return serialiseMsg(dcm, data, pktsize);
}
else if(NULL != (drs = dynamic_cast<RsChannelReadStatus* >(item)))
{
return serialiseReadStatus(drs, data, pktsize);
}
return false;
}
RsItem *RsChannelSerialiser::deserialise(void *data, uint32_t *pktsize)
{
return deserialiseMsg(data, pktsize);
/* get the type and size */
uint32_t rstype = getRsItemId(data);
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
(RS_SERVICE_TYPE_CHANNEL != getRsItemService(rstype)))
{
return NULL; /* wrong type */
}
switch(getRsItemSubType(rstype))
{
case RS_PKT_SUBTYPE_CHANNEL_MSG:
return deserialiseMsg(data, pktsize);
case RS_PKT_SUBTYPE_CHANNEL_READ_STATUS:
return deserialiseReadStatus(data, pktsize);
default:
return NULL;
}
return NULL;
}

View File

@ -35,7 +35,8 @@
#include "serialiser/rsdistribitems.h"
const uint8_t RS_PKT_SUBTYPE_CHANNEL_MSG = 0x01;
const uint8_t RS_PKT_SUBTYPE_CHANNEL_MSG = 0x01;
const uint8_t RS_PKT_SUBTYPE_CHANNEL_READ_STATUS = 0x02;
/**************************************************************************/
@ -63,6 +64,29 @@ virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
};
/*!
* This is used to keep track of whether a message has been read
* by client
*/
class RsChannelReadStatus : public RsDistribChildConfig
{
public:
RsChannelReadStatus()
: RsDistribChildConfig(RS_SERVICE_TYPE_CHANNEL, RS_PKT_SUBTYPE_CHANNEL_READ_STATUS)
{ return; }
virtual ~RsChannelReadStatus() {return; }
virtual void clear();
virtual std::ostream& print(std::ostream &out, uint16_t indent);
std::string channelId;
/// a map which contains the read for messages within a forum
std::map<std::string, uint32_t> msgReadStatus;
};
class RsChannelSerialiser: public RsSerialType
{
public:
@ -83,6 +107,10 @@ virtual uint32_t sizeMsg(RsChannelMsg *);
virtual bool serialiseMsg(RsChannelMsg *item, void *data, uint32_t *size);
virtual RsChannelMsg *deserialiseMsg(void *data, uint32_t *size);
virtual uint32_t sizeReadStatus(RsChannelReadStatus* );
virtual bool serialiseReadStatus(RsChannelReadStatus* item, void* data, uint32_t *size);
virtual RsChannelReadStatus *deserialiseReadStatus(void* data, uint32_t *size);
};
/**************************************************************************/

View File

@ -25,6 +25,7 @@
#include "services/p3channels.h"
#include "util/rsdir.h"
#include "retroshare/rsiface.h"
std::ostream &operator<<(std::ostream &out, const ChannelInfo &info)
{
@ -182,14 +183,14 @@ bool p3Channels::getChannelMsgList(std::string cId, std::list<ChannelMsgSummary>
return true;
}
bool p3Channels::getChannelMessage(std::string fId, std::string mId, ChannelMsgInfo &info)
bool p3Channels::getChannelMessage(std::string cId, std::string mId, ChannelMsgInfo &info)
{
std::list<std::string> msgIds;
std::list<std::string>::iterator it;
RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/
RsDistribMsg *msg = locked_getGroupMsg(fId, mId);
RsDistribMsg *msg = locked_getGroupMsg(cId, mId);
RsChannelMsg *cmsg = dynamic_cast<RsChannelMsg *>(msg);
if (!cmsg)
return false;
@ -285,9 +286,181 @@ bool p3Channels::ChannelMessageSend(ChannelMsgInfo &info)
std::string msgId = publishMsg(cmsg, toSign);
if (msgId.empty()) {
return false;
}
return setMessageStatus(info.channelId, msgId, CHANNEL_MSG_STATUS_READ, CHANNEL_MSG_STATUS_MASK);
}
bool p3Channels::setMessageStatus(const std::string& cId,const std::string& mId,const uint32_t status, const uint32_t statusMask)
{
bool changed = false;
uint32_t newStatus = 0;
{
RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/
std::list<RsChannelReadStatus *>::iterator lit = mReadStatus.begin();
for(; lit != mReadStatus.end(); lit++)
{
if((*lit)->channelId == cId)
{
RsChannelReadStatus* rsi = *lit;
uint32_t oldStatus = rsi->msgReadStatus[mId];
rsi->msgReadStatus[mId] &= ~statusMask;
rsi->msgReadStatus[mId] |= (status & statusMask);
newStatus = rsi->msgReadStatus[mId];
if (oldStatus != newStatus) {
changed = true;
}
break;
}
}
// if channel id does not exist create one
if(lit == mReadStatus.end())
{
RsChannelReadStatus* rsi = new RsChannelReadStatus();
rsi->channelId = cId;
rsi->msgReadStatus[mId] = status & statusMask;
mReadStatus.push_back(rsi);
saveList.push_back(rsi);
newStatus = rsi->msgReadStatus[mId];
changed = true;
}
if (changed) {
IndicateConfigChanged();
}
} /******* UNLOCKED ********/
if (changed) {
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_MOD);
rsicontrol->getNotify().notifyChannelMsgReadSatusChanged(cId, mId, newStatus);
}
return true;
}
bool p3Channels::getMessageStatus(const std::string& cId, const std::string& mId, uint32_t& status)
{
status = 0;
RsStackMutex stack(distribMtx);
std::list<RsChannelReadStatus *>::iterator lit = mReadStatus.begin();
for(; lit != mReadStatus.end(); lit++)
{
if((*lit)->channelId == cId)
{
break;
}
}
if(lit == mReadStatus.end())
{
return false;
}
std::map<std::string, uint32_t >::iterator mit = (*lit)->msgReadStatus.find(mId);
if(mit != (*lit)->msgReadStatus.end())
{
status = mit->second;
return true;
}
return false;
}
bool p3Channels::getMessageCount(const std::string cId, unsigned int &newCount, unsigned int &unreadCount)
{
newCount = 0;
unreadCount = 0;
std::list<std::string> grpIds;
if (cId.empty()) {
// count all messages of all subscribed channels
getAllGroupList(grpIds);
} else {
// count all messages of one channels
grpIds.push_back(cId);
}
std::list<std::string>::iterator git;
for (git = grpIds.begin(); git != grpIds.end(); git++) {
std::string cId = *git;
uint32_t grpFlags;
{
// only flag is needed
RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/
GroupInfo *gi = locked_getGroupInfo(cId);
if (gi == NULL) {
return false;
}
grpFlags = gi->flags;
} /******* UNLOCKED ********/
if (grpFlags & (RS_DISTRIB_ADMIN | RS_DISTRIB_SUBSCRIBED)) {
std::list<std::string> msgIds;
if (getAllMsgList(cId, msgIds)) {
std::list<std::string>::iterator mit;
RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/
std::list<RsChannelReadStatus *>::iterator lit;
for(lit = mReadStatus.begin(); lit != mReadStatus.end(); lit++) {
if ((*lit)->channelId == cId) {
break;
}
}
if (lit == mReadStatus.end()) {
// no status available -> all messages are new
newCount += msgIds.size();
unreadCount += msgIds.size();
continue;
}
for (mit = msgIds.begin(); mit != msgIds.end(); mit++) {
std::map<std::string, uint32_t >::iterator rit = (*lit)->msgReadStatus.find(*mit);
if (rit == (*lit)->msgReadStatus.end()) {
// no status available -> message is new
newCount++;
unreadCount++;
continue;
}
if (rit->second & CHANNEL_MSG_STATUS_READ) {
// message is not new
if (rit->second & CHANNEL_MSG_STATUS_UNREAD_BY_USER) {
// message is unread
unreadCount++;
}
} else {
newCount++;
unreadCount++;
}
}
} /******* UNLOCKED ********/
}
}
return true;
}
bool p3Channels::channelExtraFileHash(std::string path, std::string chId, FileInfo& fInfo){
@ -636,7 +809,6 @@ bool p3Channels::locked_eventNewMsg(GroupInfo *grp, RsDistribMsg *msg, std::stri
return locked_eventDuplicateMsg(grp, msg, id);
}
void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags)
{
std::string grpId = grp.grpId;
@ -655,12 +827,14 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags)
std::cerr << "p3Channels::locked_notifyGroupChanged() NEW UPDATE" << std::endl;
#endif
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_CHAN_NEW, grpId, msgId, nullId);
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
break;
case GRP_UPDATE:
#ifdef CHANNEL_DEBUG
std::cerr << "p3Channels::locked_notifyGroupChanged() UPDATE" << std::endl;
#endif
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_CHAN_UPDATE, grpId, msgId, nullId);
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_MOD);
break;
case GRP_LOAD_KEY:
#ifdef CHANNEL_DEBUG
@ -671,6 +845,7 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags)
#ifdef CHANNEL_DEBUG
std::cerr << "p3Channels::locked_notifyGroupChanged() NEW MSG" << std::endl;
#endif
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
break;
case GRP_SUBSCRIBED:
#ifdef CHANNEL_DEBUG
@ -690,11 +865,13 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags)
/* check if downloads need to be started? */
}
rsicontrol->getNotify().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);
/* won't stop downloads... */
@ -778,6 +955,24 @@ void p3Channels::cleanUpOldFiles(){
//TODO: if you want to config saving and loading for channel distrib service implement this method further
bool p3Channels::childLoadList(std::list<RsItem* >& configSaves)
{
RsChannelReadStatus* drs = NULL;
std::list<RsItem* >::iterator it;
for(it = configSaves.begin(); it != configSaves.end(); it++)
{
if(NULL != (drs = dynamic_cast<RsChannelReadStatus* >(*it)))
{
mReadStatus.push_back(drs);
saveList.push_back(drs);
}
else
{
std::cerr << "p3Channels::childLoadList(): Configs items loaded were incorrect!"
<< std::endl;
return false;
}
}
return true;
}

View File

@ -67,6 +67,10 @@ virtual bool getChannelMsgList(std::string cId, std::list<ChannelMsgSummary> &ms
virtual bool getChannelMessage(std::string cId, std::string mId, ChannelMsgInfo &msg);
virtual bool ChannelMessageSend(ChannelMsgInfo &info);
virtual bool setMessageStatus(const std::string& cId, const std::string& mId, const uint32_t status, const uint32_t statusMask);
virtual bool getMessageStatus(const std::string& cId, const std::string& mId, uint32_t& status);
virtual bool getMessageCount(const std::string cId, unsigned int &newCount, unsigned int &unreadCount);
virtual bool channelSubscribe(std::string cId, bool subscribe);
virtual bool channelExtraFileHash(std::string path, std::string chId, FileInfo& fInfo);
@ -106,6 +110,7 @@ bool cpyMsgFileToChFldr(std::string path, std::string fname, std::string chId, b
std::string mChannelsDir;
std::list<RsItem *> saveList;
std::list<RsChannelReadStatus *> mReadStatus;
};

View File

@ -564,9 +564,11 @@ void p3Forums::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags)
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
break;
case GRP_SUBSCRIBED:
case GRP_UNSUBSCRIBED:
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
break;
case GRP_UNSUBSCRIBED:
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_DEL);
break;
}
return p3GroupDistrib::locked_notifyGroupChanged(grp, flags);
}

View File

@ -276,6 +276,51 @@ bool operator==(const RsForumReadStatus& frs1, const RsForumReadStatus& frs2)
RsSerialType* init_item(RsChannelReadStatus& fRdStatus)
{
randString(SHORT_STR, fRdStatus.channelId);
fRdStatus.save_type = rand()%42;
std::map<std::string, uint32_t>::iterator mit = fRdStatus.msgReadStatus.begin();
std::string id;
uint32_t status = 0;
int numMaps = rand()%12;
for(int i = 0; i < numMaps; i++)
{
randString(SHORT_STR, id);
status = rand()%23;
fRdStatus.msgReadStatus.insert(std::pair<std::string, uint32_t>(id, status));
}
return new RsChannelSerialiser();
}
bool operator==(const RsChannelReadStatus& frs1, const RsChannelReadStatus& frs2)
{
if(frs1.channelId != frs2.channelId) return false;
if(frs1.save_type != frs2.save_type) return false;
if(frs1.msgReadStatus.size() != frs2.msgReadStatus.size()) return false;
std::map<std::string, uint32_t>::const_iterator mit
= frs1.msgReadStatus.begin();
for(;mit != frs1.msgReadStatus.end(); mit++)
{
if(mit->second != frs2.msgReadStatus.find(mit->first)->second) return false;
}
return true;
}
bool operator==(const RsBlogMsg& bMsg1,const RsBlogMsg& bMsg2)
{
@ -307,6 +352,7 @@ int main(){
test_RsItem<RsDistribGrpKey>(); REPORT("Serialise/Deserialise RsDistribGrpKey");
test_RsItem<RsDistribSignedMsg>(); REPORT("Serialise/Deserialise RsDistribSignedMsg");
test_RsItem<RsChannelMsg>(); REPORT("Serialise/Deserialise RsChannelMsg");
test_RsItem<RsChannelReadStatus>(); REPORT("Serialise/Deserialise RsChannelReadStatus");
test_RsItem<RsForumMsg>(); REPORT("Serialise/Deserialise RsForumMsg");
test_RsItem<RsForumReadStatus>(); REPORT("Serialise/Deserialise RsForumReadStatus");
test_RsItem<RsBlogMsg>(); REPORT("Serialise/Deserialise RsBlogMsg");

View File

@ -42,6 +42,18 @@ RsSerialType* init_item(RsChatMsgItem& cmi)
return new RsChatSerialiser();
}
RsSerialType* init_item(RsPrivateChatMsgConfigItem& pcmi)
{
randString(SHORT_STR, pcmi.configPeerId);
pcmi.chatFlags = rand()%34;
pcmi.configFlags = rand()%21;
pcmi.sendTime = rand()%422224;
randString(LARGE_STR, pcmi.message);
pcmi.recvTime = rand()%344443;
return new RsChatSerialiser();
}
RsSerialType* init_item(RsChatStatusItem& csi)
{
@ -123,6 +135,19 @@ bool operator ==(const RsChatMsgItem& cmiLeft,const RsChatMsgItem& cmiRight)
return true;
}
bool operator ==(const RsPrivateChatMsgConfigItem& pcmiLeft,const RsPrivateChatMsgConfigItem& pcmiRight)
{
if(pcmiLeft.configPeerId != pcmiRight.configPeerId) return false;
if(pcmiLeft.chatFlags != pcmiRight.chatFlags) return false;
if(pcmiLeft.configFlags != pcmiRight.configFlags) return false;
if(pcmiLeft.message != pcmiRight.message) return false;
if(pcmiLeft.sendTime != pcmiRight.sendTime) return false;
if(pcmiLeft.recvTime != pcmiRight.recvTime) return false;
return true;
}
bool operator ==(const RsChatStatusItem& csiLeft, const RsChatStatusItem& csiRight)
{
if(csiLeft.flags != csiRight.flags) return false;
@ -201,6 +226,7 @@ bool operator ==(const RsMsgSrcId& msLeft, const RsMsgSrcId& msRight)
int main()
{
test_RsItem<RsChatMsgItem >(); REPORT("Serialise/Deserialise RsChatMsgItem");
test_RsItem<RsChatMsgItem >(); REPORT("Serialise/Deserialise RsPrivateChatMsgConfigItem");
test_RsItem<RsChatStatusItem >(); REPORT("Serialise/Deserialise RsChatStatusItem");
test_RsItem<RsChatAvatarItem >(); REPORT("Serialise/Deserialise RsChatAvatarItem");
test_RsItem<RsMsgItem >(); REPORT("Serialise/Deserialise RsMsgItem");

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,8 @@
#ifndef _CHANNEL_FEED_DIALOG_H
#define _CHANNEL_FEED_DIALOG_H
#include <retroshare/rschannels.h>
#include "mainpage.h"
#include "RsAutoUpdatePage.h"
@ -36,15 +38,16 @@
class ChanMsgItem;
class QStandardItemModel;
class QStandardItem;
class ChannelFeed : public RsAutoUpdatePage, public FeedHolder, private Ui::ChannelFeed
{
Q_OBJECT
Q_OBJECT
public:
/** Default Constructor */
ChannelFeed(QWidget *parent = 0);
/** Default Destructor */
/** Default Constructor */
ChannelFeed(QWidget *parent = 0);
/** Default Destructor */
virtual void deleteFeedItem(QWidget *item, uint32_t type);
@ -54,59 +57,46 @@ public:
virtual void updateDisplay();
public slots:
void selectChannel( std::string );
void selectChannel(const QModelIndex &);
void toggleSelection(const QModelIndex &);
void selectChannel(QModelIndex index);
private slots:
void channelListCustomPopupMenu( QPoint point );
void createChannel();
void createChannel();
void channelSelection();
void channelSelection();
void subscribeChannel();
void unsubscribeChannel();
void createMsg();
void subscribeChannel();
void unsubscribeChannel();
void setAllAsReadClicked();
void createMsg();
void showChannelDetails();
void restoreChannelKeys();
void editChannelDetail();
void shareKey();
void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
private:
void updateChannelList();
void fillChannelList(int channelItem, std::list<ChannelInfo> &channelInfos);
void updateChannelList();
void updateChannelListOwn(std::list<std::string> &ids);
void updateChannelListSub(std::list<std::string> &ids);
void updateChannelListPop(std::list<std::string> &ids);
void updateChannelListOther(std::list<std::string> &ids);
void updateChannelMsgs();
void updateMessageSummaryList(const std::string &channelId);
void updateChannelMsgs();
QStandardItemModel *model;
QStandardItemModel *model;
std::string mChannelId; /* current Channel */
std::string mChannelId; /* current Channel */
/* Layout Pointers */
QBoxLayout *mMsgLayout;
/* Layout Pointers */
QBoxLayout *mMsgLayout;
std::list<ChanMsgItem *> mChanMsgItems;
QFont mChannelFont;
QFont itemFont;
QAction* postchannelAct;
QAction* subscribechannelAct;
QAction* unsubscribechannelAct;
QAction* channeldetailsAct;
QAction* restoreKeysAct;
QAction* editChannelDetailAct;
QAction* shareKeyAct;
std::list<ChanMsgItem *> mChanMsgItems;
QFont mChannelFont;
QFont itemFont;
};

View File

@ -469,7 +469,7 @@ border-image: url(:/images/btn_26_pressed.png) 4;
</spacer>
</item>
<item row="0" column="4">
<widget class="QToolButton" name="setallreadtoolButton">
<widget class="QToolButton" name="setAllAsReadButton">
<property name="minimumSize">
<size>
<width>26</width>

View File

@ -68,6 +68,7 @@
#include <retroshare/rspeers.h>
#include <retroshare/rsfiles.h>
#include <retroshare/rsforums.h>
#include <retroshare/rschannels.h>
#include <retroshare/rsnotify.h>
#include "gui/connect/ConnectFriendWizard.h"
@ -218,7 +219,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
messageAction = createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp));
ui.stackPages->add(channelFeed = new ChannelFeed(ui.stackPages),
createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp));
channelAction = createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp));
#ifdef BLOGS
ui.stackPages->add(blogsFeed = new BlogsDialog(ui.stackPages),
@ -308,6 +309,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
/* call once */
updateMessages();
updateForums();
updateChannels(NOTIFY_TYPE_ADD);
privateChatChanged(NOTIFY_LIST_PRIVATE_INCOMING_CHAT, NOTIFY_TYPE_ADD);
idle = new Idle();
@ -403,6 +405,11 @@ void MainWindow::createTrayIcon()
trayIconForums->setIcon(QIcon(":/images/konversation16.png"));
connect(trayIconForums, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconForumsClicked(QSystemTrayIcon::ActivationReason)));
// Create the tray icon for channels
trayIconChannels = new QSystemTrayIcon(this);
trayIconChannels->setIcon(QIcon(":/images/channels16.png"));
connect(trayIconChannels, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconChannelsClicked(QSystemTrayIcon::ActivationReason)));
// Create the tray icon for chat
trayIconChat = new QSystemTrayIcon(this);
trayIconChat->setIcon(QIcon(":/images/chat.png"));
@ -458,9 +465,9 @@ void MainWindow::updateForums()
rsForums->getMessageCount("", newMessageCount, unreadMessageCount);
if (newMessageCount) {
forumAction->setIcon(QIcon(QPixmap(":/images/konversation_new.png"))) ;
forumAction->setIcon(QIcon(":/images/konversation_new.png")) ;
} else {
forumAction->setIcon(QIcon(QPixmap(":/images/konversation.png"))) ;
forumAction->setIcon(QIcon(IMAGE_FORUMS)) ;
}
if (newMessageCount) {
@ -475,6 +482,30 @@ void MainWindow::updateForums()
}
}
void MainWindow::updateChannels(int type)
{
unsigned int newMessageCount = 0;
unsigned int unreadMessageCount = 0;
rsChannels->getMessageCount("", newMessageCount, unreadMessageCount);
if (newMessageCount) {
channelAction->setIcon(QIcon(":/images/channels_new32.png")) ;
} else {
channelAction->setIcon(QIcon(IMAGE_CHANNELS)) ;
}
if (newMessageCount) {
if (newMessageCount > 1) {
trayIconChannels->setToolTip(tr("RetroShare") + "\n" + tr("You have %1 new messages").arg(newMessageCount));
} else {
trayIconChannels->setToolTip(tr("RetroShare") + "\n" + tr("You have %1 new message").arg(newMessageCount));
}
trayIconChannels->show();
} else {
trayIconChannels->hide();
}
}
void MainWindow::updateStatus()
{
// This call is essential to remove locks due to QEventLoop re-entrance while asking gpg passwds. Dont' remove it!
@ -831,6 +862,13 @@ void MainWindow::trayIconForumsClicked(QSystemTrayIcon::ActivationReason e)
}
}
void MainWindow::trayIconChannelsClicked(QSystemTrayIcon::ActivationReason e)
{
if(e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick) {
showWindow(MainWindow::Channels);
}
}
void MainWindow::trayIconChatClicked(QSystemTrayIcon::ActivationReason e)
{
if(e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick) {

View File

@ -141,6 +141,7 @@ public slots:
void checkAndSetIdle(int idleTime);
void updateMessages();
void updateForums();
void updateChannels(int type);
void privateChatChanged(int list, int type);
protected:
@ -161,6 +162,7 @@ private slots:
void toggleVisibilitycontextmenu();
void trayIconMessagesClicked(QSystemTrayIcon::ActivationReason e);
void trayIconForumsClicked(QSystemTrayIcon::ActivationReason e);
void trayIconChannelsClicked(QSystemTrayIcon::ActivationReason e);
void trayIconChatClicked(QSystemTrayIcon::ActivationReason e);
/** Toolbar fns. */
@ -225,6 +227,7 @@ private:
QSystemTrayIcon *trayIcon;
QSystemTrayIcon *trayIconMessages;
QSystemTrayIcon *trayIconForums;
QSystemTrayIcon *trayIconChannels;
QSystemTrayIcon *trayIconChat;
QAction *toggleVisibilityAction, *toolAct;
QMenu *trayMenu;
@ -238,6 +241,7 @@ private:
QAction *messageAction;
QAction *forumAction;
QAction *channelAction;
/* Status */
std::set <QObject*> m_apStatusObjects; // added objects for status
@ -254,4 +258,3 @@ private:
};
#endif

View File

@ -26,6 +26,7 @@
#include "FeedHolder.h"
#include "SubFileItem.h"
#include "gui/notifyqt.h"
#include <retroshare/rschannels.h>
@ -46,6 +47,8 @@ ChanMsgItem::ChanMsgItem(FeedHolder *parent, uint32_t feedId, std::string chanId
setAttribute ( Qt::WA_DeleteOnClose, true );
m_inUpdateItemStatic = false;
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
@ -55,13 +58,15 @@ ChanMsgItem::ChanMsgItem(FeedHolder *parent, uint32_t feedId, std::string chanId
connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) );
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) );
connect( readButton, SIGNAL( toggled(bool) ), this, SLOT( readToggled(bool) ) );
connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
downloadButton->hide();
playButton->hide();
small();
updateItemStatic();
updateItem();
}
@ -81,12 +86,15 @@ void ChanMsgItem::updateItemStatic()
if (!rsChannels->getChannelMessage(mChanId, mMsgId, cmi))
return;
m_inUpdateItemStatic = true;
QString title;
ChannelInfo ci;
rsChannels->getChannelInfo(mChanId, ci);
if (!mIsHome)
{
ChannelInfo ci;
rsChannels->getChannelInfo(mChanId, ci);
title = "Channel Feed: ";
title += QString::fromStdWString(ci.channelName);
titleLabel->setText(title);
@ -97,6 +105,8 @@ void ChanMsgItem::updateItemStatic()
} else {
unsubscribeButton->setEnabled(false);
}
readButton->setVisible(false);
newLabel->setVisible(false);
}
else
{
@ -109,8 +119,32 @@ void ChanMsgItem::updateItemStatic()
unsubscribeButton->setEnabled(false);
clearButton->hide();
unsubscribeButton->hide();
if ((ci.channelFlags & RS_DISTRIB_SUBSCRIBED) || (ci.channelFlags & RS_DISTRIB_ADMIN)) {
readButton->setVisible(true);
uint32_t status = 0;
rsChannels->getMessageStatus(mChanId, mMsgId, status);
if ((status & CHANNEL_MSG_STATUS_READ) == 0 || (status & CHANNEL_MSG_STATUS_UNREAD_BY_USER)) {
readButton->setChecked(true);
readButton->setIcon(QIcon(":/images/message-state-unread.png"));
} else {
readButton->setChecked(false);
readButton->setIcon(QIcon(":/images/message-state-read.png"));
}
if (status & CHANNEL_MSG_STATUS_READ) {
newLabel->setVisible(false);
} else {
newLabel->setVisible(true);
}
} else {
readButton->setVisible(false);
newLabel->setVisible(false);
}
}
msgLabel->setText(QString::fromStdWString(cmi.msg));
QDateTime qtime;
@ -155,6 +189,8 @@ void ChanMsgItem::updateItemStatic()
label->setPixmap(thumbnail);
label->setStyleSheet("QLabel#label{border: 2px solid #D3D3D3;border-radius: 3px;}");
}
m_inUpdateItemStatic = false;
}
@ -311,3 +347,28 @@ void ChanMsgItem::play()
}
}
}
void ChanMsgItem::readToggled(bool checked)
{
if (m_inUpdateItemStatic) {
return;
}
/* set always as read ... */
uint32_t statusNew = CHANNEL_MSG_STATUS_READ;
if (checked) {
/* ... and as unread by user */
statusNew |= CHANNEL_MSG_STATUS_UNREAD_BY_USER;
} else {
/* ... and as read by user */
statusNew &= ~CHANNEL_MSG_STATUS_UNREAD_BY_USER;
}
rsChannels->setMessageStatus(mChanId, mMsgId, statusNew, CHANNEL_MSG_STATUS_READ | CHANNEL_MSG_STATUS_UNREAD_BY_USER);
}
void ChanMsgItem::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status)
{
if (channelId.toStdString() == mChanId && msgId.toStdString() == mMsgId) {
updateItemStatic();
}
}

View File

@ -51,6 +51,9 @@ private slots:
void download();
void play();
void readToggled(bool checked);
void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
void updateItem();
private:
@ -61,11 +64,10 @@ private:
std::string mMsgId;
bool mIsHome;
bool m_inUpdateItemStatic;
std::list<SubFileItem *> mFileItems;
};
#endif

View File

@ -87,7 +87,7 @@ border-radius: 10px;}</string>
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/thumb-default-video.png</pixmap>
<pixmap>:/images/thumb-default-video.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
@ -114,7 +114,7 @@ border-radius: 10px;}</string>
</item>
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="7">
<item row="0" column="0" colspan="8">
<widget class="QLabel" name="titleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
@ -139,7 +139,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="0" column="7" colspan="3">
<item row="0" column="8" colspan="3">
<widget class="QLabel" name="datetimelabel">
<property name="font">
<font>
@ -156,7 +156,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="1" column="0" colspan="10">
<item row="1" column="0" colspan="11">
<widget class="QLabel" name="subjectLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
@ -182,7 +182,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="2" column="6" colspan="2">
<item row="2" column="7" colspan="2">
<widget class="QPushButton" name="unsubscribeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -197,12 +197,12 @@ p, li { white-space: pre-wrap; }
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset>
<normaloff>:/images/mail_delete.png</normaloff>:/images/mail_delete.png</iconset>
</property>
</widget>
</item>
<item row="2" column="8">
<item row="2" column="9">
<widget class="QPushButton" name="clearButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -217,12 +217,12 @@ p, li { white-space: pre-wrap; }
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset>
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
</property>
</widget>
</item>
<item row="2" column="9">
<item row="2" column="10">
<widget class="QPushButton" name="expandButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -240,7 +240,7 @@ p, li { white-space: pre-wrap; }
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset>
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
</property>
</widget>
@ -248,33 +248,33 @@ p, li { white-space: pre-wrap; }
<item row="2" column="1">
<widget class="QLabel" name="filelabel">
<property name="text">
<string notr="true">TextLabel</string>
<string notr="true">fileLabel</string>
</property>
</widget>
</item>
<item row="2" column="3">
<item row="2" column="4">
<widget class="QPushButton" name="downloadButton">
<property name="text">
<string>Download</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset>
<normaloff>:/images/download16.png</normaloff>:/images/download16.png</iconset>
</property>
</widget>
</item>
<item row="2" column="4">
<item row="2" column="5">
<widget class="QPushButton" name="playButton">
<property name="text">
<string>Play</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset>
<normaloff>:/images/player_play.png</normaloff>:/images/player_play.png</iconset>
</property>
</widget>
</item>
<item row="2" column="5">
<item row="2" column="6">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -290,6 +290,30 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="readButton">
<property name="icon">
<iconset>
<normaloff>:/images/message-state-unread.png</normaloff>:/images/message-state-unread.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="newLabel">
<property name="text">
<string>New</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -349,15 +373,6 @@ border-radius: 10px;}</string>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
</resources>
<resources/>
<connections/>
</ui>

View File

@ -58,6 +58,7 @@
<file>images/channels16.png</file>
<file>images/channels24.png</file>
<file>images/channels32.png</file>
<file>images/channels_new32.png</file>
<file>images/copyrslink.png</file>
<file>images/contacts24.png</file>
<file>images/connection.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -98,6 +98,11 @@ void NotifyQt::notifyPeerStatusChangedSummary()
emit peerStatusChangedSummary();
}
void NotifyQt::notifyChannelMsgReadSatusChanged(const std::string& channelId, const std::string& msgId, uint32_t status)
{
emit channelMsgReadSatusChanged(QString::fromStdString(channelId), QString::fromStdString(msgId), status);
}
void NotifyQt::notifyOwnStatusMessageChanged()
{
#ifdef NOTIFY_DEBUG
@ -226,6 +231,12 @@ void NotifyQt::notifyListChange(int list, int type)
#endif
emit forumsChanged(); // use connect with Qt::QueuedConnection
break;
case NOTIFY_LIST_CHANNELLIST_LOCKED:
#ifdef NOTIFY_DEBUG
std::cerr << "received channel msg changed" << std::endl ;
#endif
emit channelsChanged(type); // use connect with Qt::QueuedConnection
break;
case NOTIFY_LIST_PUBLIC_CHAT:
#ifdef NOTIFY_DEBUG
std::cerr << "received public chat changed" << std::endl ;

View File

@ -44,7 +44,8 @@ class NotifyQt: public QObject, public NotifyBase
virtual void notifyPeerStatusChanged(const std::string& peer_id, uint32_t state);
/* one or more peers has changed the states */
virtual void notifyPeerStatusChangedSummary();
virtual void notifyChannelMsgReadSatusChanged(const std::string& channelId, const std::string& msgId, uint32_t status);
virtual std::string askForPassword(const std::string& key_details,bool prev_is_bad) ;
/* Notify from GUI */
@ -63,6 +64,7 @@ class NotifyQt: public QObject, public NotifyBase
void messagesChanged() const ;
void messagesTagsChanged() const;
void forumsChanged() const ; // use connect with Qt::QueuedConnection
void channelsChanged(int type) const ; // use connect with Qt::QueuedConnection
void configChanged() const ;
void logInfoChanged(const QString&) const ;
void chatStatusChanged(const QString&,const QString&,bool) const ;
@ -78,6 +80,7 @@ class NotifyQt: public QObject, public NotifyBase
void publicChatChanged(int type) const ;
void privateChatChanged(int list, int type) const ;
void groupsChanged(int type) const ;
void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
/* Notify from GUI */
void chatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);

View File

@ -196,6 +196,7 @@ int main(int argc, char *argv[])
QObject::connect(notify,SIGNAL(messagesTagsChanged()) ,w->messagesDialog ,SLOT(messagesTagsChanged() )) ;
QObject::connect(notify,SIGNAL(messagesChanged()) ,w ,SLOT(updateMessages() )) ;
QObject::connect(notify,SIGNAL(forumsChanged()) ,w ,SLOT(updateForums() ), Qt::QueuedConnection);
QObject::connect(notify,SIGNAL(channelsChanged(int)) ,w ,SLOT(updateChannels(int) ), Qt::QueuedConnection);
QObject::connect(notify,SIGNAL(chatStatusChanged(const QString&,const QString&,bool)),w->peersDialog,SLOT(updatePeerStatusString(const QString&,const QString&,bool)));
QObject::connect(notify,SIGNAL(peerHasNewAvatar(const QString&)),w->peersDialog,SLOT(updatePeersAvatar(const QString&)));