mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-26 15:28:28 -05:00
Commit of the new UDP Connection methods and
the rewrite of the retroshare core networking stack. This check-in commits the changes to the GUI code. Changes to use the new rspeers.h interface to the retroshare core. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@316 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c7ce92aba2
commit
c4e1d73837
@ -24,6 +24,8 @@
|
||||
#include "ChatDialog.h"
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
|
||||
#include "chat/PopupChatDialog.h"
|
||||
#include <sstream>
|
||||
|
||||
@ -247,53 +249,36 @@ void ChatDialog::sendMsg()
|
||||
|
||||
void ChatDialog::insertSendList()
|
||||
{
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
std::list<std::string> peers;
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
std::map<RsCertId,NeighbourInfo>::const_iterator it;
|
||||
const std::map<RsCertId,NeighbourInfo> &friends =
|
||||
rsiface->getFriendMap();
|
||||
if (!rsPeers)
|
||||
{
|
||||
/* not ready yet! */
|
||||
return;
|
||||
}
|
||||
|
||||
rsPeers->getOnlineList(peers);
|
||||
|
||||
/* get a link to the table */
|
||||
QTreeWidget *sendWidget = ui.msgSendList;
|
||||
QList<QTreeWidgetItem *> items;
|
||||
|
||||
/* remove old items ??? */
|
||||
sendWidget->clear();
|
||||
sendWidget->setColumnCount(1);
|
||||
|
||||
QList<QTreeWidgetItem *> items;
|
||||
for(it = friends.begin(); it != friends.end(); it++)
|
||||
for(it = peers.begin(); it != peers.end(); it++)
|
||||
{
|
||||
/* if offline, don't add */
|
||||
if ((it -> second.connectString == "Online" ) ||
|
||||
(it -> second.connectString == "Yourself"))
|
||||
|
||||
RsPeerDetails details;
|
||||
if (!rsPeers->getPeerDetails(*it, details))
|
||||
{
|
||||
/* ok */
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
continue; /* BAD */
|
||||
}
|
||||
|
||||
/* make a widget per friend */
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
|
||||
|
||||
/* add all the labels */
|
||||
/* (0) Person */
|
||||
item -> setText(0, QString::fromStdString(it->second.name));
|
||||
/* () Org */
|
||||
//item -> setText(1, QString::fromStdString(it->second.org));
|
||||
/* () Location */
|
||||
//item -> setText(2, QString::fromStdString(it->second.loc));
|
||||
/* () Country */
|
||||
//item -> setText(3, QString::fromStdString(it->second.country));
|
||||
/*{
|
||||
std::ostringstream out;
|
||||
out << it->second.id;
|
||||
item -> setText(4, QString::fromStdString(out.str()));
|
||||
}*/
|
||||
|
||||
//item -> setText(5, "Friend");
|
||||
item -> setText(0, QString::fromStdString(details.name));
|
||||
|
||||
//item -> setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
||||
item -> setFlags(Qt::ItemIsUserCheckable);
|
||||
@ -309,17 +294,17 @@ void ChatDialog::insertSendList()
|
||||
item -> setCheckState(0, Qt::Unchecked);
|
||||
}
|
||||
************/
|
||||
|
||||
|
||||
/* add to the list */
|
||||
items.append(item);
|
||||
}
|
||||
|
||||
/* remove old items */
|
||||
sendWidget->clear();
|
||||
sendWidget->setColumnCount(1);
|
||||
|
||||
/* add the items in! */
|
||||
sendWidget->insertTopLevelItems(0, items);
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
sendWidget->update(); /* update display */
|
||||
}
|
||||
|
||||
|
@ -118,6 +118,8 @@ void ExampleDialog::peertreeWidgetCostumPopupMenu( QPoint point )
|
||||
/* get the list of peers from the RsIface. */
|
||||
void ExampleDialog::insertExample()
|
||||
{
|
||||
|
||||
#if 0
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
|
||||
std::map<RsCertId,NeighbourInfo>::const_iterator it;
|
||||
@ -226,6 +228,7 @@ void ExampleDialog::insertExample()
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
peerWidget->update(); /* update display */
|
||||
#endif
|
||||
}
|
||||
|
||||
QTreeWidgetItem *ExampleDialog::getCurrentLine()
|
||||
|
@ -22,12 +22,10 @@
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
|
||||
//#include "common/vmessagebox.h"
|
||||
//#include "rshare.h"
|
||||
|
||||
#include "GamesDialog.h"
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rsgame.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@ -269,35 +267,30 @@ void GamesDialog::updateGameDetails()
|
||||
}
|
||||
if (detail.status == "Invite")
|
||||
{
|
||||
/* add all the online peers not listed above */
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
std::list<std::string> friends;
|
||||
std::list<std::string>::iterator fit;
|
||||
|
||||
rsPeers->getOnlineList(friends);
|
||||
|
||||
std::map<RsCertId,NeighbourInfo>::const_iterator fit;
|
||||
const std::map<RsCertId,NeighbourInfo> &friends =
|
||||
rsiface->getFriendMap();
|
||||
for(fit = friends.begin(); fit != friends.end(); fit++)
|
||||
{
|
||||
if (detail.gamers.end() != detail.gamers.find(fit->first))
|
||||
if (detail.gamers.end() != detail.gamers.find(*fit))
|
||||
{
|
||||
/* already present */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (1)
|
||||
{
|
||||
/* not online */
|
||||
|
||||
}
|
||||
std::string name = rsPeers->getPeerName(*fit);
|
||||
|
||||
/* make a widget per friend */
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
item -> setText(GAME_PEER_PLAYER, QString::fromStdString(fit->second.name));
|
||||
item -> setText(GAME_PEER_PLAYER, QString::fromStdString(name));
|
||||
item -> setText(GAME_PEER_INVITE, "No");
|
||||
item -> setText(GAME_PEER_INTEREST, "?");
|
||||
item -> setText(GAME_PEER_PLAY, "?");
|
||||
item -> setText(GAME_PEER_ID, QString::fromStdString(fit->first));
|
||||
item -> setText(GAME_PEER_ID, QString::fromStdString(*fit));
|
||||
|
||||
if ((oldSelect) && (oldId == fit->first))
|
||||
if ((oldSelect) && (oldId == *fit))
|
||||
{
|
||||
newSelect = item;
|
||||
}
|
||||
@ -305,9 +298,6 @@ void GamesDialog::updateGameDetails()
|
||||
/* add to the list */
|
||||
items.append(item);
|
||||
}
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
}
|
||||
|
||||
detailWidget->clear();
|
||||
@ -415,18 +405,14 @@ void GamesDialog::createGame()
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
/* add all the online peers not listed above */
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
std::list<std::string> friends;
|
||||
std::list<std::string>::iterator fit;
|
||||
|
||||
std::map<RsCertId,NeighbourInfo>::const_iterator fit;
|
||||
const std::map<RsCertId,NeighbourInfo> &friends =
|
||||
rsiface->getFriendMap();
|
||||
rsPeers->getOnlineList(friends);
|
||||
for(fit = friends.begin(); fit != friends.end(); fit++)
|
||||
{
|
||||
rsGameLauncher -> invitePeer(gameId, fit->first);
|
||||
rsGameLauncher -> invitePeer(gameId, *fit);
|
||||
}
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
}
|
||||
|
||||
/* call to the GameControl */
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "util/rsversion.h"
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
|
||||
#include "gui/connect/InviteDialog.h"
|
||||
#include "gui/connect/AddFriendDialog.h"
|
||||
@ -347,7 +348,7 @@ void MainWindow::inviteFriend()
|
||||
{
|
||||
static InviteDialog *inviteDialog = new InviteDialog(this);
|
||||
|
||||
std::string invite = rsicontrol->NeighGetInvite();
|
||||
std::string invite = rsPeers->GetRetroshareInvite();
|
||||
inviteDialog->setInfo(invite);
|
||||
inviteDialog->show();
|
||||
|
||||
@ -367,7 +368,7 @@ void MainWindow::addSharedDirectory()
|
||||
if (dir != "")
|
||||
{
|
||||
rsicontrol -> ConfigAddSharedDir(dir);
|
||||
rsicontrol -> ConfigSave();
|
||||
//rsicontrol -> ConfigSave();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,11 +21,14 @@
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include "common/vmessagebox.h"
|
||||
|
||||
#include "rshare.h"
|
||||
#include "MessengerWindow.h"
|
||||
#include "common/vmessagebox.h"
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
|
||||
#include "rshare.h"
|
||||
#include "MessengerWindow.h"
|
||||
|
||||
#include "chat/PopupChatDialog.h"
|
||||
#include "msgs/ChanMsgDialog.h"
|
||||
#include "ChatDialog.h"
|
||||
@ -164,51 +167,51 @@ void MessengerWindow::messengertreeWidgetCostumPopupMenu( QPoint point )
|
||||
/* get the list of peers from the RsIface. */
|
||||
void MessengerWindow::insertPeers()
|
||||
{
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
if (!rsPeers)
|
||||
{
|
||||
/* not ready yet! */
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<RsCertId,NeighbourInfo>::const_iterator it;
|
||||
const std::map<RsCertId,NeighbourInfo> &friends =
|
||||
rsiface->getFriendMap();
|
||||
std::list<std::string> peers;
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
rsPeers->getFriendList(peers);
|
||||
|
||||
/* get a link to the table */
|
||||
QTreeWidget *peerWidget = ui.messengertreeWidget;
|
||||
|
||||
/* remove old items ??? */
|
||||
peerWidget->clear();
|
||||
peerWidget->setColumnCount(1);
|
||||
|
||||
|
||||
/* have two lists: online / offline */
|
||||
QList<QTreeWidgetItem *> online_items;
|
||||
QList<QTreeWidgetItem *> offline_items;
|
||||
|
||||
|
||||
for(it = friends.begin(); it != friends.end(); it++)
|
||||
for(it = peers.begin(); it != peers.end(); it++)
|
||||
{
|
||||
|
||||
RsPeerDetails details;
|
||||
if (!rsPeers->getPeerDetails(*it, details))
|
||||
{
|
||||
continue; /* BAD */
|
||||
}
|
||||
|
||||
/* make a widget per friend */
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
|
||||
/* add all the labels */
|
||||
/* (0) Person */
|
||||
item -> setText(0, QString::fromStdString(it->second.name));
|
||||
item -> setText(0, QString::fromStdString(details.name));
|
||||
/* (1) Org */
|
||||
//item -> setText(1, QString::fromStdString(it->second.org));
|
||||
//item -> setText(1, QString::fromStdString(details.org));
|
||||
/* (2) Location */
|
||||
//item -> setText(2, QString::fromStdString(it->second.loc));
|
||||
/* (3) Country */
|
||||
//item -> setText(3, QString::fromStdString(it->second.country));
|
||||
//item -> setText(2, QString::fromStdString(details.location));
|
||||
/* (3) Email */
|
||||
//item -> setText(3, QString::fromStdString(details.email));
|
||||
|
||||
|
||||
/* Hidden ones: */
|
||||
/* () RsCertId */
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << it -> second.id;
|
||||
item -> setText(4, QString::fromStdString(out.str()));
|
||||
}
|
||||
/* Hidden ones: RsCertId */
|
||||
item -> setText(4, QString::fromStdString(details.id));
|
||||
|
||||
/* add to the list */
|
||||
if (it->second.statusString == "Online")
|
||||
if (details.state & RS_PEER_STATE_CONNECTED)
|
||||
{
|
||||
online_items.append(item);
|
||||
item -> setIcon(0,(QIcon(IMAGE_ONLINE)));
|
||||
@ -220,8 +223,9 @@ void MessengerWindow::insertPeers()
|
||||
}
|
||||
}
|
||||
|
||||
/* make parent items (TODO) */
|
||||
/* add the items in! */
|
||||
/* remove old items */
|
||||
peerWidget->clear();
|
||||
peerWidget->setColumnCount(1);
|
||||
|
||||
if (online_items.size() > 0)
|
||||
{
|
||||
@ -250,8 +254,6 @@ void MessengerWindow::insertPeers()
|
||||
item -> setIcon(0,(QIcon(IMAGE_OFF)));
|
||||
}
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
peerWidget->update(); /* update display */
|
||||
}
|
||||
|
||||
@ -291,7 +293,7 @@ void MessengerWindow::connectfriend2()
|
||||
else
|
||||
{
|
||||
std::cerr << "MessengerWindow::connectfriend2() Trying" << std::endl;
|
||||
rsicontrol->FriendConnectAttempt(getMessengerPeerRsCertId(i));
|
||||
rsPeers->connectAttempt(getMessengerPeerRsCertId(i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -446,7 +448,7 @@ void MessengerWindow::removefriend2()
|
||||
std::cerr << "MessengerWindow::removefriend2() Noone Selected -- sorry" << std::endl;
|
||||
return;
|
||||
}
|
||||
rsicontrol->FriendRemove(getMessengerPeerRsCertId(c));
|
||||
rsPeers->removeFriend(getMessengerPeerRsCertId(c));
|
||||
}
|
||||
|
||||
void MessengerWindow::changeAvatarClicked()
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "connect/ConnectDialog.h"
|
||||
#include "authdlg/AuthorizationDialog.h"
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rstypes.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
@ -214,11 +214,14 @@ void NetworkDialog::loadcert()
|
||||
/* get the list of Neighbours from the RsIface. */
|
||||
void NetworkDialog::insertConnect()
|
||||
{
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
if (!rsPeers)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<RsCertId,NeighbourInfo>::const_iterator it;
|
||||
const std::map<RsCertId,NeighbourInfo> &neighs =
|
||||
rsiface->getNeighbourMap();
|
||||
std::list<std::string> neighs;
|
||||
std::list<std::string>::iterator it;
|
||||
rsPeers->getOthersList(neighs);
|
||||
|
||||
/* get a link to the table */
|
||||
QTreeWidget *connectWidget = ui.connecttreeWidget;
|
||||
@ -230,57 +233,76 @@ void NetworkDialog::insertConnect()
|
||||
oldId = (oldSelect -> text(9)).toStdString();
|
||||
}
|
||||
|
||||
/* remove old items ??? */
|
||||
connectWidget->clear();
|
||||
connectWidget->setColumnCount(11);
|
||||
|
||||
QList<QTreeWidgetItem *> items;
|
||||
for(it = neighs.begin(); it != neighs.end(); it++)
|
||||
{
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(*it, detail))
|
||||
{
|
||||
continue; /* BAD */
|
||||
}
|
||||
|
||||
/* make a widget per friend */
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
|
||||
/* add all the labels */
|
||||
|
||||
/* (0) Status Icon */
|
||||
item -> setText(0, "");
|
||||
/* (0) Status Icon */
|
||||
item -> setText(0, "");
|
||||
|
||||
/* (1) Accept/Deny */
|
||||
item -> setText(1, QString::fromStdString(it->second.acceptString));
|
||||
/* (2) Trust Level */
|
||||
item -> setText(2, QString::fromStdString(it->second.trustString));
|
||||
if (detail.state & RS_PEER_STATE_FRIEND)
|
||||
{
|
||||
item -> setText(1, tr("Accept"));
|
||||
}
|
||||
else
|
||||
{
|
||||
item -> setText(1, tr("Deny"));
|
||||
}
|
||||
|
||||
item -> setText(2,QString::fromStdString(
|
||||
RsPeerTrustString(detail.trustLvl)));
|
||||
|
||||
/* (3) Last Connect */
|
||||
item -> setText(3, QString::fromStdString(it->second.lastConnect));
|
||||
/* (4) Person */
|
||||
item -> setText(4, QString::fromStdString(it->second.name));
|
||||
|
||||
/* (5) Peer Address */
|
||||
item -> setText(5, QString::fromStdString(it->second.peerAddress));
|
||||
|
||||
/* Others */
|
||||
item -> setText(6, QString::fromStdString(it->second.org));
|
||||
item -> setText(7, QString::fromStdString(it->second.loc));
|
||||
item -> setText(8, QString::fromStdString(it->second.country));
|
||||
|
||||
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << it -> second.id;
|
||||
item -> setText(9, QString::fromStdString(out.str()));
|
||||
if ((oldSelect) && (oldId == out.str()))
|
||||
out << detail.lastConnect;
|
||||
item -> setText(3, QString::fromStdString(out.str()));
|
||||
}
|
||||
|
||||
/* (4) Person */
|
||||
item -> setText(4, QString::fromStdString(detail.name));
|
||||
|
||||
/* (5) Peer Address */
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << detail.localAddr << ":";
|
||||
out << detail.localPort << "/";
|
||||
out << detail.extAddr << ":";
|
||||
out << detail.extPort;
|
||||
item -> setText(5, QString::fromStdString(out.str()));
|
||||
}
|
||||
|
||||
/* Others */
|
||||
item -> setText(6, QString::fromStdString(detail.org));
|
||||
item -> setText(7, QString::fromStdString(detail.location));
|
||||
item -> setText(8, QString::fromStdString(detail.email));
|
||||
|
||||
{
|
||||
item -> setText(9, QString::fromStdString(detail.id));
|
||||
if ((oldSelect) && (oldId == detail.id))
|
||||
{
|
||||
newSelect = item;
|
||||
}
|
||||
}
|
||||
|
||||
item -> setText(10, QString::fromStdString(it->second.authCode));
|
||||
|
||||
item -> setText(10, QString::fromStdString(detail.authcode));
|
||||
|
||||
/* change background */
|
||||
int i;
|
||||
if (it->second.acceptString == "Accept")
|
||||
if (detail.state & RS_PEER_STATE_FRIEND)
|
||||
{
|
||||
if (it->second.lastConnect != "Never")
|
||||
if (detail.lastConnect < 10000) /* 3 hours? */
|
||||
{
|
||||
/* bright green */
|
||||
for(i = 1; i < 11; i++)
|
||||
@ -300,7 +322,7 @@ void NetworkDialog::insertConnect()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (it->second.trustLvl > 3)
|
||||
if (detail.trustLvl > RS_TRUST_LVL_MARGINAL)
|
||||
{
|
||||
for(i = 1; i < 11; i++)
|
||||
{
|
||||
@ -308,7 +330,7 @@ void NetworkDialog::insertConnect()
|
||||
item -> setIcon(0,(QIcon(IMAGE_DENIED)));
|
||||
}
|
||||
}
|
||||
else if (it->second.lastConnect != "Never")
|
||||
else if (detail.lastConnect < 10000) /* 3 hours? */
|
||||
{
|
||||
for(i = 1; i < 11; i++)
|
||||
{
|
||||
@ -331,6 +353,10 @@ void NetworkDialog::insertConnect()
|
||||
items.append(item);
|
||||
}
|
||||
|
||||
/* remove old items ??? */
|
||||
connectWidget->clear();
|
||||
connectWidget->setColumnCount(11);
|
||||
|
||||
/* add the items in! */
|
||||
connectWidget->insertTopLevelItems(0, items);
|
||||
if (newSelect)
|
||||
@ -338,8 +364,6 @@ void NetworkDialog::insertConnect()
|
||||
connectWidget->setCurrentItem(newSelect);
|
||||
}
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
connectWidget->update(); /* update display */
|
||||
}
|
||||
|
||||
@ -358,18 +382,6 @@ QTreeWidgetItem *NetworkDialog::getCurrentNeighbour()
|
||||
|
||||
/* Display the columns of this item. */
|
||||
|
||||
/**** NO NEED ANYMORE
|
||||
std::ostringstream out;
|
||||
out << "CurrentNeighbourItem: " << std::endl;
|
||||
|
||||
for(int i = 1; i < 6; i++)
|
||||
{
|
||||
QString txt = item -> text(i);
|
||||
out << "\t" << i << ":" << txt.toStdString() << std::endl;
|
||||
}
|
||||
std::cerr << out.str();
|
||||
*****************/
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
@ -398,7 +410,7 @@ std::string NetworkDialog::loadneighbour()
|
||||
std::string id;
|
||||
if (file != "")
|
||||
{
|
||||
rsicontrol->NeighLoadCertificate(file, id);
|
||||
rsPeers->LoadCertificateFromFile(file, id);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include "rshare.h"
|
||||
#include "PeersDialog.h"
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
|
||||
#include "chat/PopupChatDialog.h"
|
||||
#include "msgs/ChanMsgDialog.h"
|
||||
#include "ChatDialog.h"
|
||||
@ -147,11 +149,16 @@ void PeersDialog::peertreeWidgetCostumPopupMenu( QPoint point )
|
||||
/* get the list of peers from the RsIface. */
|
||||
void PeersDialog::insertPeers()
|
||||
{
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
std::list<std::string> peers;
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
std::map<RsCertId,NeighbourInfo>::const_iterator it;
|
||||
const std::map<RsCertId,NeighbourInfo> &friends =
|
||||
rsiface->getFriendMap();
|
||||
if (!rsPeers)
|
||||
{
|
||||
/* not ready yet! */
|
||||
return;
|
||||
}
|
||||
|
||||
rsPeers->getFriendList(peers);
|
||||
|
||||
/* get a link to the table */
|
||||
QTreeWidget *peerWidget = ui.peertreeWidget;
|
||||
@ -168,10 +175,15 @@ void PeersDialog::insertPeers()
|
||||
peerWidget->setColumnCount(12);
|
||||
|
||||
|
||||
|
||||
QList<QTreeWidgetItem *> items;
|
||||
for(it = friends.begin(); it != friends.end(); it++)
|
||||
for(it = peers.begin(); it != peers.end(); it++)
|
||||
{
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(*it, detail))
|
||||
{
|
||||
continue; /* BAD */
|
||||
}
|
||||
|
||||
/* make a widget per friend */
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
|
||||
@ -181,51 +193,56 @@ void PeersDialog::insertPeers()
|
||||
item -> setText(0, "");
|
||||
|
||||
/* (0) Status */
|
||||
item -> setText(1, QString::fromStdString(
|
||||
it->second.statusString));
|
||||
item -> setText(1,
|
||||
QString::fromStdString(RsPeerStateString(detail.state)));
|
||||
|
||||
/* (1) Person */
|
||||
item -> setText(2, QString::fromStdString(it->second.name));
|
||||
item -> setText(2, QString::fromStdString(detail.name));
|
||||
|
||||
/* (2) Auto Connect */
|
||||
item -> setText(3, QString::fromStdString(
|
||||
it->second.connectString));
|
||||
item -> setText(3, QString::fromStdString("Yes"));
|
||||
|
||||
/* (3) Trust Level */
|
||||
item -> setText(4, QString::fromStdString(it->second.trustString));
|
||||
item -> setText(4,QString::fromStdString(
|
||||
RsPeerTrustString(detail.trustLvl)));
|
||||
|
||||
/* (4) Peer Address */
|
||||
item -> setText(5, QString::fromStdString(it->second.peerAddress));
|
||||
|
||||
/* less important ones */
|
||||
/* () Last Contact */
|
||||
item -> setText(6, QString::fromStdString(it->second.lastConnect));
|
||||
|
||||
/* () Org */
|
||||
item -> setText(7, QString::fromStdString(it->second.org));
|
||||
/* () Location */
|
||||
item -> setText(8, QString::fromStdString(it->second.loc));
|
||||
/* () Country */
|
||||
item -> setText(9, QString::fromStdString(it->second.country));
|
||||
|
||||
|
||||
/* Hidden ones: */
|
||||
/* () RsCertId */
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << it -> second.id;
|
||||
item -> setText(10, QString::fromStdString(out.str()));
|
||||
if ((oldSelect) && (oldId == out.str()))
|
||||
out << detail.localAddr << ":";
|
||||
out << detail.localPort << "/";
|
||||
out << detail.extAddr << ":";
|
||||
out << detail.extPort;
|
||||
item -> setText(5, QString::fromStdString(out.str()));
|
||||
}
|
||||
|
||||
/* less important ones */
|
||||
/* () Last Contact */
|
||||
item -> setText(6,QString::fromStdString(
|
||||
RsPeerLastConnectString(detail.lastConnect)));
|
||||
|
||||
/* () Org */
|
||||
item -> setText(7, QString::fromStdString(detail.org));
|
||||
/* () Location */
|
||||
item -> setText(8, QString::fromStdString(detail.location));
|
||||
/* () Email */
|
||||
item -> setText(9, QString::fromStdString(detail.email));
|
||||
|
||||
/* Hidden ones: RsCertId */
|
||||
{
|
||||
item -> setText(10, QString::fromStdString(detail.id));
|
||||
if ((oldSelect) && (oldId == detail.id))
|
||||
{
|
||||
newSelect = item;
|
||||
}
|
||||
}
|
||||
|
||||
/* () AuthCode */
|
||||
item -> setText(11, QString::fromStdString(it->second.authCode));
|
||||
item -> setText(11, QString::fromStdString(detail.authcode));
|
||||
|
||||
/* change background */
|
||||
int i;
|
||||
if (it->second.statusString == "Online")
|
||||
if (detail.state & RS_PEER_STATE_CONNECTED)
|
||||
{
|
||||
/* bright green */
|
||||
for(i = 1; i < 12; i++)
|
||||
@ -234,9 +251,18 @@ void PeersDialog::insertPeers()
|
||||
item -> setIcon(0,(QIcon(IMAGE_ONLINE)));
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (detail.state & RS_PEER_STATE_ONLINE)
|
||||
{
|
||||
if (it->second.lastConnect != "Never")
|
||||
/* bright green */
|
||||
for(i = 1; i < 12; i++)
|
||||
{
|
||||
item -> setBackground(i,QBrush(Qt::cyan));
|
||||
item -> setIcon(0,(QIcon(IMAGE_OFFLINE)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (detail.lastConnect < 10000)
|
||||
{
|
||||
for(i = 1; i < 12; i++)
|
||||
{
|
||||
@ -254,8 +280,6 @@ void PeersDialog::insertPeers()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* add to the list */
|
||||
items.append(item);
|
||||
}
|
||||
@ -267,9 +291,6 @@ void PeersDialog::insertPeers()
|
||||
peerWidget->setCurrentItem(newSelect);
|
||||
}
|
||||
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
peerWidget->update(); /* update display */
|
||||
}
|
||||
|
||||
@ -300,7 +321,10 @@ void PeersDialog::exportfriend()
|
||||
{
|
||||
std::cerr << "PeersDialog::exportfriend() Saving to: " << file << std::endl;
|
||||
std::cerr << std::endl;
|
||||
rsicontrol->FriendSaveCertificate(id, file);
|
||||
if (rsPeers)
|
||||
{
|
||||
rsPeers->SaveCertificateToFile(id, file);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -408,7 +432,11 @@ void PeersDialog::removefriend()
|
||||
std::cerr << "PeersDialog::removefriend() Noone Selected -- sorry" << std::endl;
|
||||
return;
|
||||
}
|
||||
rsicontrol->FriendRemove(getPeerRsCertId(c));
|
||||
|
||||
if (rsPeers)
|
||||
{
|
||||
rsPeers->removeFriend(getPeerRsCertId(c));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -427,7 +455,10 @@ void PeersDialog::connectfriend()
|
||||
{
|
||||
QTreeWidgetItem *c = getCurrentPeer();
|
||||
std::cerr << "PeersDialog::connectfriend()" << std::endl;
|
||||
rsicontrol->FriendConnectAttempt(getPeerRsCertId(c));
|
||||
if (rsPeers)
|
||||
{
|
||||
rsPeers->connectAttempt(getPeerRsCertId(c));
|
||||
}
|
||||
}
|
||||
|
||||
void PeersDialog::setaddressfriend()
|
||||
|
@ -118,6 +118,8 @@ void PhotoDialog::peertreeWidgetCostumPopupMenu( QPoint point )
|
||||
/* get the list of peers from the RsIface. */
|
||||
void PhotoDialog::insertExample()
|
||||
{
|
||||
|
||||
#if 0
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
|
||||
std::map<RsCertId,NeighbourInfo>::const_iterator it;
|
||||
@ -224,6 +226,7 @@ void PhotoDialog::insertExample()
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
peerWidget->update(); /* update display */
|
||||
#endif
|
||||
}
|
||||
|
||||
QTreeWidgetItem *PhotoDialog::getCurrentLine()
|
||||
|
@ -165,7 +165,7 @@ PreferencesWindow::saveChanges()
|
||||
}
|
||||
|
||||
/* call to RsIface save function.... */
|
||||
rsicontrol -> ConfigSave();
|
||||
//rsicontrol -> ConfigSave();
|
||||
|
||||
QMainWindow::close();
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
|
||||
|
||||
|
||||
@ -187,8 +188,8 @@ void ServerDialog::saveAddresses()
|
||||
QString str;
|
||||
|
||||
bool saveAddr = false;
|
||||
rsicontrol -> NetworkDHTActive(ui.DHTButton->isChecked());
|
||||
rsicontrol -> NetworkUPnPActive(ui.UPnPButton->isChecked());
|
||||
//rsicontrol -> NetworkDHTActive(ui.DHTButton->isChecked());
|
||||
//rsicontrol -> NetworkUPnPActive(ui.UPnPButton->isChecked());
|
||||
|
||||
if (ui.ManualButton->isChecked())
|
||||
{
|
||||
@ -197,9 +198,9 @@ void ServerDialog::saveAddresses()
|
||||
|
||||
if (saveAddr)
|
||||
{
|
||||
rsicontrol->ConfigSetLocalAddr(ui.localAddress->text().toStdString(), ui.localPort->value());
|
||||
rsicontrol->ConfigSetLanConfig(ui.chkFirewall->isChecked(), ui.chkForwarded->isChecked());
|
||||
rsicontrol->ConfigSetExtAddr(ui.extAddress->text().toStdString(), ui.extPort->value());
|
||||
rsPeers->setLocalAddress(rsPeers->getOwnId(), ui.localAddress->text().toStdString(), ui.localPort->value());
|
||||
//rsicontrol->ConfigSetLanConfig(ui.chkFirewall->isChecked(), ui.chkForwarded->isChecked());
|
||||
rsPeers->setExtAddress(rsPeers->getOwnId(), ui.extAddress->text().toStdString(), ui.extPort->value());
|
||||
}
|
||||
|
||||
rsicontrol->ConfigSetDataRates( ui.totalRate->value(), ui.indivRate->value() );
|
||||
|
@ -22,7 +22,9 @@
|
||||
|
||||
#include "rshare.h"
|
||||
#include "SharedFilesDialog.h"
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "rsiface/RemoteDirModel.h"
|
||||
#include "util/RsAction.h"
|
||||
#include "msgs/ChanMsgDialog.h"
|
||||
@ -308,31 +310,30 @@ void SharedFilesDialog::shareddirtreeWidgetCostumPopupMenu( QPoint point )
|
||||
QMenu *recMenu = new QMenu( tr("Recommend To "), this );
|
||||
QMenu *msgMenu = new QMenu( tr("Message Friend "), &contextMnu2 );
|
||||
|
||||
std::list<std::string> peers;
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
|
||||
std::map<RsCertId,NeighbourInfo>::const_iterator it;
|
||||
const std::map<RsCertId,NeighbourInfo> &friends =
|
||||
rsiface->getFriendMap();
|
||||
|
||||
for(it = friends.begin(); it != friends.end(); it++)
|
||||
if (!rsPeers)
|
||||
{
|
||||
/* not ready yet! */
|
||||
return;
|
||||
}
|
||||
|
||||
rsPeers->getFriendList(peers);
|
||||
|
||||
for(it = peers.begin(); it != peers.end(); it++)
|
||||
{
|
||||
std::string name = rsPeers->getPeerName(*it);
|
||||
/* parents are
|
||||
* recMenu
|
||||
* msgMenu
|
||||
*/
|
||||
std::string rsid;
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << it -> second.id;
|
||||
rsid = out.str();
|
||||
}
|
||||
|
||||
RsAction *qaf1 = new RsAction( QString::fromStdString( it->second.name ), recMenu, rsid );
|
||||
RsAction *qaf1 = new RsAction( QString::fromStdString( name ), recMenu, *it );
|
||||
connect( qaf1 , SIGNAL( triggeredId( std::string ) ), this, SLOT( recommendFilesTo( std::string ) ) );
|
||||
recMenu->addAction(qaf1);
|
||||
|
||||
RsAction *qaf2 = new RsAction( QString::fromStdString( it->second.name ), msgMenu, rsid );
|
||||
RsAction *qaf2 = new RsAction( QString::fromStdString( name ), msgMenu, *it );
|
||||
connect( qaf2 , SIGNAL( triggeredId( std::string ) ), this, SLOT( recommendFilesToMsg( std::string ) ) );
|
||||
msgMenu->addAction(qaf2);
|
||||
|
||||
@ -340,9 +341,6 @@ void SharedFilesDialog::shareddirtreeWidgetCostumPopupMenu( QPoint point )
|
||||
|
||||
}
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
|
||||
contextMnu2.addAction( openfileAct);
|
||||
contextMnu2.addMenu( recMenu);
|
||||
contextMnu2.addMenu( msgMenu);
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "AuthorizationDialog.h"
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@ -112,8 +113,8 @@ void AuthorizationDialog::authAttempt()
|
||||
|
||||
/* well lets do it ! */
|
||||
std::cerr << "Attempting AuthCode:" << authCode << std::endl;
|
||||
rsicontrol -> NeighAuthFriend(authId, authCode);
|
||||
rsicontrol -> NeighAddFriend(authId);
|
||||
rsPeers->AuthCertificate(authId, authCode);
|
||||
rsPeers->addFriend(authId);
|
||||
|
||||
/* close it up! */
|
||||
closedlg();
|
||||
|
@ -29,8 +29,10 @@
|
||||
#include <QToolBar>
|
||||
#include <QTextCursor>
|
||||
#include <QTextList>
|
||||
|
||||
|
||||
|
||||
#include "rsiface/rspeers.h"
|
||||
|
||||
|
||||
/* Define the format used for displaying the date and time */
|
||||
#define DATETIME_FMT "MMM dd hh:mm:ss"
|
||||
|
||||
@ -201,24 +203,21 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci)
|
||||
std::ostringstream out;
|
||||
int ts = time(NULL);
|
||||
|
||||
|
||||
|
||||
bool offline = true;
|
||||
|
||||
{
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
const NeighbourInfo *peer = rsiface->getFriend(dialogId);
|
||||
if (!peer)
|
||||
{
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(dialogId, detail))
|
||||
{
|
||||
std::cerr << "WARNING CANNOT GET PEER INFO!!!!" << std::endl;
|
||||
}
|
||||
else if (peer->statusString == "Online")
|
||||
else if (detail.state & RS_PEER_STATE_CONNECTED)
|
||||
{
|
||||
offline = false;
|
||||
}
|
||||
}
|
||||
|
||||
rsiface->unlockData(); /* Unlock Interface */
|
||||
}
|
||||
|
||||
if (offline)
|
||||
{
|
||||
QString line = "<br>\n<span style=\"color:#1D84C9\"><strong> ----- PEER OFFLINE (Chat will be lost) -----</strong></span> \n<br>";
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include "AddFriendDialog.h"
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
|
||||
#include "gui/NetworkDialog.h"
|
||||
#include <util/WidgetBackgroundImage.h>
|
||||
|
||||
@ -53,7 +55,7 @@ void AddFriendDialog::donebutton()
|
||||
std::string certstr = ui.emailText->toPlainText().toStdString();
|
||||
|
||||
/* ask retroshare to load */
|
||||
if ((cDialog) && (rsicontrol -> NeighLoadPEMString(certstr, id)))
|
||||
if ((cDialog) && (rsPeers->LoadCertificateFromString(certstr, id)))
|
||||
{
|
||||
close();
|
||||
cDialog->showpeerdetails(id);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "ConfCertDialog.h"
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
|
||||
/* Define the format used for displaying the date and time */
|
||||
#define DATETIME_FMT "MMM dd hh:mm:ss"
|
||||
@ -74,43 +75,43 @@ void ConfCertDialog::loadId(std::string id)
|
||||
|
||||
void ConfCertDialog::loadDialog()
|
||||
{
|
||||
/* open up the rsiface and get the data */
|
||||
/* get the shared directories */
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
|
||||
/* get the correct friend */
|
||||
const NeighbourInfo *ni = rsiface->getFriend(mId);
|
||||
if (!ni)
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(mId, detail))
|
||||
{
|
||||
/* fail */
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
return;
|
||||
}
|
||||
|
||||
ui.name->setText(QString::fromStdString(ni -> name));
|
||||
ui.orgloc->setText(QString::fromStdString(ni -> org + "/" + ni -> loc));
|
||||
ui.country->setText(QString::fromStdString(ni -> country + "/" + ni -> state));
|
||||
ui.name->setText(QString::fromStdString(detail.name));
|
||||
ui.orgloc->setText(QString::fromStdString(detail.org));
|
||||
ui.country->setText(QString::fromStdString(detail.location));
|
||||
|
||||
/* set local address */
|
||||
ui.localAddress->setText(QString::fromStdString(ni->localAddr));
|
||||
ui.localPort -> setValue(ni->localPort);
|
||||
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
|
||||
ui.localPort -> setValue(detail.localPort);
|
||||
/* set the server address */
|
||||
ui.extAddress->setText(QString::fromStdString(ni->extAddr));
|
||||
ui.extPort -> setValue(ni->extPort);
|
||||
/* set the url for DNS access */
|
||||
ui.extName->setText(QString::fromStdString(ni->extName));
|
||||
ui.chkFirewall ->setChecked(ni->firewalled);
|
||||
ui.chkForwarded ->setChecked(ni->forwardPort);
|
||||
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
|
||||
ui.extPort -> setValue(detail.extPort);
|
||||
|
||||
/* set the url for DNS access (OLD) */
|
||||
ui.extName->setText(QString::fromStdString(""));
|
||||
|
||||
/**** TODO ****/
|
||||
//ui.chkFirewall ->setChecked(ni->firewalled);
|
||||
//ui.chkForwarded ->setChecked(ni->forwardPort);
|
||||
ui.chkFirewall ->setChecked(0);
|
||||
ui.chkForwarded ->setChecked(0);
|
||||
|
||||
ui.indivRate->setValue(ni->maxRate);
|
||||
ui.indivRate->setValue(0);
|
||||
|
||||
ui.trustLvl->setText(QString::fromStdString(ni->trustString));
|
||||
ui.trustLvl->setText(QString::fromStdString(RsPeerTrustString(detail.trustLvl)));
|
||||
|
||||
if (ni->ownsign)
|
||||
if (detail.ownsign)
|
||||
{
|
||||
ui.signBox -> setCheckState(Qt::Checked);
|
||||
ui.signBox -> setEnabled(false);
|
||||
if (ni->trustLvl == 5) /* 5 = Trusted, 6 = OwnSign */
|
||||
if (detail.trusted)
|
||||
{
|
||||
ui.trustBox -> setCheckState(Qt::Checked);
|
||||
}
|
||||
@ -128,60 +129,44 @@ void ConfCertDialog::loadDialog()
|
||||
ui.trustBox -> setCheckState(Qt::Unchecked);
|
||||
ui.trustBox -> setEnabled(false);
|
||||
}
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ConfCertDialog::applyDialog()
|
||||
{
|
||||
/* open up the rsiface and get the data */
|
||||
/* get the shared directories */
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
|
||||
/* get the correct friend */
|
||||
const NeighbourInfo *ni = rsiface->getFriend(mId);
|
||||
if (!ni)
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(mId, detail))
|
||||
{
|
||||
/* fail */
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* check if the data is the same */
|
||||
bool localChanged = false;
|
||||
bool extChanged = false;
|
||||
bool fwChanged = false;
|
||||
bool dnsChanged = false;
|
||||
bool signChanged = false;
|
||||
bool trustChanged = false;
|
||||
|
||||
/* set local address */
|
||||
if ((ni->localAddr != ui.localAddress->text().toStdString())
|
||||
|| (ni->localPort != ui.localPort -> value()))
|
||||
if ((detail.localAddr != ui.localAddress->text().toStdString())
|
||||
|| (detail.localPort != ui.localPort -> value()))
|
||||
{
|
||||
/* changed ... set it */
|
||||
localChanged = true;
|
||||
}
|
||||
|
||||
if ((ni->extAddr != ui.extAddress->text().toStdString())
|
||||
|| (ni->extPort != ui.extPort -> value()))
|
||||
if ((detail.extAddr != ui.extAddress->text().toStdString())
|
||||
|| (detail.extPort != ui.extPort -> value()))
|
||||
{
|
||||
/* changed ... set it */
|
||||
extChanged = true;
|
||||
}
|
||||
|
||||
if (ni->extName != ui.extName->text().toStdString())
|
||||
{
|
||||
/* changed ... set it */
|
||||
dnsChanged = true;
|
||||
}
|
||||
|
||||
if ((ni->firewalled != ui.chkFirewall ->isChecked()) ||
|
||||
(ni->forwardPort != ui.chkForwarded ->isChecked()))
|
||||
#if 0
|
||||
if ((detail.firewalled != ui.chkFirewall ->isChecked()) ||
|
||||
(detail.forwardPort != ui.chkForwarded ->isChecked()))
|
||||
{
|
||||
/* changed ... set it */
|
||||
fwChanged = true;
|
||||
@ -191,13 +176,11 @@ void ConfCertDialog::applyDialog()
|
||||
{
|
||||
/* nada */
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ni->ownsign)
|
||||
if (detail.ownsign)
|
||||
{
|
||||
/* check the trust tick */
|
||||
bool trsted = (ni->trustLvl == 5); /* 5 = Trusted, 6 = OwnSign */
|
||||
|
||||
if (trsted != ui.trustBox->isChecked())
|
||||
if (detail.trusted != ui.trustBox->isChecked())
|
||||
{
|
||||
trustChanged = true;
|
||||
}
|
||||
@ -210,30 +193,26 @@ void ConfCertDialog::applyDialog()
|
||||
}
|
||||
}
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
|
||||
/* now we can action the changes */
|
||||
if (localChanged)
|
||||
rsicontrol -> FriendSetLocalAddress(mId,
|
||||
rsPeers->setLocalAddress(mId,
|
||||
ui.localAddress->text().toStdString(), ui.localPort->value());
|
||||
|
||||
if (extChanged)
|
||||
rsicontrol -> FriendSetExtAddress(mId,
|
||||
rsPeers->setExtAddress(mId,
|
||||
ui.extAddress->text().toStdString(), ui.extPort->value());
|
||||
|
||||
if (dnsChanged)
|
||||
rsicontrol -> FriendSetDNSAddress(mId, ui.extName->text().toStdString());
|
||||
|
||||
#if 0
|
||||
if (fwChanged)
|
||||
rsicontrol -> FriendSetFirewall(mId, ui.chkFirewall->isChecked(),
|
||||
ui.chkForwarded->isChecked());
|
||||
#endif
|
||||
|
||||
if (trustChanged)
|
||||
rsicontrol -> FriendTrustSignature(mId, ui.trustBox->isChecked());
|
||||
rsPeers->TrustCertificate(mId, ui.trustBox->isChecked());
|
||||
|
||||
if (signChanged)
|
||||
rsicontrol -> FriendSignCert(mId);
|
||||
rsPeers->SignCertificate(mId);
|
||||
|
||||
/* reload now */
|
||||
loadDialog();
|
||||
|
@ -25,7 +25,9 @@
|
||||
#include "ConnectDialog.h"
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
/** Default constructor */
|
||||
ConnectDialog::ConnectDialog(QWidget *parent, Qt::WFlags flags)
|
||||
@ -124,8 +126,8 @@ void ConnectDialog::authAttempt()
|
||||
|
||||
/* well lets do it ! */
|
||||
std::cerr << "Attempting AuthCode:" << authCode << std::endl;
|
||||
rsicontrol -> NeighAuthFriend(authId, authCode);
|
||||
rsicontrol -> NeighAddFriend(authId);
|
||||
rsPeers->AuthCertificate(authId, authCode);
|
||||
rsPeers->addFriend(authId);
|
||||
|
||||
/* close it up! */
|
||||
closeinfodlg();
|
||||
@ -133,42 +135,44 @@ void ConnectDialog::authAttempt()
|
||||
|
||||
bool ConnectDialog::loadPeer(std::string id)
|
||||
{
|
||||
std::map<RsCertId,NeighbourInfo>::const_iterator it;
|
||||
/* first grab the list of signers (outside lock) */
|
||||
|
||||
char signerstr[1024];
|
||||
rsicontrol->NeighGetSigners(id, signerstr, 1024);
|
||||
|
||||
/* XXX NOTE We must copy the char * to a string,
|
||||
* otherwise it get trampled on by the it = find(id).
|
||||
* ( DONT KNOW WHY???? ) under mingw.
|
||||
*/
|
||||
|
||||
std::string signersString;
|
||||
signersString = signerstr;
|
||||
|
||||
/* grab the interface and check person */
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
|
||||
const std::map<RsCertId,NeighbourInfo> &neighs =
|
||||
rsiface->getNeighbourMap();
|
||||
|
||||
it = neighs.find(id);
|
||||
|
||||
if (it == neighs.end())
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(id, detail))
|
||||
{
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string trustString;
|
||||
|
||||
switch(detail.trustLvl)
|
||||
{
|
||||
case RS_TRUST_LVL_GOOD:
|
||||
trustString = "Good";
|
||||
break;
|
||||
case RS_TRUST_LVL_MARGINAL:
|
||||
trustString = "Marginal";
|
||||
break;
|
||||
case RS_TRUST_LVL_UNKNOWN:
|
||||
default:
|
||||
trustString = "No Trust";
|
||||
break;
|
||||
}
|
||||
|
||||
std::ostringstream out;
|
||||
|
||||
std::list<std::string>::iterator it;
|
||||
for(it = detail.signers.begin(); it != detail.signers.end(); it++)
|
||||
{
|
||||
out << rsPeers->getPeerName(*it) << " <" << *it << ">";
|
||||
out << std::endl;
|
||||
}
|
||||
|
||||
/* setup the gui */
|
||||
setInfo(it->second.name, it->second.trustString, it->second.org,
|
||||
it->second.loc, it->second.country, signersString);
|
||||
setInfo(detail.name, trustString, detail.org,
|
||||
detail.location, detail.email, out.str());
|
||||
|
||||
setAuthCode(id, it->second.authCode);
|
||||
setAuthCode(id, detail.authcode);
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,9 @@
|
||||
#include "rshare.h"
|
||||
#include "ChanMsgDialog.h"
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include <QContextMenuEvent>
|
||||
@ -128,53 +130,52 @@ void ChanMsgDialog::createchannelmsg()
|
||||
|
||||
void ChanMsgDialog::insertSendList()
|
||||
{
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
|
||||
std::map<RsCertId,NeighbourInfo>::const_iterator it;
|
||||
const std::map<RsCertId,NeighbourInfo> &friends =
|
||||
rsiface->getFriendMap();
|
||||
|
||||
if (!rsPeers)
|
||||
{
|
||||
/* not ready yet! */
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<std::string> peers;
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
rsPeers->getFriendList(peers);
|
||||
|
||||
/* get a link to the table */
|
||||
QTreeWidget *sendWidget = ui.msgSendList;
|
||||
|
||||
/* remove old items ??? */
|
||||
sendWidget->clear();
|
||||
sendWidget->setColumnCount(1);
|
||||
|
||||
QList<QTreeWidgetItem *> items;
|
||||
for(it = friends.begin(); it != friends.end(); it++)
|
||||
for(it = peers.begin(); it != peers.end(); it++)
|
||||
{
|
||||
if (it -> second.connectString == "Yourself")
|
||||
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(*it, detail))
|
||||
{
|
||||
/* ok */
|
||||
continue;
|
||||
continue; /* BAD */
|
||||
}
|
||||
|
||||
|
||||
/* make a widget per friend */
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
|
||||
|
||||
/* add all the labels */
|
||||
/* (0) Person */
|
||||
item -> setText(0, QString::fromStdString(it->second.name));
|
||||
item -> setText(0, QString::fromStdString(detail.name));
|
||||
/* () Org */
|
||||
//item -> setText(1, QString::fromStdString(it->second.org));
|
||||
item -> setText(1, QString::fromStdString(detail.org));
|
||||
/* () Location */
|
||||
//item -> setText(2, QString::fromStdString(it->second.loc));
|
||||
item -> setText(2, QString::fromStdString(detail.location));
|
||||
/* () Country */
|
||||
//item -> setText(3, QString::fromStdString(it->second.country));
|
||||
/*{
|
||||
std::ostringstream out;
|
||||
out << it->second.id;
|
||||
item -> setText(4, QString::fromStdString(out.str()));
|
||||
}*/
|
||||
|
||||
item -> setText(1, "Friend");
|
||||
item -> setText(3, QString::fromStdString(detail.email));
|
||||
/* () Id */
|
||||
item -> setText(4, QString::fromStdString(detail.id));
|
||||
|
||||
item -> setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
||||
//item -> setCheckState(0, Qt::Checked);
|
||||
//
|
||||
|
||||
item -> setCheckState(0, Qt::Unchecked);
|
||||
#if 0
|
||||
if (it -> second.inMsg)
|
||||
{
|
||||
item -> setCheckState(0, Qt::Checked);
|
||||
@ -183,16 +184,19 @@ void ChanMsgDialog::insertSendList()
|
||||
{
|
||||
item -> setCheckState(0, Qt::Unchecked);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* add to the list */
|
||||
items.append(item);
|
||||
}
|
||||
|
||||
/* remove old items ??? */
|
||||
sendWidget->clear();
|
||||
sendWidget->setColumnCount(6);
|
||||
|
||||
/* add the items in! */
|
||||
sendWidget->insertTopLevelItems(0, items);
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
sendWidget->update(); /* update display */
|
||||
}
|
||||
|
||||
@ -389,13 +393,15 @@ void ChanMsgDialog::sendMessage()
|
||||
}
|
||||
}
|
||||
|
||||
std::list<std::string> persons;
|
||||
std::list<std::string>::iterator it3;
|
||||
|
||||
#if 0
|
||||
/* get a list of people to send it to */
|
||||
std::map<RsCertId,NeighbourInfo>::const_iterator it2;
|
||||
const std::map<RsCertId,NeighbourInfo> &friends =
|
||||
rsiface->getFriendMap();
|
||||
|
||||
std::list<std::string> persons;
|
||||
std::list<std::string>::iterator it3;
|
||||
|
||||
for(it2 = friends.begin(); it2 != friends.end(); it2++)
|
||||
{
|
||||
@ -408,6 +414,7 @@ void ChanMsgDialog::sendMessage()
|
||||
persons.push_back(out.str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
|
@ -115,6 +115,23 @@ void NotifyQt::UpdateGUI()
|
||||
|
||||
iface->unlockData(); /* UnLock Interface */
|
||||
|
||||
/* hack to force updates until we've fixed that part */
|
||||
static time_t lastTs = 0;
|
||||
|
||||
if (time(NULL) > lastTs + 5)
|
||||
{
|
||||
lastTs = time(NULL);
|
||||
|
||||
uNeigh = true;
|
||||
uFri = true;
|
||||
uTrans = true;
|
||||
uChat = true;
|
||||
uMsg = true;
|
||||
uChan = true;
|
||||
uRecom = true;
|
||||
uConf = true;
|
||||
}
|
||||
|
||||
if (uNeigh)
|
||||
displayNeighbours();
|
||||
|
||||
@ -148,24 +165,6 @@ void NotifyQt::UpdateGUI()
|
||||
|
||||
void NotifyQt::displayNeighbours()
|
||||
{
|
||||
iface->lockData(); /* Lock Interface */
|
||||
|
||||
std::map<RsCertId,NeighbourInfo>::const_iterator it;
|
||||
const std::map<RsCertId,NeighbourInfo> &neighs = iface->getNeighbourMap();
|
||||
|
||||
std::ostringstream out;
|
||||
for(it = neighs.begin(); it != neighs.end(); it++)
|
||||
{
|
||||
out << "Neighbour: ";
|
||||
out << it ->second.name << " ";
|
||||
out << it ->second.status << " ";
|
||||
out << it ->second.trustLvl << " ";
|
||||
out << std::endl;
|
||||
}
|
||||
std::cerr << out.str();
|
||||
|
||||
iface->unlockData(); /* UnLock Interface */
|
||||
|
||||
/* Do the GUI */
|
||||
if (cDialog)
|
||||
cDialog->insertConnect();
|
||||
@ -173,24 +172,6 @@ void NotifyQt::displayNeighbours()
|
||||
|
||||
void NotifyQt::displayFriends()
|
||||
{
|
||||
iface->lockData(); /* Lock Interface */
|
||||
|
||||
std::map<RsCertId,NeighbourInfo>::const_iterator it;
|
||||
const std::map<RsCertId,NeighbourInfo> &friends = iface->getFriendMap();
|
||||
|
||||
std::ostringstream out;
|
||||
for(it = friends.begin(); it != friends.end(); it++)
|
||||
{
|
||||
out << "Friend: ";
|
||||
out << it->second.name << " ";
|
||||
out << it->second.status << " ";
|
||||
out << it->second.trustLvl << " ";
|
||||
out << std::endl;
|
||||
}
|
||||
std::cerr << out.str();
|
||||
|
||||
iface->unlockData(); /* UnLock Interface */
|
||||
|
||||
if (pDialog)
|
||||
pDialog->insertPeers();
|
||||
if (mWindow)
|
||||
|
113
retroshare-gui/src/rsiface/rsgame.h
Normal file
113
retroshare-gui/src/rsiface/rsgame.h
Normal file
@ -0,0 +1,113 @@
|
||||
#ifndef RS_GAME_GUI_INTERFACE_H
|
||||
#define RS_GAME_GUI_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/rsiface: rsgame.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2007-2008 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "rstypes.h"
|
||||
|
||||
|
||||
class RsGameLauncher;
|
||||
|
||||
/* declare single RsIface for everyone to use! */
|
||||
|
||||
extern RsGameLauncher *rsGameLauncher;
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <inttypes.h>
|
||||
|
||||
class RsGameInfo
|
||||
{
|
||||
public:
|
||||
|
||||
std::string gameId;
|
||||
std::string serverId;
|
||||
|
||||
std::string gameType;
|
||||
std::string gameName;
|
||||
std::string serverName;
|
||||
std::string status;
|
||||
uint16_t numPlayers;
|
||||
|
||||
};
|
||||
|
||||
class RsGamePeer
|
||||
{
|
||||
public:
|
||||
std::string name;
|
||||
bool invite;
|
||||
bool interested;
|
||||
bool play;
|
||||
};
|
||||
|
||||
class RsGameDetail
|
||||
{
|
||||
public:
|
||||
std::string gameId;
|
||||
std::string gameType;
|
||||
std::string gameName;
|
||||
|
||||
bool areServer; /* are we the server? */
|
||||
std::string serverId; /* if not, who is? */
|
||||
std::string serverName;
|
||||
|
||||
std::string status;
|
||||
|
||||
uint16_t numPlayers;
|
||||
std::map<std::string, RsGamePeer> gamers;
|
||||
|
||||
};
|
||||
|
||||
class RsGameLauncher
|
||||
{
|
||||
public:
|
||||
|
||||
/* server commands */
|
||||
virtual std::string createGame(uint32_t gameType, std::string name) = 0;
|
||||
virtual bool deleteGame(std::string gameId) = 0;
|
||||
virtual bool inviteGame(std::string gameId) = 0;
|
||||
virtual bool playGame(std::string gameId) = 0;
|
||||
//virtual bool quitGame(std::string gameId) = 0;
|
||||
|
||||
virtual bool invitePeer(std::string gameId, std::string peerId) = 0;
|
||||
virtual bool uninvitePeer(std::string gameId, std::string peerId) = 0;
|
||||
virtual bool confirmPeer(std::string gameId, std::string peerId,
|
||||
int16_t pos = -1) = 0;
|
||||
virtual bool unconfirmPeer(std::string gameId, std::string peerId) = 0;
|
||||
|
||||
/* client commands */
|
||||
virtual bool interestedPeer(std::string gameId) = 0;
|
||||
virtual bool uninterestedPeer(std::string gameId) = 0;
|
||||
|
||||
/* get details */
|
||||
virtual bool getGameList(std::list<RsGameInfo> &gameList) = 0;
|
||||
virtual bool getGameDetail(std::string gameId, RsGameDetail &detail) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -86,14 +86,6 @@ public:
|
||||
virtual void lockData() = 0;
|
||||
virtual void unlockData() = 0;
|
||||
|
||||
const std::map<RsCertId,NeighbourInfo> &getNeighbourMap()
|
||||
{ return mNeighbourMap; }
|
||||
|
||||
const std::map<RsCertId,NeighbourInfo> &getFriendMap()
|
||||
{ return mFriendMap; }
|
||||
|
||||
const NeighbourInfo * getFriend(std::string id);
|
||||
|
||||
const std::list<FileTransferInfo> &getTransferList()
|
||||
{ return mTransferList; }
|
||||
|
||||
@ -167,8 +159,6 @@ bool hasChanged(DataFlags set); /* resets it */
|
||||
void fillLists(); /* create some dummy data to display */
|
||||
|
||||
/* Internals */
|
||||
std::map<RsCertId,NeighbourInfo> mNeighbourMap;
|
||||
std::map<RsCertId,NeighbourInfo> mFriendMap;
|
||||
std::list<PersonInfo> mRemoteDirList;
|
||||
std::list<PersonInfo> mLocalDirList;
|
||||
std::list<FileTransferInfo> mTransferList;
|
||||
@ -202,38 +192,6 @@ virtual ~RsControl() { return; }
|
||||
/* Real Startup Fn */
|
||||
virtual int StartupRetroShare(RsInit *config) = 0;
|
||||
|
||||
/****************************************/
|
||||
/* Neighbour Operations */
|
||||
virtual std::string NeighGetInvite() = 0;
|
||||
virtual int NeighLoadPEMString(std::string pem, std::string &id) = 0;
|
||||
virtual int NeighLoadCertificate(std::string fname, std::string &id) = 0;
|
||||
virtual int NeighAuthFriend(std::string id, RsAuthId code) = 0;
|
||||
virtual int NeighAddFriend(std::string id) = 0;
|
||||
virtual int NeighGetSigners(std::string uid, char *out, int len) = 0;
|
||||
|
||||
/****************************************/
|
||||
/* Friend Operations */
|
||||
virtual int FriendStatus(std::string id, bool accept) = 0;
|
||||
virtual int FriendRemove(std::string id) = 0;
|
||||
virtual int FriendConnectAttempt(std::string id) = 0;
|
||||
|
||||
virtual int FriendSignCert(std::string id) = 0;
|
||||
virtual int FriendTrustSignature(std::string id, bool trust) = 0;
|
||||
|
||||
virtual int FriendSetLocalAddress(std::string id, std::string addr,
|
||||
unsigned short port) = 0;
|
||||
virtual int FriendSetExtAddress(std::string id, std::string addr,
|
||||
unsigned short port) = 0;
|
||||
virtual int FriendSetDNSAddress(std::string id, std::string addr) = 0;
|
||||
virtual int FriendSetFirewall(std::string id, bool firewalled, bool forwarded) = 0;
|
||||
|
||||
virtual int FriendSaveCertificate(std::string id, std::string fname) = 0;
|
||||
|
||||
/*
|
||||
virtual int FriendSetConnectMode(std::string id, int mode) = 0;
|
||||
*/
|
||||
virtual int FriendSetBandwidth(std::string id, float outkB, float inkB) = 0;
|
||||
|
||||
/****************************************/
|
||||
/* Directory Actions */
|
||||
virtual int RequestDirDetails(std::string uid, std::string path, DirDetails &details) = 0;
|
||||
@ -288,8 +246,8 @@ virtual int ClearInRecommend() = 0;
|
||||
|
||||
/****************************************/
|
||||
/* RsIface Networking */
|
||||
virtual int NetworkDHTActive(bool active) = 0;
|
||||
virtual int NetworkUPnPActive(bool active) = 0;
|
||||
//virtual int NetworkDHTActive(bool active) = 0;
|
||||
//virtual int NetworkUPnPActive(bool active) = 0;
|
||||
|
||||
/****************************************/
|
||||
/* Config */
|
||||
@ -297,14 +255,9 @@ virtual int ConfigAddSharedDir( std::string dir ) = 0;
|
||||
virtual int ConfigRemoveSharedDir( std::string dir ) = 0;
|
||||
virtual int ConfigSetIncomingDir( std::string dir ) = 0;
|
||||
|
||||
virtual int ConfigSetLocalAddr( std::string ipAddr, int port ) = 0;
|
||||
virtual int ConfigSetExtAddr( std::string ipAddr, int port ) = 0;
|
||||
virtual int ConfigSetExtName( std::string addr ) = 0;
|
||||
virtual int ConfigSetLanConfig( bool fire, bool forw ) = 0;
|
||||
|
||||
virtual int ConfigSetDataRates( int total, int indiv ) = 0;
|
||||
virtual int ConfigSetBootPrompt( bool on ) = 0;
|
||||
virtual int ConfigSave( ) = 0;
|
||||
//virtual int ConfigSave( ) = 0;
|
||||
|
||||
/****************************************/
|
||||
|
||||
|
147
retroshare-gui/src/rsiface/rspeers.h
Normal file
147
retroshare-gui/src/rsiface/rspeers.h
Normal file
@ -0,0 +1,147 @@
|
||||
#ifndef RETROSHARE_PEER_GUI_INTERFACE_H
|
||||
#define RETROSHARE_PEER_GUI_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/rsiface: rspeer.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2004-2008 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsPeers;
|
||||
extern RsPeers *rsPeers;
|
||||
|
||||
/* Trust Levels */
|
||||
const uint32_t RS_TRUST_LVL_UNKNOWN = 0x0001;
|
||||
const uint32_t RS_TRUST_LVL_MARGINAL = 0x0002;
|
||||
const uint32_t RS_TRUST_LVL_GOOD = 0x0003;
|
||||
|
||||
|
||||
/* Net Mode */
|
||||
const uint32_t RS_NETMODE_UDP = 0x0001;
|
||||
const uint32_t RS_NETMODE_UPNP = 0x0002;
|
||||
const uint32_t RS_NETMODE_EXT = 0x0003;
|
||||
|
||||
/* State */
|
||||
const uint32_t RS_PEER_STATE_FRIEND = 0x0001;
|
||||
const uint32_t RS_PEER_STATE_ONLINE = 0x0002;
|
||||
const uint32_t RS_PEER_STATE_CONNECTED = 0x0004;
|
||||
|
||||
/* A couple of helper functions for translating the numbers games */
|
||||
|
||||
std::string RsPeerTrustString(uint32_t trustLvl);
|
||||
std::string RsPeerStateString(uint32_t state);
|
||||
std::string RsPeerNetModeString(uint32_t netModel);
|
||||
std::string RsPeerLastConnectString(uint32_t lastConnect);
|
||||
|
||||
|
||||
/* Details class */
|
||||
class RsPeerDetails
|
||||
{
|
||||
public:
|
||||
|
||||
RsPeerDetails();
|
||||
|
||||
/* Auth details */
|
||||
std::string id;
|
||||
std::string name;
|
||||
std::string email;
|
||||
std::string location;
|
||||
std::string org;
|
||||
|
||||
std::string fpr; /* fingerprint */
|
||||
std::string authcode;
|
||||
std::list<std::string> signers;
|
||||
|
||||
uint32_t trustLvl;
|
||||
|
||||
bool ownsign; /* we have signed certificate */
|
||||
bool trusted; /* we trust their signature on others */
|
||||
|
||||
/* Network details (only valid if friend) */
|
||||
uint32_t state;
|
||||
|
||||
std::string localAddr;
|
||||
uint16_t localPort;
|
||||
std::string extAddr;
|
||||
uint16_t extPort;
|
||||
|
||||
uint32_t netMode;
|
||||
|
||||
/* basic stats */
|
||||
uint32_t lastConnect; /* how long ago */
|
||||
uint32_t connectPeriod;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsPeerDetails &detail);
|
||||
|
||||
class RsPeers
|
||||
{
|
||||
public:
|
||||
|
||||
RsPeers() { return; }
|
||||
virtual ~RsPeers() { return; }
|
||||
|
||||
/* Updates ... */
|
||||
virtual bool FriendsChanged() = 0;
|
||||
virtual bool OthersChanged() = 0;
|
||||
|
||||
/* Peer Details (Net & Auth) */
|
||||
virtual std::string getOwnId() = 0;
|
||||
|
||||
virtual bool getOnlineList(std::list<std::string> &ids) = 0;
|
||||
virtual bool getFriendList(std::list<std::string> &ids) = 0;
|
||||
virtual bool getOthersList(std::list<std::string> &ids) = 0;
|
||||
|
||||
virtual bool isFriend(std::string id) = 0;
|
||||
virtual std::string getPeerName(std::string id) = 0;
|
||||
virtual bool getPeerDetails(std::string id, RsPeerDetails &d) = 0;
|
||||
|
||||
/* Add/Remove Friends */
|
||||
virtual bool addFriend(std::string id) = 0;
|
||||
virtual bool removeFriend(std::string id) = 0;
|
||||
|
||||
/* Network Stuff */
|
||||
virtual bool connectAttempt(std::string id) = 0;
|
||||
virtual bool setLocalAddress(std::string id, std::string addr, uint16_t port) = 0;
|
||||
virtual bool setExtAddress( std::string id, std::string addr, uint16_t port) = 0;
|
||||
virtual bool setNetworkMode(std::string id, uint32_t netMode) = 0;
|
||||
|
||||
/* Auth Stuff */
|
||||
virtual std::string GetRetroshareInvite() = 0;
|
||||
|
||||
virtual bool LoadCertificateFromFile(std::string fname, std::string &id) = 0;
|
||||
virtual bool LoadCertificateFromString(std::string cert, std::string &id) = 0;
|
||||
virtual bool SaveCertificateToFile(std::string id, std::string fname) = 0;
|
||||
virtual std::string SaveCertificateToString(std::string id) = 0;
|
||||
|
||||
virtual bool AuthCertificate(std::string id, std::string code) = 0;
|
||||
virtual bool SignCertificate(std::string id) = 0;
|
||||
virtual bool TrustCertificate(std::string id, bool trust) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -75,48 +75,6 @@ class BaseInfo
|
||||
mutable unsigned int mId; /* (GUI) Model Id -> unique number */
|
||||
};
|
||||
|
||||
class NeighbourInfo: public BaseInfo
|
||||
{
|
||||
public:
|
||||
std::string name;
|
||||
std::string org;
|
||||
std::string loc;
|
||||
std::string state;
|
||||
std::string country;
|
||||
int trustLvl;
|
||||
std::string trustString;
|
||||
std::list<RsCertId> signers;
|
||||
std::string authCode;
|
||||
int status;
|
||||
|
||||
std::string acceptString;
|
||||
std::string statusString;
|
||||
std::string connectString;
|
||||
std::string lastConnect;
|
||||
std::string peerAddress;
|
||||
|
||||
/* server settings */
|
||||
std::string localAddr;
|
||||
int localPort;
|
||||
std::string extAddr;
|
||||
int extPort;
|
||||
std::string extName;
|
||||
|
||||
bool firewalled;
|
||||
bool forwardPort;
|
||||
|
||||
int maxRate; /* kb */
|
||||
|
||||
bool ownsign;
|
||||
|
||||
/* Flags to indicate if they are in
|
||||
* chat or msg list
|
||||
*/
|
||||
|
||||
bool inChat;
|
||||
bool inMsg;
|
||||
};
|
||||
|
||||
/********************** For the Directory Listing *****************/
|
||||
|
||||
class FileInfo: public BaseInfo
|
||||
@ -345,7 +303,6 @@ class SearchRequest
|
||||
};
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const NeighbourInfo &info);
|
||||
std::ostream &operator<<(std::ostream &out, const MessageInfo &info);
|
||||
std::ostream &operator<<(std::ostream &out, const ChannelInfo &info);
|
||||
std::ostream &operator<<(std::ostream &out, const ChatInfo &info);
|
||||
|
Loading…
x
Reference in New Issue
Block a user