Groups for friends in PeersDialog.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3523 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-09-22 22:37:57 +00:00
parent 8b1ffdb5d9
commit 077b2871f1
23 changed files with 1784 additions and 544 deletions

View File

@ -38,6 +38,7 @@ const int p3connectzone = 3431;
#include "serialiser/rsconfigitems.h"
#include "pqi/pqinotify.h"
#include "retroshare/rsiface.h"
#include <sstream>
@ -196,6 +197,8 @@ p3ConnectMgr::p3ConnectMgr()
mNetFlags = pqiNetStatus();
mOldNetFlags = pqiNetStatus();
lastGroupId = 1;
}
#ifdef CONN_DEBUG
@ -2194,53 +2197,62 @@ bool p3ConnectMgr::removeFriend(std::string id)
{
#ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::removeFriend() for id : " << id << std::endl;
std::cerr << "p3ConnectMgr::removeFriend() mFriendList.size() : " << mFriendList.size() << std::endl;
std::cerr << "p3ConnectMgr::removeFriend() for id : " << id << std::endl;
std::cerr << "p3ConnectMgr::removeFriend() mFriendList.size() : " << mFriendList.size() << std::endl;
#endif
netAssistFriend(id, false);
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
std::list<std::string> toRemove;
/* move to othersList */
bool success = false;
std::list<std::string> toRemove;
std::map<std::string, peerConnectState>::iterator it;
//remove ssl and gpg_ids
for(it = mFriendList.begin(); it != mFriendList.end(); it++)
{
if (it->second.id == id || it->second.gpg_id == id) {
{
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
/* move to othersList */
bool success = false;
std::map<std::string, peerConnectState>::iterator it;
//remove ssl and gpg_ids
for(it = mFriendList.begin(); it != mFriendList.end(); it++)
{
if (it->second.id == id || it->second.gpg_id == id) {
#ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::removeFriend() friend found in the list." << id << std::endl;
std::cerr << "p3ConnectMgr::removeFriend() friend found in the list." << id << std::endl;
#endif
peerConnectState peer = it->second;
peerConnectState peer = it->second;
toRemove.push_back(it->second.id);
toRemove.push_back(it->second.id);
peer.state &= (~RS_PEER_S_FRIEND);
peer.state &= (~RS_PEER_S_CONNECTED);
peer.state &= (~RS_PEER_S_ONLINE);
peer.actions = RS_PEER_MOVED;
peer.inConnAttempt = false;
mOthersList[id] = peer;
mStatusChanged = true;
peer.state &= (~RS_PEER_S_FRIEND);
peer.state &= (~RS_PEER_S_CONNECTED);
peer.state &= (~RS_PEER_S_ONLINE);
peer.actions = RS_PEER_MOVED;
peer.inConnAttempt = false;
mOthersList[id] = peer;
mStatusChanged = true;
success = true;
}
success = true;
}
}
std::list<std::string>::iterator toRemoveIt;
for(toRemoveIt = toRemove.begin(); toRemoveIt != toRemove.end(); toRemoveIt++) {
if (mFriendList.end() != (it = mFriendList.find(*toRemoveIt))) {
mFriendList.erase(it);
}
}
#ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::removeFriend() new mFriendList.size() : " << mFriendList.size() << std::endl;
#endif
}
std::list<std::string>::iterator toRemoveIt;
for(toRemoveIt = toRemove.begin(); toRemoveIt != toRemove.end(); toRemoveIt++) {
if (mFriendList.end() != (it = mFriendList.find(*toRemoveIt))) {
mFriendList.erase(it);
}
}
/* remove id from all groups */
std::list<std::string> peerIds;
peerIds.push_back(id);
assignPeersToGroup("", peerIds, false);
#ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::removeFriend() new mFriendList.size() : " << mFriendList.size() << std::endl;
#endif
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
return !toRemove.empty();
}
@ -2994,9 +3006,9 @@ std::list<RsItem *> p3ConnectMgr::saveList(bool &cleanup)
{
/* create a list of current peers */
std::list<RsItem *> saveData;
cleanup = true;
cleanup = false;
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
connMtx.lock(); /****** MUTEX LOCKED *******/
RsPeerNetItem *item = new RsPeerNetItem();
item->clear();
@ -3033,6 +3045,7 @@ std::list<RsItem *> p3ConnectMgr::saveList(bool &cleanup)
#endif
saveData.push_back(item);
saveCleanupList.push_back(item);
/* iterate through all friends and save */
std::map<std::string, peerConnectState>::iterator it;
@ -3054,6 +3067,7 @@ std::list<RsItem *> p3ConnectMgr::saveList(bool &cleanup)
(it->second).ipAddrs.mExt.loadTlv(item->extAddrList);
saveData.push_back(item);
saveCleanupList.push_back(item);
#ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::saveList() Peer Config Item:" << std::endl;
item->print(std::cerr, 10);
@ -3074,6 +3088,7 @@ std::list<RsItem *> p3ConnectMgr::saveList(bool &cleanup)
std::cout << "Pushing item for use_extr_addr_finder = " << mUseExtAddrFinder << std::endl ;
#endif
saveData.push_back(vitem);
saveCleanupList.push_back(vitem);
// Now save config for network digging strategies
@ -3088,10 +3103,33 @@ std::list<RsItem *> p3ConnectMgr::saveList(bool &cleanup)
std::cout << "Pushing item for allow_tunnel_connection = " << mAllowTunnelConnection << std::endl ;
#endif
saveData.push_back(vitem2);
saveCleanupList.push_back(vitem2);
/* save groups */
std::list<RsPeerGroupItem *>::iterator groupIt;
for (groupIt = groupList.begin(); groupIt != groupList.end(); groupIt++) {
saveData.push_back(*groupIt); // no delete
}
return saveData;
}
void p3ConnectMgr::saveDone()
{
/* clean up the save List */
std::list<RsItem *>::iterator it;
for(it = saveCleanupList.begin(); it != saveCleanupList.end(); it++)
{
delete (*it);
}
saveCleanupList.clear();
/* unlock mutex */
connMtx.unlock(); /****** MUTEX UNLOCKED *******/
}
bool p3ConnectMgr::loadList(std::list<RsItem *> load)
{
@ -3111,7 +3149,6 @@ bool p3ConnectMgr::loadList(std::list<RsItem *> load)
for(it = load.begin(); it != load.end(); it++)
{
RsPeerNetItem *pitem = dynamic_cast<RsPeerNetItem *>(*it);
RsConfigKeyValueSet *vitem = dynamic_cast<RsConfigKeyValueSet *>(*it) ;
if (pitem)
{
if (pitem->pid == ownId)
@ -3146,8 +3183,14 @@ bool p3ConnectMgr::loadList(std::list<RsItem *> load)
addrs.mLocal.extractFromTlv(pitem->localAddrList);
addrs.mExt.extractFromTlv(pitem->extAddrList);
updateAddressList(pitem->pid, addrs);
delete(*it);
continue;
}
else if(vitem)
RsConfigKeyValueSet *vitem = dynamic_cast<RsConfigKeyValueSet *>(*it) ;
if (vitem)
{
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
@ -3166,10 +3209,86 @@ bool p3ConnectMgr::loadList(std::list<RsItem *> load)
std::cerr << "setting allow_tunnel_connection to " << mAllowTunnelConnection << std::endl ;
}
}
delete(*it);
continue;
}
RsPeerGroupItem *gitem = dynamic_cast<RsPeerGroupItem *>(*it) ;
if (gitem)
{
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
#ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::loadList() Peer group item:" << std::endl;
gitem->print(std::cerr, 10);
std::cerr << std::endl;
#endif
groupList.push_back(gitem); // don't delete
if ((gitem->flag & RS_GROUP_FLAG_STANDARD) == 0) {
/* calculate group id */
uint32_t groupId = atoi(gitem->id.c_str());
if (groupId > lastGroupId) {
lastGroupId = groupId;
}
}
continue;
}
delete (*it);
}
{
/* set missing groupIds */
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
/* Standard groups */
const int standardGroupCount = 5;
const char *standardGroup[standardGroupCount] = { RS_GROUP_ID_FRIENDS, RS_GROUP_ID_FAMILY, RS_GROUP_ID_COWORKERS, RS_GROUP_ID_OTHERS, RS_GROUP_ID_FAVORITES };
bool foundStandardGroup[standardGroupCount] = { false, false, false, false, false };
std::list<RsPeerGroupItem *>::iterator groupIt;
for (groupIt = groupList.begin(); groupIt != groupList.end(); groupIt++) {
if ((*groupIt)->flag & RS_GROUP_FLAG_STANDARD) {
int i;
for (i = 0; i < standardGroupCount; i++) {
if ((*groupIt)->id == standardGroup[i]) {
foundStandardGroup[i] = true;
break;
}
}
if (i >= standardGroupCount) {
/* No more a standard group, remove the flag standard */
(*groupIt)->flag &= ~RS_GROUP_FLAG_STANDARD;
}
} else {
uint32_t groupId = atoi((*groupIt)->id.c_str());
if (groupId == 0) {
std::ostringstream out;
out << (lastGroupId++);
(*groupIt)->id = out.str();
}
}
}
/* Initialize standard groups */
for (int i = 0; i < standardGroupCount; i++) {
if (foundStandardGroup[i] == false) {
RsPeerGroupItem *gitem = new RsPeerGroupItem;
gitem->id = standardGroup[i];
gitem->name = standardGroup[i];
gitem->flag |= RS_GROUP_FLAG_STANDARD;
groupList.push_back(gitem);
}
}
}
return true;
}
@ -3399,10 +3518,203 @@ bool p3ConnectMgr::getDHTEnabled()
return netAssistConnectEnabled();
}
void p3ConnectMgr::getNetStatus(pqiNetStatus &status)
{
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
status = mNetFlags;
}
/**********************************************************************
**********************************************************************
************************** Groups ************************************
**********************************************************************
**********************************************************************/
bool p3ConnectMgr::addGroup(RsGroupInfo &groupInfo)
{
{
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
RsPeerGroupItem *groupItem = new RsPeerGroupItem;
groupItem->set(groupInfo);
std::ostringstream out;
out << (++lastGroupId);
groupItem->id = out.str();
// remove standard flag
groupItem->flag &= ~RS_GROUP_FLAG_STANDARD;
groupItem->PeerId(getOwnId());
groupList.push_back(groupItem);
}
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_ADD);
IndicateConfigChanged();
return true;
}
bool p3ConnectMgr::editGroup(const std::string &groupId, RsGroupInfo &groupInfo)
{
if (groupId.empty()) {
return false;
}
bool changed = false;
{
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
std::list<RsPeerGroupItem*>::iterator groupIt;
for (groupIt = groupList.begin(); groupIt != groupList.end(); groupIt++) {
if ((*groupIt)->id == groupId) {
break;
}
}
if (groupIt != groupList.end()) {
if ((*groupIt)->flag & RS_GROUP_FLAG_STANDARD) {
// can't edit standard groups
} else {
changed = true;
(*groupIt)->set(groupInfo);
}
}
}
if (changed) {
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_MOD);
IndicateConfigChanged();
}
return changed;
}
bool p3ConnectMgr::removeGroup(const std::string &groupId)
{
if (groupId.empty()) {
return false;
}
bool changed = false;
{
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
std::list<RsPeerGroupItem*>::iterator groupIt;
for (groupIt = groupList.begin(); groupIt != groupList.end(); groupIt++) {
if ((*groupIt)->id == groupId) {
break;
}
}
if (groupIt != groupList.end()) {
if ((*groupIt)->flag & RS_GROUP_FLAG_STANDARD) {
// can't remove standard groups
} else {
changed = true;
delete(*groupIt);
groupList.erase(groupIt);
}
}
}
if (changed) {
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_DEL);
IndicateConfigChanged();
}
return changed;
}
bool p3ConnectMgr::getGroupInfo(const std::string &groupId, RsGroupInfo &groupInfo)
{
if (groupId.empty()) {
return false;
}
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
std::list<RsPeerGroupItem*>::iterator groupIt;
for (groupIt = groupList.begin(); groupIt != groupList.end(); groupIt++) {
if ((*groupIt)->id == groupId) {
(*groupIt)->get(groupInfo);
return true;
}
}
return false;
}
bool p3ConnectMgr::getGroupInfoList(std::list<RsGroupInfo> &groupInfoList)
{
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
std::list<RsPeerGroupItem*>::iterator groupIt;
for (groupIt = groupList.begin(); groupIt != groupList.end(); groupIt++) {
RsGroupInfo groupInfo;
(*groupIt)->get(groupInfo);
groupInfoList.push_back(groupInfo);
}
return true;
}
// groupId == "" && assign == false -> remove from all groups
bool p3ConnectMgr::assignPeersToGroup(const std::string &groupId, const std::list<std::string> &peerIds, bool assign)
{
if (groupId.empty() && assign == true) {
return false;
}
if (peerIds.empty()) {
return false;
}
bool changed = false;
{
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
std::list<RsPeerGroupItem*>::iterator groupIt;
for (groupIt = groupList.begin(); groupIt != groupList.end(); groupIt++) {
if (groupId.empty() || (*groupIt)->id == groupId) {
RsPeerGroupItem *groupItem = *groupIt;
std::list<std::string>::const_iterator peerIt;
for (peerIt = peerIds.begin(); peerIt != peerIds.end(); peerIt++) {
std::list<std::string>::iterator peerIt1 = std::find(groupItem->peerIds.begin(), groupItem->peerIds.end(), *peerIt);
if (assign) {
if (peerIt1 == groupItem->peerIds.end()) {
groupItem->peerIds.push_back(*peerIt);
changed = true;
}
} else {
if (peerIt1 != groupItem->peerIds.end()) {
groupItem->peerIds.erase(peerIt1);
changed = true;
}
}
}
if (groupId.empty() == false) {
break;
}
}
}
}
if (changed) {
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_MOD);
IndicateConfigChanged();
}
return changed;
}

View File

@ -201,7 +201,8 @@ class pqiNetStatus
};
class p3tunnel;
class RsPeerGroupItem;
class RsGroupInfo;
std::string textPeerConnectState(peerConnectState &state);
@ -299,6 +300,13 @@ bool connectAttempt(std::string id, struct sockaddr_in &addr,
uint32_t &delay, uint32_t &period, uint32_t &type);
bool connectResult(std::string id, bool success, uint32_t flags, struct sockaddr_in remote_peer_address);
/******************** Groups **********************/
bool addGroup(RsGroupInfo &groupInfo);
bool editGroup(const std::string &groupId, RsGroupInfo &groupInfo);
bool removeGroup(const std::string &groupId);
bool getGroupInfo(const std::string &groupId, RsGroupInfo &groupInfo);
bool getGroupInfoList(std::list<RsGroupInfo> &groupInfoList);
bool assignPeersToGroup(const std::string &groupId, const std::list<std::string> &peerIds, bool assign);
protected:
@ -362,6 +370,7 @@ bool retryConnectTCP(std::string id);
/* Key Functions to be overloaded for Full Configuration */
virtual RsSerialiser *setupSerialiser();
virtual std::list<RsItem *> saveList(bool &cleanup);
virtual void saveDone();
virtual bool loadList(std::list<RsItem *> load);
/*****************************************************************/
@ -408,6 +417,11 @@ void netStatusReset_locked();
std::map<std::string, peerConnectState> mFriendList;
std::map<std::string, peerConnectState> mOthersList;
std::list<RsPeerGroupItem *> groupList;
uint32_t lastGroupId;
std::list<RsItem *> saveCleanupList; /* TEMPORARY LIST WHEN SAVING */
};
#endif // MRK_PQI_CONNECTION_MANAGER_HEADER

View File

@ -230,6 +230,7 @@ const int NOTIFY_LIST_MESSAGE_TAGS = 12;
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_TYPE_SAME = 0x01;
const int NOTIFY_TYPE_MOD = 0x02; /* general purpose, check all */

View File

@ -61,6 +61,15 @@ const uint32_t RS_PEER_STATE_ONLINE = 0x0002;
const uint32_t RS_PEER_STATE_CONNECTED = 0x0004;
const uint32_t RS_PEER_STATE_UNREACHABLE= 0x0008;
/* Groups */
#define RS_GROUP_ID_FRIENDS "Friends"
#define RS_GROUP_ID_FAMILY "Family"
#define RS_GROUP_ID_COWORKERS "Co-Workers"
#define RS_GROUP_ID_OTHERS "Other Contacts"
#define RS_GROUP_ID_FAVORITES "Favorites"
const uint32_t RS_GROUP_FLAG_STANDARD = 0x0001;
/* A couple of helper functions for translating the numbers games */
std::string RsPeerTrustString(uint32_t trustLvl);
@ -119,6 +128,18 @@ class RsPeerDetails
uint32_t connectPeriod;
};
class RsGroupInfo
{
public:
RsGroupInfo();
std::string id;
std::string name;
uint32_t flag;
std::list<std::string> peerIds;
};
std::ostream &operator<<(std::ostream &out, const RsPeerDetails &detail);
class RsPeers
@ -191,6 +212,16 @@ virtual bool setAcceptToConnectGPGCertificate(std::string gpg_id, bool acceptanc
virtual bool signGPGCertificate(std::string gpg_id) = 0;
virtual bool trustGPGCertificate(std::string gpg_id, uint32_t trustlvl) = 0;
/* Group Stuff */
virtual bool addGroup(RsGroupInfo &groupInfo) = 0;
virtual bool editGroup(const std::string &groupId, RsGroupInfo &groupInfo) = 0;
virtual bool removeGroup(const std::string &groupId) = 0;
virtual bool getGroupInfo(const std::string &groupId, RsGroupInfo &groupInfo) = 0;
virtual bool getGroupInfoList(std::list<RsGroupInfo> &groupInfoList) = 0;
// groupId == "" && assign == false -> remove from all groups
virtual bool assignPeerToGroup(const std::string &groupId, const std::string &peerId, bool assign) = 0;
virtual bool assignPeersToGroup(const std::string &groupId, const std::list<std::string> &peerIds, bool assign) = 0;
};
#endif

View File

@ -1150,8 +1150,68 @@ int ensureExtension(std::string &name, std::string def_ext)
return 1;
}
/* Group Stuff */
bool p3Peers::addGroup(RsGroupInfo &groupInfo)
{
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::addGroup()" << std::endl;
#endif
return mConnMgr->addGroup(groupInfo);
}
bool p3Peers::editGroup(const std::string &groupId, RsGroupInfo &groupInfo)
{
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::editGroup()" << std::endl;
#endif
return mConnMgr->editGroup(groupId, groupInfo);
}
bool p3Peers::removeGroup(const std::string &groupId)
{
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::removeGroup()" << std::endl;
#endif
return mConnMgr->removeGroup(groupId);
}
bool p3Peers::getGroupInfo(const std::string &groupId, RsGroupInfo &groupInfo)
{
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::getGroupInfo()" << std::endl;
#endif
return mConnMgr->getGroupInfo(groupId, groupInfo);
}
bool p3Peers::getGroupInfoList(std::list<RsGroupInfo> &groupInfoList)
{
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::getGroupInfoList()" << std::endl;
#endif
return mConnMgr->getGroupInfoList(groupInfoList);
}
bool p3Peers::assignPeerToGroup(const std::string &groupId, const std::string &peerId, bool assign)
{
std::list<std::string> peerIds;
peerIds.push_back(peerId);
return assignPeersToGroup(groupId, peerIds, assign);
}
bool p3Peers::assignPeersToGroup(const std::string &groupId, const std::list<std::string> &peerIds, bool assign)
{
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::assignPeersToGroup()" << std::endl;
#endif
return mConnMgr->assignPeersToGroup(groupId, peerIds, assign);
}
RsPeerDetails::RsPeerDetails()
@ -1214,3 +1274,8 @@ std::ostream &operator<<(std::ostream &out, const RsPeerDetails &detail)
return out;
}
RsGroupInfo::RsGroupInfo()
{
flag = 0;
}

View File

@ -101,6 +101,15 @@ virtual bool setAcceptToConnectGPGCertificate(std::string gpg_id, bool acceptanc
virtual bool signGPGCertificate(std::string id);
virtual bool trustGPGCertificate(std::string id, uint32_t trustlvl);
/* Group Stuff */
virtual bool addGroup(RsGroupInfo &groupInfo);
virtual bool editGroup(const std::string &groupId, RsGroupInfo &groupInfo);
virtual bool removeGroup(const std::string &groupId);
virtual bool getGroupInfo(const std::string &groupId, RsGroupInfo &groupInfo);
virtual bool getGroupInfoList(std::list<RsGroupInfo> &groupInfoList);
virtual bool assignPeerToGroup(const std::string &groupId, const std::string &peerId, bool assign);
virtual bool assignPeersToGroup(const std::string &groupId, const std::list<std::string> &peerIds, bool assign);
private:
p3ConnectMgr *mConnMgr;

View File

@ -26,6 +26,7 @@
#include "serialiser/rsbaseserial.h"
#include "serialiser/rsconfigitems.h"
#include "retroshare/rspeers.h"
/***
#define RSSERIAL_DEBUG 1
@ -664,6 +665,7 @@ uint32_t RsPeerConfigSerialiser::size(RsItem *i)
RsPeerOldNetItem *oldpni;
RsPeerStunItem *psi;
RsPeerNetItem *pni;
RsPeerGroupItem *pgi;
if (NULL != (oldpni = dynamic_cast<RsPeerOldNetItem *>(i)))
{
@ -677,6 +679,10 @@ uint32_t RsPeerConfigSerialiser::size(RsItem *i)
{
return sizeStun(psi);
}
else if (NULL != (pgi = dynamic_cast<RsPeerGroupItem *>(i)))
{
return sizeGroup(pgi);
}
return 0;
}
@ -687,6 +693,7 @@ bool RsPeerConfigSerialiser::serialise(RsItem *i, void *data, uint32_t *pktsi
RsPeerOldNetItem *oldpni;
RsPeerNetItem *pni;
RsPeerStunItem *psi;
RsPeerGroupItem *pgi;
if (NULL != (oldpni = dynamic_cast<RsPeerOldNetItem *>(i)))
{
@ -700,6 +707,10 @@ bool RsPeerConfigSerialiser::serialise(RsItem *i, void *data, uint32_t *pktsi
{
return serialiseStun(psi, data, pktsize);
}
else if (NULL != (pgi = dynamic_cast<RsPeerGroupItem *>(i)))
{
return serialiseGroup(pgi, data, pktsize);
}
return false;
}
@ -726,16 +737,14 @@ RsItem *RsPeerConfigSerialiser::deserialise(void *data, uint32_t *pktsize)
old = deserialiseOldNet(data, pktsize);
/* upgrade mechanism */
return convertToNetItem(old);
break;
case RS_PKT_SUBTYPE_PEER_NET:
return deserialiseNet(data, pktsize);
break;
case RS_PKT_SUBTYPE_PEER_STUN:
return deserialiseStun(data, pktsize);
break;
case RS_PKT_SUBTYPE_PEER_GROUP:
return deserialiseGroup(data, pktsize);
default:
return NULL;
break;
}
return NULL;
}
@ -1302,6 +1311,186 @@ RsPeerStunItem *RsPeerConfigSerialiser::deserialiseStun(void *data, uint32_t *si
return item;
}
/*************************************************************************/
RsPeerGroupItem::RsPeerGroupItem() : RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG, RS_PKT_TYPE_PEER_CONFIG, RS_PKT_SUBTYPE_PEER_GROUP)
{
}
RsPeerGroupItem::~RsPeerGroupItem()
{
}
void RsPeerGroupItem::clear()
{
id.clear();
name.clear();
flag = 0;
peerIds.clear();
}
std::ostream &RsPeerGroupItem::print(std::ostream &out, uint16_t indent)
{
printRsItemBase(out, "RsPeerGroupItem", indent);
uint16_t int_Indent = indent + 2;
printIndent(out, int_Indent);
out << "groupId: " << id << std::endl;
printIndent(out, int_Indent);
out << "groupName: " << name << std::endl;
printIndent(out, int_Indent);
out << "groupFlag: " << flag << std::endl;
std::list<std::string>::iterator it;
for (it = peerIds.begin(); it != peerIds.end(); it++) {
printIndent(out, int_Indent);
out << "peerId: " << *it << std::endl;
}
printRsItemEnd(out, "RsPeerGroupItem", indent);
return out;
}
/* set data from RsGroupInfo to RsPeerGroupItem */
void RsPeerGroupItem::set(RsGroupInfo &groupInfo)
{
id = groupInfo.id;
name = groupInfo.name;
flag = groupInfo.flag;
peerIds = groupInfo.peerIds;
}
/* get data from RsGroupInfo to RsPeerGroupItem */
void RsPeerGroupItem::get(RsGroupInfo &groupInfo)
{
groupInfo.id = id;
groupInfo.name = name;
groupInfo.flag = flag;
groupInfo.peerIds = peerIds;
}
/*************************************************************************/
uint32_t RsPeerConfigSerialiser::sizeGroup(RsPeerGroupItem *i)
{
uint32_t s = 8; /* header */
s += 4; /* version */
s += GetTlvStringSize(i->id);
s += GetTlvStringSize(i->name);
s += 4; /* flag */
std::list<std::string>::iterator it;
for (it = i->peerIds.begin(); it != i->peerIds.end(); it++) {
s += GetTlvStringSize(*it);
}
return s;
}
bool RsPeerConfigSerialiser::serialiseGroup(RsPeerGroupItem *item, void *data, uint32_t *size)
{
uint32_t tlvsize = RsPeerConfigSerialiser::sizeGroup(item);
uint32_t offset = 0;
if(*size < tlvsize)
return false; /* not enough space */
*size = tlvsize;
bool ok = true;
// serialise header
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
#ifdef RSSERIAL_DEBUG
std::cerr << "RsPeerConfigSerialiser::serialiseGroup() Header: " << ok << std::endl;
std::cerr << "RsPeerConfigSerialiser::serialiseGroup() Header: " << tlvsize << std::endl;
#endif
/* skip the header */
offset += 8;
/* add mandatory parts first */
ok &= setRawUInt32(data, tlvsize, &offset, 0);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_KEY, item->id);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, item->name);
ok &= setRawUInt32(data, tlvsize, &offset, item->flag);
std::list<std::string>::iterator it;
for (it = item->peerIds.begin(); it != item->peerIds.end(); it++) {
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_PEERID, *it);
}
if(offset != tlvsize)
{
ok = false;
#ifdef RSSERIAL_DEBUG
std::cerr << "RsPeerConfigSerialiser::serialiseGroup() Size Error! " << std::endl;
#endif
}
return ok;
}
RsPeerGroupItem *RsPeerConfigSerialiser::deserialiseGroup(void *data, uint32_t *size)
{
/* get the type and size */
uint32_t rstype = getRsItemId(data);
uint32_t rssize = getRsItemSize(data);
uint32_t offset = 0;
if ((RS_PKT_VERSION1 != getRsItemVersion(rstype)) ||
(RS_PKT_CLASS_CONFIG != getRsItemClass(rstype)) ||
(RS_PKT_TYPE_PEER_CONFIG != getRsItemType(rstype)) ||
(RS_PKT_SUBTYPE_PEER_GROUP != getRsItemSubType(rstype)))
{
return NULL; /* wrong type */
}
if (*size < rssize) /* check size */
return NULL; /* not enough data */
/* set the packet length */
*size = rssize;
bool ok = true;
RsPeerGroupItem *item = new RsPeerGroupItem();
item->clear();
/* skip the header */
offset += 8;
/* get mandatory parts first */
uint32_t version;
ok &= getRawUInt32(data, rssize, &offset, &version);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_KEY, item->id);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, item->name);
ok &= getRawUInt32(data, rssize, &offset, &(item->flag));
std::string peerId;
while (offset != rssize) {
peerId.erase();
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_PEERID, peerId);
item->peerIds.push_back(peerId);
}
if (offset != rssize)
{
/* error */
delete item;
return NULL;
}
return item;
}
/****************************************************************************/

View File

@ -35,6 +35,8 @@
#include "serialiser/rstlvtypes.h"
#include "serialiser/rstlvaddrs.h"
class RsGroupInfo;
const uint8_t RS_PKT_TYPE_GENERAL_CONFIG = 0x01;
const uint8_t RS_PKT_TYPE_PEER_CONFIG = 0x02;
const uint8_t RS_PKT_TYPE_CACHE_CONFIG = 0x03;
@ -44,9 +46,10 @@ const uint8_t RS_PKT_TYPE_FILE_CONFIG = 0x04;
const uint8_t RS_PKT_SUBTYPE_KEY_VALUE = 0x01;
/* PEER CONFIG SUBTYPES */
const uint8_t RS_PKT_SUBTYPE_PEER_OLD_NET = 0x01;
const uint8_t RS_PKT_SUBTYPE_PEER_STUN = 0x02;
const uint8_t RS_PKT_SUBTYPE_PEER_NET = 0x03; /* replacement for OLD_NET */
const uint8_t RS_PKT_SUBTYPE_PEER_OLD_NET = 0x01;
const uint8_t RS_PKT_SUBTYPE_PEER_STUN = 0x02;
const uint8_t RS_PKT_SUBTYPE_PEER_NET = 0x03; /* replacement for OLD_NET */
const uint8_t RS_PKT_SUBTYPE_PEER_GROUP = 0x04;
/* FILE CONFIG SUBTYPES */
const uint8_t RS_PKT_SUBTYPE_FILE_TRANSFER = 0x01;
@ -114,6 +117,28 @@ std::ostream &print(std::ostream &out, uint16_t indent = 0);
RsTlvIpAddrSet extAddrList;
};
class RsPeerGroupItem : public RsItem
{
public:
RsPeerGroupItem();
virtual ~RsPeerGroupItem();
virtual void clear();
std::ostream &print(std::ostream &out, uint16_t indent = 0);
/* set data from RsGroupInfo to RsPeerGroupItem */
void set(RsGroupInfo &groupInfo);
/* get data from RsGroupInfo to RsPeerGroupItem */
void get(RsGroupInfo &groupInfo);
/* Mandatory */
std::string id;
std::string name;
uint32_t flag;
std::list<std::string> peerIds;
};
class RsPeerStunItem: public RsItem
{
@ -160,6 +185,10 @@ virtual uint32_t sizeStun(RsPeerStunItem *);
virtual bool serialiseStun (RsPeerStunItem *item, void *data, uint32_t *size);
virtual RsPeerStunItem * deserialiseStun(void *data, uint32_t *size);
virtual uint32_t sizeGroup(RsPeerGroupItem *);
virtual bool serialiseGroup (RsPeerGroupItem *item, void *data, uint32_t *size);
virtual RsPeerGroupItem * deserialiseGroup(void *data, uint32_t *size);
};
/**************************************************************************/

View File

@ -281,6 +281,7 @@ HEADERS += rshare.h \
gui/common/html.h \
gui/common/StatusDefs.h \
gui/common/TagDefs.h \
gui/common/GroupDefs.h \
gui/common/Emoticons.h \
gui/common/RSTreeWidgetItem.h \
gui/MessagesDialog.h \
@ -478,6 +479,7 @@ SOURCES += main.cpp \
gui/common/html.cpp \
gui/common/StatusDefs.cpp \
gui/common/TagDefs.cpp \
gui/common/GroupDefs.cpp \
gui/common/Emoticons.cpp \
gui/common/RSTreeWidgetItem.cpp \
gui/settings/rsharesettings.cpp \

File diff suppressed because it is too large Load Diff

View File

@ -53,46 +53,48 @@ class RSTreeWidgetItemCompareRole;
class PeersDialog : public RsAutoUpdatePage
{
Q_OBJECT
Q_OBJECT
public:
/** Default Constructor */
PeersDialog(QWidget *parent = 0);
/** Default Destructor */
~PeersDialog ();
/** Default Constructor */
PeersDialog(QWidget *parent = 0);
/** Default Destructor */
~PeersDialog ();
// void setChatDialog(ChatDialog *cd);
// void setChatDialog(ChatDialog *cd);
virtual void updateDisplay() ; // overloaded from RsAutoUpdatePage
// replaced by shortcut
// virtual void keyPressEvent(QKeyEvent *) ;
virtual void updateDisplay() ; // overloaded from RsAutoUpdatePage
// replaced by shortcut
// virtual void keyPressEvent(QKeyEvent *) ;
public slots:
void insertPeers();
void publicChatChanged(int type);
void toggleSendItem( QTreeWidgetItem *item, int col );
void insertPeers();
void publicChatChanged(int type);
void toggleSendItem( QTreeWidgetItem *item, int col );
void insertChat();
void setChatInfo(QString info, QColor color=QApplication::palette().color(QPalette::WindowText));
void resetStatusBar() ;
void insertChat();
void setChatInfo(QString info, QColor color=QApplication::palette().color(QPalette::WindowText));
void resetStatusBar() ;
void fileHashingFinished(AttachFileItem* file);
void fileHashingFinished(AttachFileItem* file);
void smileyWidgetgroupchat();
void addSmileys();
void smileyWidgetgroupchat();
void addSmileys();
void on_actionClearChat_triggered();
void on_actionMessageHistory_triggered();
void on_actionClearChat_triggered();
void on_actionMessageHistory_triggered();
void displayInfoChatMenu(const QPoint& pos);
void displayInfoChatMenu(const QPoint& pos);
// called by notifyQt when another peer is typing (in group chant and private chat)
void updatePeerStatusString(const QString& peer_id,const QString& status_string,bool is_private_chat) ;
// called by notifyQt when another peer is typing (in group chant and private chat)
void updatePeerStatusString(const QString& peer_id,const QString& status_string,bool is_private_chat) ;
void updatePeersAvatar(const QString& peer_id);
void updateAvatar(); // called by notifyQt to update the avatar when it gets changed by another component
void groupsChanged(int type);
void updatePeersAvatar(const QString& peer_id);
void updateAvatar(); // called by notifyQt to update the avatar when it gets changed by another component
protected:
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event);
@ -100,108 +102,112 @@ protected:
void showEvent (QShowEvent *event);
private slots:
void pasteLink() ;
void contextMenu(QPoint) ;
void pasteLink() ;
void contextMenu(QPoint) ;
/** Create the context popup menu and it's submenus */
void peertreeWidgetCostumPopupMenu( QPoint point );
/** Create the context popup menu and it's submenus */
void peertreeWidgetCostumPopupMenu( QPoint point );
void updateStatusString(const QString& peer_id, const QString& statusString) ; // called when a peer is typing in group chat
void updateStatusTyping() ; // called each time a key is hit
void updateStatusString(const QString& peer_id, const QString& statusString) ; // called when a peer is typing in group chat
void updateStatusTyping() ; // called each time a key is hit
//void updatePeerStatusString(const QString& peer_id,const QString& chat_status) ;
//void updatePeerStatusString(const QString& peer_id,const QString& chat_status) ;
/** Export friend in Friends Dialog */
void exportfriend();
/** Remove friend */
void removefriend();
/** start a chat with a friend **/
void chatfriend(QTreeWidgetItem* );
void chatfriendproxy();
void msgfriend();
void recommendfriend();
void pastePerson();
/** Export friend in Friends Dialog */
void exportfriend();
/** Remove friend */
void removefriend();
/** start a chat with a friend **/
void chatfriend(QTreeWidgetItem* );
void chatfriendproxy();
void msgfriend();
void recommendfriend();
void pastePerson();
void addToGroup();
void moveToGroup();
void removeFromGroup();
void removeGroup();
void configurefriend();
void viewprofile();
void configurefriend();
void viewprofile();
/** RsServer Friend Calls */
void connectfriend();
/** RsServer Friend Calls */
void connectfriend();
void setColor();
void insertSendList();
void sendMsg();
void setColor();
void insertSendList();
void sendMsg();
void statusmessage();
void statusmessage();
void setFont();
void getFont();
void underline();
void setFont();
void getFont();
void underline();
void changeAvatarClicked();
void getAvatar();
void changeAvatarClicked();
void getAvatar();
void on_actionAdd_Friend_activated();
void on_actionAdd_Group_activated();
void on_actionCreate_New_Forum_activated();
void on_actionCreate_New_Channel_activated();
void on_actionAdd_Friend_activated();
void on_actionAdd_Group_activated();
void on_actionCreate_New_Forum_activated();
void on_actionCreate_New_Channel_activated();
void loadmypersonalstatus();
void addExtraFile();
void anchorClicked (const QUrl &);
void addAttachment(std::string);
bool fileSave();
bool fileSaveAs();
void loadmypersonalstatus();
void setCurrentFileName(const QString &fileName);
void displayMenu();
void statusColumn();
void addExtraFile();
void anchorClicked (const QUrl &);
void addAttachment(std::string);
bool fileSave();
bool fileSaveAs();
void setCurrentFileName(const QString &fileName);
void displayMenu();
void statusColumn();
signals:
void friendsUpdated() ;
void notifyGroupChat(const QString&,const QString&) ;
void friendsUpdated() ;
void notifyGroupChat(const QString&,const QString&) ;
private:
void processSettings(bool bLoad);
void addChatMsg(bool incoming, bool history, QString &name, QDateTime &sendTime, QString &message);
void processSettings(bool bLoad);
void addChatMsg(bool incoming, bool history, QString &name, QDateTime &sendTime, QString &message);
class QLabel *iconLabel, *textLabel;
class QWidget *widget;
class QWidgetAction *widgetAction;
class QSpacerItem *spacerItem;
class QLabel *iconLabel, *textLabel;
class QWidget *widget;
class QWidgetAction *widgetAction;
class QSpacerItem *spacerItem;
RSTreeWidgetItemCompareRole *m_compareRole;
RSTreeWidgetItemCompareRole *m_compareRole;
///play the sound when recv a message
void playsound();
///play the sound when recv a message
void playsound();
QString fileName;
QString fileName;
bool groupsHasChanged;
std::list<std::string> openGroups;
/* Worker Functions */
/* (1) Update Display */
/* Worker Functions */
/* (1) Update Display */
/* (2) Utility Fns */
QTreeWidgetItem *getCurrentPeer();
/* (2) Utility Fns */
QTreeWidgetItem *getCurrentPeer();
/** Defines the actions for the context menu */
QAction* pasteLinkAct;
/** Defines the actions for the context menu */
QAction* pasteLinkAct;
IMHistoryKeeper historyKeeper;
ChatStyle style;
IMHistoryKeeper historyKeeper;
ChatStyle style;
QColor _currentColor;
bool _underline;
time_t last_status_send_time ;
QColor _currentColor;
bool _underline;
time_t last_status_send_time ;
QFont mCurrentFont; /* how the text will come out */
QFont mCurrentFont; /* how the text will come out */
/** Qt Designer generated object */
Ui::PeersDialog ui;
/** Qt Designer generated object */
Ui::PeersDialog ui;
};
#endif // MINIMAL_RSGUI

View File

@ -0,0 +1,65 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2010, RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QCoreApplication>
#include <retroshare/rspeers.h>
#include <iostream>
#include <algorithm>
#include "GroupDefs.h"
const QString GroupDefs::name(const RsGroupInfo &groupInfo)
{
if ((groupInfo.flag & RS_GROUP_FLAG_STANDARD) == 0) {
/* no need to be translated */
return QString::fromUtf8(groupInfo.name.c_str());
}
if (groupInfo.id == RS_GROUP_ID_FRIENDS) {
return qApp->translate("GroupDefs", "Friends");
}
if (groupInfo.id == RS_GROUP_ID_FAMILY) {
return qApp->translate("GroupDefs", "Family");
}
if (groupInfo.id == RS_GROUP_ID_COWORKERS) {
return qApp->translate("GroupDefs", "Co-Workers");
}
if (groupInfo.id == RS_GROUP_ID_OTHERS) {
return qApp->translate("GroupDefs", "Other Contacts");
}
if (groupInfo.id == RS_GROUP_ID_FAVORITES) {
return qApp->translate("GroupDefs", "Favorites");
}
std::cerr << "GroupDefs::name: Unknown group id requested " << groupInfo.id;
return "";
}
static bool sortGroupInfo(const RsGroupInfo &groupInfo1, const RsGroupInfo &groupInfo2)
{
return (GroupDefs::name(groupInfo1).compare(GroupDefs::name(groupInfo2), Qt::CaseInsensitive) < 0);
}
void GroupDefs::sortByName(std::list<RsGroupInfo> &groupInfoList)
{
groupInfoList.sort(sortGroupInfo);
}

View File

@ -0,0 +1,37 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2010, RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _GROUPDEFS_H
#define _GROUPDEFS_H
class RsGroupInfo;
class GroupDefs
{
public:
static const QString name(const RsGroupInfo &groupInfo);
static void sortByName(std::list<RsGroupInfo> &groupInfoList);
};
#endif

View File

@ -19,16 +19,42 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QPushButton>
#include <retroshare/rspeers.h>
#include "CreateGroup.h"
#include "gui/common/GroupDefs.h"
/** Default constructor */
CreateGroup::CreateGroup(QWidget *parent, Qt::WFlags flags)
CreateGroup::CreateGroup(const std::string groupId, QWidget *parent, Qt::WFlags flags)
: QDialog(parent, flags)
{
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
m_groupId = groupId;
if (m_groupId.empty() == false) {
/* edit exisiting group */
RsGroupInfo groupInfo;
if (rsPeers->getGroupInfo(m_groupId, groupInfo)) {
ui.groupname->setText(QString::fromUtf8(groupInfo.name.c_str()));
} else {
/* Group not found, create new */
m_groupId.clear();
}
}
std::list<RsGroupInfo> groupInfoList;
rsPeers->getGroupInfoList(groupInfoList);
std::list<RsGroupInfo>::iterator groupIt;
for (groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); groupIt++) {
usedGroupNames.append(GroupDefs::name(*groupIt));
}
on_groupname_textChanged(ui.groupname->text());
}
/** Destructor. */
@ -36,3 +62,31 @@ CreateGroup::~CreateGroup()
{
}
void CreateGroup::on_groupname_textChanged(QString text)
{
if (text.isEmpty() || usedGroupNames.contains(text)) {
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
} else {
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
}
}
void CreateGroup::on_buttonBox_accepted()
{
RsGroupInfo groupInfo;
if (m_groupId.empty()) {
// add new group
groupInfo.name = ui.groupname->text().toUtf8().constData();
if (rsPeers->addGroup(groupInfo)) {
close();
}
} else {
if (rsPeers->getGroupInfo(m_groupId, groupInfo) == true) {
groupInfo.name = ui.groupname->text().toUtf8().constData();
if (rsPeers->editGroup(m_groupId, groupInfo)) {
close();
}
}
}
}

View File

@ -28,25 +28,29 @@
class CreateGroup : public QDialog
{
Q_OBJECT
Q_OBJECT
public:
/** Default constructor */
CreateGroup(QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default destructor */
~CreateGroup();
/** Default constructor */
CreateGroup(const std::string groupId, QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default destructor */
~CreateGroup();
public slots:
private slots:
private:
std::string m_groupId;
/** Qt Designer generated object */
Ui::CreateGroup ui;
QStringList usedGroupNames;
/** Qt Designer generated object */
Ui::CreateGroup ui;
private slots:
void on_buttonBox_accepted();
void on_groupname_textChanged(QString );
};
#endif

View File

@ -114,11 +114,7 @@ p, li { white-space: pre-wrap; }
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Arial'; font-size:9pt;&quot;&gt;Group Name&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>Group Name</string>
</property>
</widget>
</item>
@ -177,9 +173,6 @@ p, li { white-space: pre-wrap; }
</widget>
<resources>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections>
<connection>

View File

@ -226,6 +226,7 @@
<file>images/informations_24x24.png</file>
<file>images/invite-friend24.png</file>
<file>images/connect_friend.png</file>
<file>images/group24.png</file>
<file>images/kalarm.png</file>
<file>images/kbackgammon.png</file>
<file>images/kblogger.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -239,6 +239,12 @@ void NotifyQt::notifyListChange(int list, int type)
#endif
emit privateChatChanged(list, type);
break;
case NOTIFY_LIST_GROUPLIST:
#ifdef NOTIFY_DEBUG
std::cerr << "received groups changed" << std::endl ;
#endif
emit groupsChanged(type);
break;
default:
break;
}

View File

@ -77,6 +77,7 @@ class NotifyQt: public QObject, public NotifyBase
void peerStatusChangedSummary() const;
void publicChatChanged(int type) const ;
void privateChatChanged(int list, int type) const ;
void groupsChanged(int type) const ;
/* Notify from GUI */
void chatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);

View File

@ -2405,7 +2405,7 @@ p, li { white-space: pre-wrap; }
<message>
<location filename="../gui/groups/CreateGroup.ui" line="+14"/>
<source>Create a Group</source>
<translation type="unfinished"></translation>
<translation>Gruppe erstellen</translation>
</message>
<message>
<location line="+72"/>
@ -2414,21 +2414,22 @@ p, li { white-space: pre-wrap; }
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:18pt; font-weight:600; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:400; color:#ffffff;&quot;&gt;Create a Group&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
<translatorcomment>ruppe erstellen</translatorcomment>
<translation>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:18pt; font-weight:600; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:400; color:#ffffff;&quot;&gt;Gruppe erstellen&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location line="+31"/>
<source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:&apos;Arial&apos;; font-size:9pt;&quot;&gt;Group Name&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
<source>Group Name</source>
<translation>Name</translation>
</message>
<message>
<location line="+11"/>
<location line="+7"/>
<source>Enter a name for your group</source>
<translation type="unfinished"></translation>
<translation>Gib einen Namen für Deine Gruppe ein</translation>
</message>
</context>
<context>
@ -4098,6 +4099,34 @@ Fill in your GPG password when asked, to sign your new key.</source>
<translation></translation>
</message>
</context>
<context>
<name>GroupDefs</name>
<message>
<location filename="../gui/common/GroupDefs.cpp" line="+38"/>
<source>Friends</source>
<translation>Freunde</translation>
</message>
<message>
<location line="+3"/>
<source>Family</source>
<translation>Familie</translation>
</message>
<message>
<location line="+3"/>
<source>Co-Workers</source>
<translation>Mitarbeiter</translation>
</message>
<message>
<location line="+3"/>
<source>Other Contacts</source>
<translation>Andere Kontakte</translation>
</message>
<message>
<location line="+3"/>
<source>Favorites</source>
<translation>Favoriten</translation>
</message>
</context>
<context>
<name>HelpBrowser</name>
<message>
@ -4781,16 +4810,17 @@ p, li { white-space: pre-wrap; }
<translation>Kanäle</translation>
</message>
<message>
<location line="+4"/>
<source>Blogs</source>
<translation type="obsolete">Blogs</translation>
<translation type="unfinished">Blogs</translation>
</message>
<message>
<location line="+540"/>
<location line="+539"/>
<source>Internal Error</source>
<translation>Interener Fehler</translation>
</message>
<message>
<location filename="../gui/MainWindow.ui" line="+83"/>
<location filename="../gui/MainWindow.ui" line="+82"/>
<location filename="../gui/MainWindow.cpp" line="-43"/>
<source>Options</source>
<translation>Optionen</translation>
@ -4815,12 +4845,12 @@ p, li { white-space: pre-wrap; }
<translation></translation>
</message>
<message>
<location filename="../gui/MainWindow.ui" line="-69"/>
<location filename="../gui/MainWindow.ui" line="-68"/>
<source>MainWindow</source>
<translation>Hauptfenster</translation>
</message>
<message>
<location line="+48"/>
<location line="+47"/>
<source>Add Friend</source>
<translation>Freund hinzufügen</translation>
</message>
@ -4841,12 +4871,7 @@ p, li { white-space: pre-wrap; }
<translation>Schnellstart Assistent</translation>
</message>
<message>
<location line="+9"/>
<source>Add Group</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/MainWindow.cpp" line="-261"/>
<location filename="../gui/MainWindow.cpp" line="-264"/>
<source>Search</source>
<translation>Suchen</translation>
</message>
@ -4856,12 +4881,12 @@ p, li { white-space: pre-wrap; }
<translation>Dateien</translation>
</message>
<message>
<location filename="../gui/MainWindow.ui" line="-47"/>
<location filename="../gui/MainWindow.ui" line="-38"/>
<source>Messenger</source>
<translation>Messenger</translation>
</message>
<message>
<location filename="../gui/MainWindow.cpp" line="+148"/>
<location filename="../gui/MainWindow.cpp" line="+151"/>
<source>Show/Hide</source>
<translation>Anzeigen/Verbergen</translation>
</message>
@ -4938,12 +4963,12 @@ p, li { white-space: pre-wrap; }
<translation>Foren</translation>
</message>
<message>
<location line="-66"/>
<location line="-69"/>
<source>RetroShare %1 a secure decentralised communication platform</source>
<translation>RetroShare %1 eine sichere und dezentralisierte Kommunikationsplattform</translation>
</message>
<message>
<location line="+567"/>
<location line="+570"/>
<source>Open Messages</source>
<translation>Öffne Nachrichten</translation>
</message>
@ -6852,17 +6877,12 @@ p, li { white-space: pre-wrap; }
<context>
<name>PeersDialog</name>
<message>
<location filename="../gui/PeersDialog.cpp" line="+329"/>
<location filename="../gui/PeersDialog.cpp" line="+360"/>
<source>Chat</source>
<translation>Chat</translation>
</message>
<message>
<location line="+49"/>
<source>Export Friend</source>
<translation>Zertifikat des Freundes exportieren</translation>
</message>
<message>
<location line="+439"/>
<location line="+737"/>
<source>Save Certificate</source>
<translation>Zertifikat speichern</translation>
</message>
@ -6877,12 +6897,12 @@ p, li { white-space: pre-wrap; }
<translation>Status</translation>
</message>
<message>
<location filename="../gui/PeersDialog.cpp" line="-475"/>
<location filename="../gui/PeersDialog.cpp" line="-736"/>
<source>Connect To Friend</source>
<translation>Verbinde zum Freund</translation>
</message>
<message>
<location line="-217"/>
<location line="-227"/>
<source>Profile</source>
<translation>Profil</translation>
</message>
@ -6902,7 +6922,7 @@ p, li { white-space: pre-wrap; }
<translation>ich</translation>
</message>
<message>
<location line="+93"/>
<location line="+115"/>
<source>Expand all</source>
<translation>Alle erweitern</translation>
</message>
@ -6912,27 +6932,57 @@ p, li { white-space: pre-wrap; }
<translation>Alle reduzieren</translation>
</message>
<message>
<location line="+10"/>
<location line="+4"/>
<source>Message Friend</source>
<translation>Freund anschreiben</translation>
</message>
<message>
<location line="+14"/>
<location line="+2"/>
<source>Peer Details</source>
<translation>Peer-Details</translation>
</message>
<message>
<location line="+35"/>
<location line="+2"/>
<source>Deny Friend</source>
<translation>Blockiere Freund</translation>
</message>
<message>
<location line="+4"/>
<location line="+11"/>
<source>Remove Friend Location</source>
<translation>Freund entfernen</translation>
</message>
<message>
<location line="+22"/>
<location line="+53"/>
<source>Add to group</source>
<translation>Hinzufügen zur Gruppe</translation>
</message>
<message>
<location line="+8"/>
<source>Move to group</source>
<translation>Verschiebe in Gruppe</translation>
</message>
<message>
<location line="+12"/>
<source>Groups</source>
<translation>Gruppen</translation>
</message>
<message>
<location line="+14"/>
<source>Remove from group</source>
<translation>Aus Gruppe entfernen</translation>
</message>
<message>
<location line="+5"/>
<source>Remove from all groups</source>
<translation>Aus allen Gruppen entfernen</translation>
</message>
<message>
<location line="+7"/>
<source>Remove group</source>
<translation>Gruppe entfernen</translation>
</message>
<message>
<location line="+24"/>
<source>&lt;strong&gt;GPG Key&lt;/strong&gt;</source>
<translation></translation>
</message>
@ -6942,12 +6992,12 @@ p, li { white-space: pre-wrap; }
<translation></translation>
</message>
<message>
<location line="+349"/>
<location line="+519"/>
<source>Available</source>
<translation>Verfügbar</translation>
</message>
<message>
<location line="+736"/>
<location line="+758"/>
<source>Add Extra File</source>
<translation>Zusätzliche Datei hinzufügen</translation>
</message>
@ -7061,7 +7111,7 @@ p, li { white-space: pre-wrap; }
<location line="+41"/>
<location line="+3"/>
<source>Add a new Group</source>
<translation type="unfinished"></translation>
<translation>Neue Gruppe hinzufügen</translation>
</message>
<message>
<location line="-107"/>
@ -7107,18 +7157,13 @@ p, li { white-space: pre-wrap; }
<translation>Verlauf löschen</translation>
</message>
<message>
<location filename="../gui/PeersDialog.cpp" line="-1225"/>
<source>Profile View</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/PeersDialog.ui" line="+85"/>
<location line="+85"/>
<location line="+3"/>
<source>Save Chat History</source>
<translation>Chat Verlauf speichern</translation>
</message>
<message>
<location filename="../gui/PeersDialog.cpp" line="+564"/>
<location filename="../gui/PeersDialog.cpp" line="-661"/>
<source>RetroShare</source>
<translation></translation>
</message>
@ -7161,17 +7206,17 @@ p, li { white-space: pre-wrap; }
<translation>Status Spalte ausblenden</translation>
</message>
<message>
<location filename="../gui/PeersDialog.cpp" line="-1528"/>
<location filename="../gui/PeersDialog.cpp" line="-1799"/>
<source>Friends Storm</source>
<translation>Aktivitäten</translation>
</message>
<message>
<location line="+230"/>
<location line="+252"/>
<source>Recomend this Friend to...</source>
<translation>Freund weiterempfehlen...</translation>
</message>
<message>
<location line="+645"/>
<location line="+894"/>
<source>is typing...</source>
<translation>tippt...</translation>
</message>
@ -7191,12 +7236,12 @@ p, li { white-space: pre-wrap; }
<translation>Freunde</translation>
</message>
<message>
<location filename="../gui/PeersDialog.cpp" line="-638"/>
<location filename="../gui/PeersDialog.cpp" line="-887"/>
<source>Paste Friend Link</source>
<translation>RetroShare Link einfügen</translation>
</message>
<message>
<location line="+258"/>
<location line="+482"/>
<source>location</source>
<translation>Standort</translation>
</message>
@ -7654,11 +7699,6 @@ Do you want to send them a Message instead</source>
<source>apears to be Offline.</source>
<translation>ist Offline.</translation>
</message>
<message>
<source>Messages you send will be lost and not delivered, rs-Mail this contact instead.</source>
<translation type="obsolete">Nachrichten, die Du versendest gehen bei diesem Kontakt nicht ein.
Diesem Kontakt stattdessen eine RS-Mail senden.</translation>
</message>
<message>
<location line="-693"/>
<source>is typing...</source>
@ -7820,7 +7860,7 @@ Diesem Kontakt stattdessen eine RS-Mail senden.</translation>
<context>
<name>ProfileView</name>
<message>
<location filename="../gui/profile/ProfileView.cpp" line="+77"/>
<location filename="../gui/profile/ProfileView.cpp" line="+76"/>
<source>Clear Photo</source>
<translation>Photo entfernen</translation>
</message>

View File

@ -189,6 +189,7 @@ int main(int argc, char *argv[])
QObject::connect(notify,SIGNAL(transfersChanged()) ,w->transfersDialog ,SLOT(insertTransfers() )) ;
QObject::connect(notify,SIGNAL(friendsChanged()) ,w->peersDialog ,SLOT(insertPeers() )) ;
QObject::connect(notify,SIGNAL(publicChatChanged(int)) ,w->peersDialog ,SLOT(publicChatChanged(int) ));
QObject::connect(notify,SIGNAL(groupsChanged(int)) ,w->peersDialog ,SLOT(groupsChanged(int) ));
QObject::connect(notify,SIGNAL(privateChatChanged(int, int)) ,w ,SLOT(privateChatChanged(int, int) ));
QObject::connect(notify,SIGNAL(neighborsChanged()) ,w->networkDialog ,SLOT(insertConnect() )) ;
QObject::connect(notify,SIGNAL(messagesChanged()) ,w->messagesDialog ,SLOT(insertMessages() )) ;