1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-16 09:40:13 +00:00

36 lines
755 B
C
Raw Normal View History

#ifndef QPEER_H
#define QPEER_H
#include <libtorrent/entry.hpp>
#include <QString>
struct QPeer {
bool operator!=(const QPeer &other) const {
return qhash() != other.qhash();
}
bool operator==(const QPeer &other) const {
return qhash() == other.qhash();
}
QString qhash() const {
return ip+":"+QString::number(port);
}
libtorrent::entry toEntry(bool no_peer_id) const {
libtorrent::entry::dictionary_type peer_map;
2012-02-20 19:30:53 +02:00
if (!no_peer_id)
peer_map["id"] = libtorrent::entry(peer_id.toStdString());
peer_map["ip"] = libtorrent::entry(ip.toStdString());
peer_map["port"] = libtorrent::entry(port);
return libtorrent::entry(peer_map);
}
QString ip;
QString peer_id;
int port;
};
#endif // QPEER_H