/***************************************************************************
- * Copyright (C) 2005-08 by the Quassel Project *
+ * Copyright (C) 2005-09 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#include <QString>
#include <QStringList>
#include <QList>
+#include <QNetworkProxy>
#include <QHash>
#include <QVariantMap>
#include <QPointer>
#include <QMutex>
#include "types.h"
+#include "util.h"
#include "syncableobject.h"
#include "signalproxy.h"
uint port;
QString password;
bool useSsl;
- Server() : port(0), useSsl(false) {}
- Server(const QString &host, uint port, const QString &password, bool useSsl)
- : host(host), port(port), password(password), useSsl(useSsl) {}
+ int sslVersion;
+
+ bool useProxy;
+ int proxyType;
+ QString proxyHost;
+ uint proxyPort;
+ QString proxyUser;
+ QString proxyPass;
- static Server fromVariant(const QVariant &variant);
- QVariant toVariant() const;
+ Server() : port(6667), useSsl(false), sslVersion(0), useProxy(false), proxyType(QNetworkProxy::Socks5Proxy), proxyHost("localhost"), proxyPort(8080) {}
+ Server(const QString &host, uint port, const QString &password, bool useSsl)
+ : host(host), port(port), password(password), useSsl(useSsl), sslVersion(0),
+ useProxy(false), proxyType(QNetworkProxy::Socks5Proxy), proxyHost("localhost"), proxyPort(8080) {}
+ bool operator==(const Server &other) const;
+ bool operator!=(const Server &other) const;
};
typedef QList<Server> ServerList;
QStringList nicks() const;
inline QStringList channels() const { return _ircChannels.keys(); }
inline const ServerList &serverList() const { return _serverList; }
- QVariantList variantServerList() const;
inline bool useRandomServer() const { return _useRandomServer; }
inline const QStringList &perform() const { return _perform; }
inline bool useAutoIdentify() const { return _useAutoIdentify; }
inline bool autoAwayActive() const { return _autoAwayActive; }
inline void setAutoAwayActive(bool active) { _autoAwayActive = active; }
+ static QStringList presetNetworks(bool onlyDefault = false);
+ static QStringList presetDefaultChannels(const QString &networkName);
+ static NetworkInfo networkInfoFromPreset(const QString &networkName);
+
public slots:
void setNetworkName(const QString &networkName);
void setCurrentServer(const QString ¤tServer);
//init geters
QVariantMap initSupports() const;
- inline QVariantList initServerList() const { return variantServerList(); }
+ inline QVariantList initServerList() const { return toVariantList(serverList()); }
virtual QVariantMap initIrcUsersAndChannels() const;
//init seters
void initSetSupports(const QVariantMap &supports);
- void initSetServerList(const QVariantList &serverList);
+ inline void initSetServerList(const QVariantList &serverList) { _serverList = fromVariantList<Server>(serverList); }
virtual void initSetIrcUsersAndChannels(const QVariantMap &usersAndChannels);
IrcUser *updateNickFromMask(const QString &mask);
bool _autoAwayActive; // when this is active handle305 and handle306 don't trigger any output
+ static QString _networksIniPath;
+
friend class IrcUser;
friend class IrcChannel;
};
//! Stores all editable information about a network (as opposed to runtime state).
struct NetworkInfo {
+ // set some default values, note that this does not initialize e.g. name and id
+ NetworkInfo();
+
NetworkId networkId;
QString networkName;
IdentityId identity;
QByteArray codecForEncoding;
QByteArray codecForDecoding;
- // Server entry: QString "Host", uint "Port", QString "Password", bool "UseSSL"
- QVariantList serverList;
+ Network::ServerList serverList;
bool useRandomServer;
QStringList perform;
QDataStream &operator<<(QDataStream &out, const NetworkInfo &info);
QDataStream &operator>>(QDataStream &in, NetworkInfo &info);
QDebug operator<<(QDebug dbg, const NetworkInfo &i);
-
Q_DECLARE_METATYPE(NetworkInfo)
+QDataStream &operator<<(QDataStream &out, const Network::Server &server);
+QDataStream &operator>>(QDataStream &in, Network::Server &server);
+QDebug operator<<(QDebug dbg, const Network::Server &server);
+Q_DECLARE_METATYPE(Network::Server)
+
#endif