reverting some very work-in-progress / play around stuff
authorMarcus Eggenberger <egs@quassel-irc.org>
Sun, 6 Jul 2008 11:44:44 +0000 (13:44 +0200)
committerMarcus Eggenberger <egs@quassel-irc.org>
Sun, 6 Jul 2008 11:44:44 +0000 (13:44 +0200)
src/common/ircuser.cpp
src/common/ircuser.h
src/common/network.cpp
src/common/network.h

index af3cb3e..22df0c9 100644 (file)
 #include "ircuser.h"
 #include "util.h"
 
 #include "ircuser.h"
 #include "util.h"
 
+#include "network.h"
 #include "signalproxy.h"
 #include "ircchannel.h"
 
 #include <QTextCodec>
 #include <QDebug>
 
 #include "signalproxy.h"
 #include "ircchannel.h"
 
 #include <QTextCodec>
 #include <QDebug>
 
-IrcUser::IrcUser(const QString &hostmask, Network *network)
-  : SyncableObject(network),
+IrcUser::IrcUser(const QString &hostmask, Network *network) : SyncableObject(network),
     _initialized(false),
     _initialized(false),
-    _nick(network->encodeServerString(nickFromMask(hostmask))),
-    _user(network->encodeServerString(userFromMask(hostmask))),
-    _host(network->encodeServerString(hostFromMask(hostmask))),
+    _nick(nickFromMask(hostmask)),
+    _user(userFromMask(hostmask)),
+    _host(hostFromMask(hostmask)),
     _realName(),
     _awayMessage(),
     _away(false),
     _realName(),
     _awayMessage(),
     _away(false),
@@ -107,22 +107,16 @@ QByteArray IrcUser::encodeString(const QString &string) const {
 //  PUBLIC SLOTS:
 // ====================
 void IrcUser::setUser(const QString &user) {
 //  PUBLIC SLOTS:
 // ====================
 void IrcUser::setUser(const QString &user) {
-  if(!user.isEmpty()) {
-    QByteArray newUser = network()->encodeServerString(user);
-    if(newUser != _user) {
-      _user = newUser;
-      emit userSet(user);
-    }
+  if(!user.isEmpty() && _user != user) {
+    _user = user;
+    emit userSet(user);
   }
 }
 
 void IrcUser::setRealName(const QString &realName) {
   }
 }
 
 void IrcUser::setRealName(const QString &realName) {
-  if(!realName.isEmpty()) {
-    QByteArray newRealName = network()->encodeServerString(realName);
-    if(newRealName != _realName) {
-      _realName = newRealName;
-      emit realNameSet(realName);
-    }
+  if (!realName.isEmpty() && _realName != realName) {
+    _realName = realName;
+    emit realNameSet(realName);
   }
 }
 
   }
 }
 
@@ -134,12 +128,9 @@ void IrcUser::setAway(const bool &away) {
 }
 
 void IrcUser::setAwayMessage(const QString &awayMessage) {
 }
 
 void IrcUser::setAwayMessage(const QString &awayMessage) {
-  if(!awayMessage.isEmpty()) {
-    QByteArray newAwayMessage = network()->encodeServerString(awayMessage);
-    if(newAwayMessage != _awayMessage) {
-      _awayMessage = newAwayMessage;
-      emit awayMessageSet(awayMessage);
-    }
+  if(!awayMessage.isEmpty() && _awayMessage != awayMessage) {
+    _awayMessage = awayMessage;
+    emit awayMessageSet(awayMessage);
   }
 }
 
   }
 }
 
@@ -180,23 +171,17 @@ void IrcUser::setLastAwayMessage(const int &lastAwayMessage) {
 }
 
 void IrcUser::setHost(const QString &host) {
 }
 
 void IrcUser::setHost(const QString &host) {
-  if(!host.isEmpty()) {
-    QByteArray newHost = network()->encodeServerString(host);
-    if(newHost != _host) {
-      _host = newHost;
-      emit hostSet(host);
-    }
+  if(!host.isEmpty() && _host != host) {
+    _host = host;
+    emit hostSet(host);
   }
 }
 
 void IrcUser::setNick(const QString &nick) {
   }
 }
 
 void IrcUser::setNick(const QString &nick) {
-  if(!nick.isEmpty()) {
-    QByteArray newNick = network()->encodeServerString(nick);
-    if(newNick != _nick) {
-      _nick = newNick;
-      updateObjectName();
-      emit nickSet(nick);
-    }
+  if(!nick.isEmpty() && nick != _nick) {
+    _nick = nick;
+    updateObjectName();
+    emit nickSet(nick);
   }
 }
 
   }
 }
 
@@ -215,7 +200,7 @@ void IrcUser::setSuserHost(const QString &suserHost) {
 }
 
 void IrcUser::updateObjectName() {
 }
 
 void IrcUser::updateObjectName() {
-  renameObject(QString::number(network()->networkId().toInt()) + "/" + nick());
+  renameObject(QString::number(network()->networkId().toInt()) + "/" + _nick);
 }
 
 void IrcUser::updateHostmask(const QString &mask) {
 }
 
 void IrcUser::updateHostmask(const QString &mask) {
index f2f84ff..00df169 100644 (file)
@@ -28,9 +28,9 @@
 #include <QDateTime>
 
 #include "syncableobject.h"
 #include <QDateTime>
 
 #include "syncableobject.h"
-#include "network.h"
 
 class SignalProxy;
 
 class SignalProxy;
+class Network;
 class IrcChannel;
 
 class IrcUser : public SyncableObject {
 class IrcChannel;
 
 class IrcUser : public SyncableObject {
@@ -57,13 +57,13 @@ public:
   IrcUser(const QString &hostmask, Network *network);
   virtual ~IrcUser();
 
   IrcUser(const QString &hostmask, Network *network);
   virtual ~IrcUser();
 
-  inline QString user() const { return network()->decodeServerString(_user); }
-  inline QString host() const { return network()->decodeServerString(_host); }
-  inline QString nick() const { return network()->decodeServerString(_nick); }
-  inline QString realName() const { return network()->decodeServerString(_realName); }
+  inline QString user() const { return _user; }
+  inline QString host() const { return _host; }
+  inline QString nick() const { return _nick; }
+  inline QString realName() const { return _realName; }
   QString hostmask() const;
   inline bool isAway() const { return _away; }
   QString hostmask() const;
   inline bool isAway() const { return _away; }
-  inline QString awayMessage() const { return network()->decodeServerString(_awayMessage); }
+  inline QString awayMessage() const { return _awayMessage; }
   QDateTime idleTime();
   inline QDateTime loginTime() const { return _loginTime; }
   inline QString server() const { return _server; }
   QDateTime idleTime();
   inline QDateTime loginTime() const { return _loginTime; }
   inline QString server() const { return _server; }
@@ -153,11 +153,11 @@ private:
 
   bool _initialized;
 
 
   bool _initialized;
 
-  QByteArray _nick;
-  QByteArray _user;
-  QByteArray _host;
-  QByteArray _realName;
-  QByteArray _awayMessage;
+  QString _nick;
+  QString _user;
+  QString _host;
+  QString _realName;
+  QString _awayMessage;
   bool _away;
   QString _server;
   QDateTime _idleTime;
   bool _away;
   QString _server;
   QDateTime _idleTime;
index 38d5095..cfcda7d 100644 (file)
@@ -22,7 +22,6 @@
 #include <QDebug>
 #include <QTextCodec>
 
 #include <QDebug>
 #include <QTextCodec>
 
-#include "ircuser.h"
 #include "util.h"
 
 QTextCodec *Network::_defaultCodecForServer = 0;
 #include "util.h"
 
 QTextCodec *Network::_defaultCodecForServer = 0;
index 6631043..3759e56 100644 (file)
 #include "syncableobject.h"
 
 #include "signalproxy.h"
 #include "syncableobject.h"
 
 #include "signalproxy.h"
+#include "ircuser.h"
 #include "ircchannel.h"
 
 #include "ircchannel.h"
 
-class IrcUser;
-
 // defined below!
 struct NetworkInfo;
 
 // defined below!
 struct NetworkInfo;
 
@@ -98,7 +97,7 @@ public:
   inline void setProxy(SignalProxy *proxy) { _proxy = proxy; }
 
   inline bool isMyNick(const QString &nick) const { return (myNick().toLower() == nick.toLower()); }
   inline void setProxy(SignalProxy *proxy) { _proxy = proxy; }
 
   inline bool isMyNick(const QString &nick) const { return (myNick().toLower() == nick.toLower()); }
-  inline bool isMe(IrcUser *ircuser) const { return (ircuser == me()); }
+  inline bool isMe(IrcUser *ircuser) const { return (ircuser->nick().toLower() == myNick().toLower()); }
 
   bool isChannelName(const QString &channelname) const;
 
 
   bool isChannelName(const QString &channelname) const;