current highlighted search result is no longer reset when the search string changes...
[quassel.git] / src / common / network.cpp
index e763fb9..ed66ee3 100644 (file)
@@ -51,7 +51,8 @@ Network::Network(const NetworkId &networkid, QObject *parent)
     _unlimitedReconnectRetries(false),
     _codecForServer(0),
     _codecForEncoding(0),
-    _codecForDecoding(0)
+    _codecForDecoding(0),
+    _autoAwayActive(false)
 {
   setObjectName(QString::number(networkid.toInt()));
 }
@@ -255,7 +256,7 @@ IrcUser *Network::ircUser(QString nickname) const {
 
 IrcChannel *Network::newIrcChannel(const QString &channelname) {
   if(!_ircChannels.contains(channelname.toLower())) {
-    IrcChannel *channel = new IrcChannel(channelname, this);
+    IrcChannel *channel = ircChannelFactory(channelname);
 
     if(proxy())
       proxy()->synchronize(channel);
@@ -547,7 +548,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;
   }
@@ -586,7 +587,7 @@ void Network::initSetIrcUsersAndChannels(const QVariantMap &usersAndChannels) {
 
   while(channelIter != channelIterEnd) {
     channelName = channelIter.key();
-    ircChannel = new IrcChannel(channelName, this);
+    ircChannel = ircChannelFactory(channelName);
     ircChannel->fromVariantMap(channelIter.value().toMap());
     ircChannel->setInitialized();
     proxy()->synchronize(ircChannel);
@@ -684,16 +685,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;
@@ -701,7 +702,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];
       }
@@ -713,7 +714,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];
       }