aboutsummaryrefslogtreecommitdiff
path: root/src/Core/CoreObject/serverinfostructure.h
blob: 4f86adba20c8705eae22b645b44a12615a208fc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef SERVERINFOSTRUCTURE_H
#define SERVERINFOSTRUCTURE_H

#include <QDateTime>
#include <QHostAddress>

struct ServerInfo
{
    // server address
    QHostAddress ip;

    // server port
    unsigned short port = 0;

    // gamename
    QString gamename = "";

    // date that the serverinfo was added or last updated
    qint64 time = QDateTime::currentSecsSinceEpoch();
};

// compare operator
inline bool operator== (const ServerInfo serverInfo1, const ServerInfo serverInfo2)
{
    // compare address, port and gamename. ignore time.
    return ( serverInfo1.ip.isEqual(serverInfo2.ip) and
             serverInfo1.port == serverInfo2.port and
             serverInfo1.gamename == serverInfo2.gamename );
}

#endif // SERVERINFOSTRUCTURE_H