From: Stéphane Bisinger <stephane.bisinger@gmail.com>
Date: Mon, 22 Oct 2007 10:13:27 +0000 (+0200)
Subject: Ignored NOT messages by notification Server in libmsn
X-Git-Url: http://repo.or.cz/w/centerim.git?a=commitdiff_plain;h=d39011362c9acd044bcecebc237452448cb6af6e
Ignored NOT messages by notification Server in libmsn
---
diff --git a/libmsn/msn/notificationserver.cpp b/libmsn/msn/notificationserver.cpp
index 3104f8f..8feb245 100644
--- a/libmsn/msn/notificationserver.cpp
+++ b/libmsn/msn/notificationserver.cpp
@@ -152,6 +152,7 @@ namespace MSN
commandHandlers["CHL"] = &NotificationServerConnection::handle_CHL;
commandHandlers["ILN"] = &NotificationServerConnection::handle_ILN;
commandHandlers["NLN"] = &NotificationServerConnection::handle_NLN;
+ commandHandlers["NOT"] = &NotificationServerConnection::handle_NOT;
commandHandlers["FLN"] = &NotificationServerConnection::handle_FLN;
commandHandlers["MSG"] = &NotificationServerConnection::handle_MSG;
commandHandlers["ADG"] = &NotificationServerConnection::handle_ADG;
@@ -282,6 +283,13 @@ namespace MSN
this->myNotificationServer()->externalCallbacks.buddyChangedStatus(this, args[2], decodeURL(args[3]), buddyStatusFromString(args[1]));
}
+ void NotificationServerConnection::handle_NOT(std::vector<std::string> & args)
+ {
+ this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+ int notlen = decimalFromString(args[1]);
+ this->readBuffer = this->readBuffer.substr(notlen);
+ }
+
void NotificationServerConnection::handle_FLN(std::vector<std::string> & args)
{
this->assertConnectionStateIsAtLeast(NS_CONNECTED);
@@ -570,10 +578,12 @@ public:
else
dataLength = decimalFromString(args[1]);
- if (this->readBuffer.find("\r\n") + 2 + dataLength > this->readBuffer.size())
+ if (this->readBuffer.find("\r\n", 0) + 2 + dataLength > this->readBuffer.size()) {
+ this->myNotificationServer()->externalCallbacks.showError(this, "Could not read buffer: too small");
return;
+ }
}
- this->readBuffer = this->readBuffer.substr(this->readBuffer.find("\r\n") + 2);
+ this->readBuffer = this->readBuffer.substr(this->readBuffer.find("\r\n", 0) + 2);
int trid = 0;
if (args.size() >= 6 && args[0] == "XFR" && args[2] == "NS")
@@ -602,7 +612,7 @@ public:
// QNG
// 0
- this->_nextPing = decimalFromString(args[1]);
+ this->_nextPing = decimalFromString(args[1]);
return;
}
diff --git a/libmsn/msn/notificationserver.h b/libmsn/msn/notificationserver.h
index 5fba4ea..b7f3c5a 100644
--- a/libmsn/msn/notificationserver.h
+++ b/libmsn/msn/notificationserver.h
@@ -285,13 +285,13 @@ public:
};
NotificationServerState connectionState() const { return this->_connectionState; };
- unsigned int nextPing() { return this->_nextPing; };
+ unsigned int nextPing() { return this->_nextPing; };
Callbacks & externalCallbacks;
virtual NotificationServerConnection *myNotificationServer() { return this; };
protected:
virtual void handleIncomingData();
NotificationServerState _connectionState;
- unsigned int _nextPing;
+ unsigned int _nextPing;
void setConnectionState(NotificationServerState s) { this->_connectionState = s; };
void assertConnectionStateIs(NotificationServerState s) { assert(this->_connectionState == s); };
@@ -315,6 +315,7 @@ private:
void handle_CHL(std::vector<std::string> & args);
void handle_ILN(std::vector<std::string> & args);
void handle_NLN(std::vector<std::string> & args);
+ void handle_NOT(std::vector<std::string> & args);
void handle_FLN(std::vector<std::string> & args);
void handle_MSG(std::vector<std::string> & args);
void handle_RNG(std::vector<std::string> & args);