blob: f3e82202fe999837ec67bd7d1421004d5f1ffaf8 (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/*
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.
*/
/*
Copyright (C) 2007 Shintaro Matsuoka <shin@shoegazed.org>
*/
#ifndef DCCCOMMON_H
#define DCCCOMMON_H
#include <qstring.h>
class QObject;
namespace KNetwork
{
class KServerSocket;
}
class Server;
class DccCommon
{
public:
// converts an IP text like "127.0.0.1" to a number.
static QString textIpToNumericalIp( const QString& ipString );
// converts a numerical IP text like "12345678" to a normal IP text.
static QString numericalIpToTextIp( const QString& numericalIp );
// returns the self IP following the setting.
static QString getOwnIp( Server* server = 0 );
// creates an instance of KNetwork::ServerSocket following the DCC settings
static KNetwork::KServerSocket* createServerSocketAndListen( QObject* parent = 0, QString* failedReason = 0, int minPort = 0, int maxPort = 0 );
// returns the port number from a server socket
static int getServerSocketPort( KNetwork::KServerSocket* serverSocket );
private:
DccCommon();
};
#endif // DCCCOMMON_H
|