Message flags are now consistently used as Message::Flags rather than quint8.
[quassel.git] / src / core / networkconnection.h
index 5f59313..0745e9e 100644 (file)
@@ -109,7 +109,7 @@ signals:
   void recvRawServerMsg(QString);
   void displayStatusMsg(QString);
   //void displayMsg(Message msg);
-  void displayMsg(Message::Type, BufferInfo::Type, QString target, QString text, QString sender = "", quint8 flags = Message::None);
+  void displayMsg(Message::Type, BufferInfo::Type, QString target, QString text, QString sender = "", Message::Flags flags = Message::None);
   void connected(NetworkId networkId);   ///< Emitted after receipt of 001 to indicate that we can now send data to the IRC server
   void disconnected(NetworkId networkId);
   void connectionStateChanged(Network::ConnectionState);
@@ -147,6 +147,8 @@ private slots:
   void sslErrors(const QList<QSslError> &errors);
 #endif
 
+  void fillBucketAndProcessQueue();
+
 private:
 #ifndef QT_NO_OPENSSL
   QSslSocket socket;
@@ -180,6 +182,15 @@ private:
   int _autoWhoDelay;
   QTimer _autoWhoTimer, _autoWhoCycleTimer;
 
+  QTimer _tokenBucketTimer;
+  int _messagesPerSecond;   // token refill speed
+  int _burstSize;   // size of the token bucket
+  int _tokenBucket; // the virtual bucket that holds the tokens
+  QList<QByteArray> _msgQueue;
+
+  void writeToSocket(QByteArray s);
+
+
 
   class ParseError : public Exception {
   public: