We require cmake-2.6 now. Also LINGUAS should work again...
[quassel.git] / src / common / network.cpp
index c813ebb..1098b0a 100644 (file)
@@ -36,6 +36,7 @@ Network::Network(const NetworkId &networkid, QObject *parent)
     _networkId(networkid),
     _identity(0),
     _myNick(QString()),
+    _latency(0),
     _networkName(QString("<not initialized>")),
     _currentServer(QString()),
     _connected(false),
@@ -429,6 +430,13 @@ void Network::setMyNick(const QString &nickname) {
   emit myNickSet(nickname);
 }
 
+void Network::setLatency(int latency) {
+  if(_latency == latency)
+    return;
+  _latency = latency;
+  emit latencySet(latency);
+}
+
 void Network::setIdentity(IdentityId id) {
   _identity = id;
   emit identitySet(id);
@@ -529,7 +537,7 @@ QVariantMap Network::initIrcUsersAndChannels() const {
   QHash<QString, IrcChannel *>::const_iterator channelIter = _ircChannels.constBegin();
   QHash<QString, IrcChannel *>::const_iterator channelIterEnd = _ircChannels.constEnd();
   while(channelIter != channelIterEnd) {
-    channels[channelIter.key()] = channelIter.value()->toVariantMap();
+    channels[channelIter.value()->name()] = channelIter.value()->toVariantMap();
     channelIter++;
   }
   usersAndChannels["channels"] = channels;
@@ -539,7 +547,7 @@ QVariantMap Network::initIrcUsersAndChannels() const {
 
 void Network::initSetIrcUsersAndChannels(const QVariantMap &usersAndChannels) {
   Q_ASSERT(proxy());
-  if(!_ircUsers.isEmpty() || !_ircChannels.isEmpty()) {
+  if(isInitialized()) {
     qWarning() << "Network" << networkId() << "received init data for users and channels allthough there allready are known users or channels!";
     return;
   }
@@ -676,16 +684,16 @@ void Network::emitConnectionError(const QString &errorMsg) {
 // ====================
 void Network::determinePrefixes() {
   // seems like we have to construct them first
-  QString PREFIX = support("PREFIX");
+  QString prefix = support("PREFIX");
   
-  if(PREFIX.startsWith("(") && PREFIX.contains(")")) {
-    _prefixes = PREFIX.section(")", 1);
-    _prefixModes = PREFIX.mid(1).section(")", 0, 0);
+  if(prefix.startsWith("(") && prefix.contains(")")) {
+    _prefixes = prefix.section(")", 1);
+    _prefixModes = prefix.mid(1).section(")", 0, 0);
   } else {
     QString defaultPrefixes("~&@%+");
     QString defaultPrefixModes("qaohv");
 
-    if(PREFIX.isEmpty()) {
+    if(prefix.isEmpty()) {
       _prefixes = defaultPrefixes;
       _prefixModes = defaultPrefixModes;
       return;
@@ -693,7 +701,7 @@ void Network::determinePrefixes() {
 
     // we just assume that in PREFIX are only prefix chars stored
     for(int i = 0; i < defaultPrefixes.size(); i++) {
-      if(PREFIX.contains(defaultPrefixes[i])) {
+      if(prefix.contains(defaultPrefixes[i])) {
        _prefixes += defaultPrefixes[i];
        _prefixModes += defaultPrefixModes[i];
       }
@@ -705,7 +713,7 @@ void Network::determinePrefixes() {
     // well... our assumption was obviously wrong...
     // check if it's only prefix modes
     for(int i = 0; i < defaultPrefixes.size(); i++) {
-      if(PREFIX.contains(defaultPrefixModes[i])) {
+      if(prefix.contains(defaultPrefixModes[i])) {
        _prefixes += defaultPrefixes[i];
        _prefixModes += defaultPrefixModes[i];
       }