logo       

r350 - branches/libmsn-3.2.x/msn: msg#00024

Subject: r350 - branches/libmsn-3.2.x/msn
Author: bdash
Date: 2005-02-17 00:35:18 +1300 (Thu, 17 Feb 2005)
New Revision: 350

Modified:
   branches/libmsn-3.2.x/msn/notificationserver.cpp
   branches/libmsn-3.2.x/msn/notificationserver.h
   branches/libmsn-3.2.x/msn/switchboardserver.cpp
   branches/libmsn-3.2.x/msn/switchboardserver.h
Log:
Switch to macro implementations so that we get some useful output from 
assertions... line numbers are *good*.

Modified: branches/libmsn-3.2.x/msn/notificationserver.cpp
===================================================================
--- branches/libmsn-3.2.x/msn/notificationserver.cpp    2005-02-16 10:44:40 UTC 
(rev 349)
+++ branches/libmsn-3.2.x/msn/notificationserver.cpp    2005-02-16 11:35:18 UTC 
(rev 350)
@@ -44,6 +44,10 @@
 #warning Your version of libcurl lacks curl_free.  Please consider upgrading 
to a more recent version.
 #endif
 
+#define assertConnectionStateIs(s) assert(this->_connectionState == s)
+#define assertConnectionStateIsNot(s) assert(this->_connectionState != s)
+#define assertConnectionStateIsAtLeast(s) assert(this->_connectionState >= s)
+
 namespace MSN
 {
     std::map<std::string, void 
(NotificationServerConnection::*)(std::vector<std::string> &)> 
NotificationServerConnection::commandHandlers;
@@ -76,7 +80,7 @@
     
     Connection *NotificationServerConnection::connectionWithSocket(int fd)
     {
-        this->assertConnectionStateIsNot(NS_DISCONNECTED);
+        assertConnectionStateIsNot(NS_DISCONNECTED);
         std::list<SwitchboardServerConnection *> & list = 
_switchboardConnections;
         std::list<SwitchboardServerConnection *>::iterator i = list.begin();
         
@@ -111,32 +115,32 @@
     
     const std::list<SwitchboardServerConnection *> & 
NotificationServerConnection::switchboardConnections()
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         return _switchboardConnections;
     }
     
     void 
NotificationServerConnection::addSwitchboardConnection(SwitchboardServerConnection
 *c)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);        
+        assertConnectionStateIsAtLeast(NS_CONNECTED);        
         _switchboardConnections.push_back(c);
     }
 
     void 
NotificationServerConnection::removeSwitchboardConnection(SwitchboardServerConnection
 *c)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);        
+        assertConnectionStateIsAtLeast(NS_CONNECTED);        
         _switchboardConnections.remove(c);
     }
     
     void NotificationServerConnection::addCallback(NotificationServerCallback 
callback,
                                                    int trid, void *data)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTING);        
+        assertConnectionStateIsAtLeast(NS_CONNECTING);        
         this->callbacks[trid] = std::make_pair(callback, data);
     }
     
     void NotificationServerConnection::removeCallback(int trid)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTING);        
+        assertConnectionStateIsAtLeast(NS_CONNECTING);        
         this->callbacks.erase(trid);
     }
     
@@ -164,7 +168,7 @@
     
     void 
NotificationServerConnection::dispatchCommand(std::vector<std::string> & args)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);        
+        assertConnectionStateIsAtLeast(NS_CONNECTED);        
         std::map<std::string, void 
(NotificationServerConnection::*)(std::vector<std::string> &)>::iterator i = 
commandHandlers.find(args[0]);
         if (i != commandHandlers.end())
             (this->*commandHandlers[args[0]])(args);
@@ -172,7 +176,7 @@
     
     void NotificationServerConnection::handle_OUT(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);        
+        assertConnectionStateIsAtLeast(NS_CONNECTED);        
         if (args.size() > 1)
         {
             if (args[1] == "OTH")
@@ -192,7 +196,7 @@
     
     void NotificationServerConnection::handle_ADD(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);        
+        assertConnectionStateIsAtLeast(NS_CONNECTED);        
         if (args[2] == "RL")
         {
             
this->myNotificationServer()->externalCallbacks.gotNewReverseListEntry(this, 
args[4], decodeURL(args[5]));
@@ -210,7 +214,7 @@
 
     void NotificationServerConnection::handle_REM(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         int groupID = -1;
         if (args.size() > 4)
             groupID = decimalFromString(args[4]);
@@ -221,34 +225,34 @@
     
     void NotificationServerConnection::handle_BLP(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         this->myNotificationServer()->externalCallbacks.gotBLP(this, 
args[3][0]);
         
this->myNotificationServer()->externalCallbacks.gotLatestListSerial(this, 
decimalFromString(args[3]));
     }
 
     void NotificationServerConnection::handle_GTC(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         this->myNotificationServer()->externalCallbacks.gotGTC(this, 
args[3][0]);
         
this->myNotificationServer()->externalCallbacks.gotLatestListSerial(this, 
decimalFromString(args[3]));
     }
     
     void NotificationServerConnection::handle_REA(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         this->myNotificationServer()->externalCallbacks.gotFriendlyName(this, 
decodeURL(args[4]));
         
this->myNotificationServer()->externalCallbacks.gotLatestListSerial(this, 
decimalFromString(args[2]));        
     }
     
     void NotificationServerConnection::handle_CHG(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         this->myNotificationServer()->externalCallbacks.changedStatus(this, 
buddyStatusFromString(args[2]));
     }
     
     void NotificationServerConnection::handle_CHL(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         md5_state_t state;
         md5_byte_t digest[16];
         int a;
@@ -274,31 +278,31 @@
     
     void NotificationServerConnection::handle_ILN(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIs(NS_CONNECTED);
+        assertConnectionStateIs(NS_CONNECTED);
         
this->myNotificationServer()->externalCallbacks.buddyChangedStatus(this, 
args[3], decodeURL(args[4]), buddyStatusFromString(args[2]));
     }
     
     void NotificationServerConnection::handle_NLN(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         
this->myNotificationServer()->externalCallbacks.buddyChangedStatus(this, 
args[2], decodeURL(args[3]), buddyStatusFromString(args[1]));
     }
     
     void NotificationServerConnection::handle_FLN(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         this->myNotificationServer()->externalCallbacks.buddyOffline(this, 
args[1]);
     }    
     
     void NotificationServerConnection::handle_MSG(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         Connection::handle_MSG(args);
     }
     
     void NotificationServerConnection::handle_RNG(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         SwitchboardServerConnection::AuthData auth = 
SwitchboardServerConnection::AuthData(this->auth.username,
                                                                                
            args[1],
                                                                                
            args[4]);
@@ -310,21 +314,21 @@
     
     void NotificationServerConnection::handle_ADG(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);        
+        assertConnectionStateIsAtLeast(NS_CONNECTED);        
         this->myNotificationServer()->externalCallbacks.addedGroup(this, 
decodeURL(args[3]), decimalFromString(args[4]));
         
this->myNotificationServer()->externalCallbacks.gotLatestListSerial(this, 
decimalFromString(args[2]));
     }
 
     void NotificationServerConnection::handle_RMG(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         this->myNotificationServer()->externalCallbacks.removedGroup(this, 
decimalFromString(args[3]));
         
this->myNotificationServer()->externalCallbacks.gotLatestListSerial(this, 
decimalFromString(args[2]));
     }
 
     void NotificationServerConnection::handle_REG(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         this->myNotificationServer()->externalCallbacks.renamedGroup(this, 
decimalFromString(args[3]), decodeURL(args[4]));
         
this->myNotificationServer()->externalCallbacks.gotLatestListSerial(this, 
decimalFromString(args[2]));
     }
@@ -332,7 +336,7 @@
 
     void NotificationServerConnection::setState(BuddyStatus state)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         std::ostringstream buf_;
         buf_ << "CHG " << this->trID++ << " " << buddyStatusToString(state) << 
" 0\r\n";
         write(buf_);        
@@ -340,7 +344,7 @@
     
     void NotificationServerConnection::setBLP(char setting)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         std::ostringstream buf_;
         buf_ << "BLP " << this->trID++ << " " << setting << "L\r\n";
         write(buf_);        
@@ -348,7 +352,7 @@
 
     void NotificationServerConnection::setGTC(char setting)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         std::ostringstream buf_;
         buf_ << "GTC " << this->trID++ << " " << setting << "\r\n";
         write(buf_);        
@@ -356,7 +360,7 @@
     
     void NotificationServerConnection::setFriendlyName(std::string 
friendlyName) throw (std::runtime_error)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         if (friendlyName.size() > 387)
             throw std::runtime_error("Friendly name too long!");
         
@@ -367,7 +371,7 @@
 
     void NotificationServerConnection::addToList(std::string list, Passport 
buddyName)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         std::ostringstream buf_;
         buf_ << "ADD " << this->trID++ << " " << list << " " << buddyName << " 
" << buddyName << "\r\n";
         write(buf_);        
@@ -375,7 +379,7 @@
     
     void NotificationServerConnection::removeFromList(std::string list, 
Passport buddyName)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         std::ostringstream buf_;
         buf_ << "REM " << this->trID++ << " " << list << " " << buddyName << 
"\r\n";
         write(buf_);        
@@ -383,7 +387,7 @@
     
     void NotificationServerConnection::addToGroup(Passport buddyName, int 
groupID)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         std::ostringstream buf_;
         buf_ << "ADD " << this->trID++ << " " << "FL" << " " << buddyName << " 
" << buddyName <<  " " << groupID << "\r\n";
         write(buf_);
@@ -391,7 +395,7 @@
     
     void NotificationServerConnection::removeFromGroup(Passport buddyName, int 
groupID)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         std::ostringstream buf_;
         buf_ << "REM " << this->trID++ << " " << "FL" << " " << buddyName << " 
" << groupID << "\r\n";
         write(buf_);
@@ -399,7 +403,7 @@
     
     void NotificationServerConnection::addGroup(std::string groupName)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         std::ostringstream buf_;
         buf_ << "ADG " << this->trID++ << " " << encodeURL(groupName) << " " 
<< 0 << "\r\n";
         write(buf_);        
@@ -407,7 +411,7 @@
     
     void NotificationServerConnection::removeGroup(int groupID)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         std::ostringstream buf_;
         buf_ << "RMG " << this->trID++ << " " << groupID << "\r\n";
         write(buf_);
@@ -415,7 +419,7 @@
     
     void NotificationServerConnection::renameGroup(int groupID, std::string 
newGroupName)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         std::ostringstream buf_;
         buf_ << "REG " << this->trID++ << " " << groupID << " " << 
encodeURL(newGroupName) << " " << 0 << "\r\n";
         write(buf_);
@@ -424,8 +428,8 @@
     
     void NotificationServerConnection::synchronizeLists(int version)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
-        this->assertConnectionStateIsNot(NS_SYNCHRONISING);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsNot(NS_SYNCHRONISING);
         ListSyncInfo *info = new ListSyncInfo(version);
         
         std::ostringstream buf_;
@@ -440,13 +444,13 @@
     
     void NotificationServerConnection::sendPing()
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         write("PNG\r\n");        
     }
     
     void NotificationServerConnection::requestSwitchboardConnection(const void 
*tag)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         SwitchboardServerConnection::AuthData *auth = new 
SwitchboardServerConnection::AuthData(this->auth.username, tag);
         std::ostringstream buf_;
         buf_ << "XFR " << this->trID << " SB\r\n";
@@ -486,7 +490,7 @@
     
     void NotificationServerConnection::socketConnectionCompleted()
     {
-        this->assertConnectionStateIs(NS_CONNECTING);
+        assertConnectionStateIs(NS_CONNECTING);
         this->setConnectionState(NS_CONNECTED);
         
         Connection::socketConnectionCompleted();
@@ -502,7 +506,7 @@
     
     void NotificationServerConnection::connect(const std::string & hostname, 
unsigned int port)
     {
-        this->assertConnectionStateIs(NS_DISCONNECTED);
+        assertConnectionStateIs(NS_DISCONNECTED);
         
         if ((this->sock = 
this->myNotificationServer()->externalCallbacks.connectToServer(hostname, port, 
&this->connected)) == -1)
         {
@@ -532,7 +536,7 @@
     
     void NotificationServerConnection::disconnect()
     {
-        this->assertConnectionStateIsNot(NS_DISCONNECTED);
+        assertConnectionStateIsNot(NS_DISCONNECTED);
         
         std::list<SwitchboardServerConnection *> list = 
_switchboardConnections;
         std::list<SwitchboardServerConnection *>::iterator i = list.begin();
@@ -550,7 +554,7 @@
     
     void NotificationServerConnection::disconnectForTransfer()
     {
-        this->assertConnectionStateIsNot(NS_DISCONNECTED);
+        assertConnectionStateIsNot(NS_DISCONNECTED);
         
this->myNotificationServer()->externalCallbacks.unregisterSocket(this->sock);
         ::close(this->sock);
         this->setConnectionState(NS_DISCONNECTED);
@@ -558,7 +562,7 @@
     
     void NotificationServerConnection::handleIncomingData()
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         while (this->isWholeLineAvailable())
         {
             std::vector<std::string> args = this->getLine();
@@ -656,7 +660,7 @@
     
     void 
NotificationServerConnection::callback_SyncData(std::vector<std::string> & 
args, int trid, void *data) throw (std::runtime_error)
     {
-        this->assertConnectionStateIs(NS_SYNCHRONISING);
+        assertConnectionStateIs(NS_SYNCHRONISING);
         ListSyncInfo *info = static_cast<ListSyncInfo *>(data);
         
         if (args[0] == "SYN")
@@ -761,7 +765,7 @@
     
     void 
NotificationServerConnection::callback_NegotiateCVR(std::vector<std::string> & 
args, int trid, void *data)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         this->removeCallback(trid);
         
         if (args.size() >= 3 && args[0] != "VER" || args[2] != "MSNP8") // if 
either *differs*...
@@ -780,7 +784,7 @@
     
     void 
NotificationServerConnection::callback_TransferToSwitchboard(std::vector<std::string>
 & args, int trid, void *data)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         SwitchboardServerConnection::AuthData *auth = 
static_cast<SwitchboardServerConnection::AuthData *>(data);
         this->removeCallback(trid);
         
@@ -806,7 +810,7 @@
     
     void 
NotificationServerConnection::callback_RequestUSR(std::vector<std::string> & 
args, int trid, void *data)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         this->removeCallback(trid);
         
         if (args.size() > 1 && args[0] != "CVR") // if*differs*...
@@ -826,7 +830,7 @@
     
     void 
NotificationServerConnection::callback_PassportAuthentication(std::vector<std::string>
 & args, int trid, void * data)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         
         CURL *curl;
         CURLcode ret;
@@ -924,7 +928,7 @@
     
     void 
NotificationServerConnection::callback_AuthenticationComplete(std::vector<std::string>
 & args, int trid, void * data)
     {
-        this->assertConnectionStateIsAtLeast(NS_CONNECTED);
+        assertConnectionStateIsAtLeast(NS_CONNECTED);
         this->removeCallback(trid);
         
         if (isdigit(args[0][0]))

Modified: branches/libmsn-3.2.x/msn/notificationserver.h
===================================================================
--- branches/libmsn-3.2.x/msn/notificationserver.h      2005-02-16 10:44:40 UTC 
(rev 349)
+++ branches/libmsn-3.2.x/msn/notificationserver.h      2005-02-16 11:35:18 UTC 
(rev 350)
@@ -288,9 +288,6 @@
         NotificationServerState _connectionState;
         
         void setConnectionState(NotificationServerState s) { 
this->_connectionState = s; };
-        void assertConnectionStateIs(NotificationServerState s) { 
assert(this->_connectionState == s); };
-        void assertConnectionStateIsNot(NotificationServerState s) { 
assert(this->_connectionState != s); };
-        void assertConnectionStateIsAtLeast(NotificationServerState s) { 
assert(this->_connectionState >= s); };        
         virtual void dispatchCommand(std::vector<std::string> & args);
 
         std::list<SwitchboardServerConnection *> _switchboardConnections;

Modified: branches/libmsn-3.2.x/msn/switchboardserver.cpp
===================================================================
--- branches/libmsn-3.2.x/msn/switchboardserver.cpp     2005-02-16 10:44:40 UTC 
(rev 349)
+++ branches/libmsn-3.2.x/msn/switchboardserver.cpp     2005-02-16 11:35:18 UTC 
(rev 350)
@@ -31,6 +31,10 @@
 #include <algorithm>
 #include <cassert>
 
+#define assertConnectionStateIs(s) assert(this->_connectionState == s)
+#define assertConnectionStateIsNot(s) assert(this->_connectionState != s)
+#define assertConnectionStateIsAtLeast(s) assert(this->_connectionState >= s)
+
 namespace MSN
 {
     std::map<std::string, void 
(SwitchboardServerConnection::*)(std::vector<std::string> &)> 
SwitchboardServerConnection::commandHandlers;
@@ -49,7 +53,7 @@
         
     Connection *SwitchboardServerConnection::connectionWithSocket(int fd)
     {
-        this->assertConnectionStateIsAtLeast(SB_CONNECTING);
+        assertConnectionStateIsAtLeast(SB_CONNECTING);
         std::list<FileTransferConnection *> & list = _fileTransferConnections;
         std::list<FileTransferConnection *>::iterator i = list.begin();
         
@@ -66,19 +70,19 @@
     
     void 
SwitchboardServerConnection::addFileTransferConnection(FileTransferConnection 
*c)
     {
-        this->assertConnectionStateIsAtLeast(SB_CONNECTED);        
+        assertConnectionStateIsAtLeast(SB_CONNECTED);        
         _fileTransferConnections.push_back(c);
     }
 
     void 
SwitchboardServerConnection::removeFileTransferConnection(FileTransferConnection
 *c)
     {
-        this->assertConnectionStateIsAtLeast(SB_CONNECTED);        
+        assertConnectionStateIsAtLeast(SB_CONNECTED);        
         _fileTransferConnections.remove(c);
     }
 
     void 
SwitchboardServerConnection::removeFileTransferConnection(FileTransferInvitation
 *inv)
     {
-        this->assertConnectionStateIsAtLeast(SB_CONNECTED);        
+        assertConnectionStateIsAtLeast(SB_CONNECTED);        
         std::list<FileTransferConnection *> & list = _fileTransferConnections;
         std::list<FileTransferConnection *>::iterator i = list.begin();        
         for (i = list.begin(); i != list.end(); i++)
@@ -118,13 +122,13 @@
     void SwitchboardServerConnection::addCallback(SwitchboardServerCallback 
callback,
                                                    int trid, void *data)
     {
-        this->assertConnectionStateIsAtLeast(SB_CONNECTING);        
+        assertConnectionStateIsAtLeast(SB_CONNECTING);        
         this->callbacks[trid] = std::make_pair(callback, data);
     }
 
     void SwitchboardServerConnection::removeCallback(int trid)
     {
-        this->assertConnectionStateIsAtLeast(SB_CONNECTING);        
+        assertConnectionStateIsAtLeast(SB_CONNECTING);        
         this->callbacks.erase(trid);
     }
     
@@ -141,7 +145,7 @@
     
     void SwitchboardServerConnection::dispatchCommand(std::vector<std::string> 
& args)
     {
-        this->assertConnectionStateIsAtLeast(SB_CONNECTED);        
+        assertConnectionStateIsAtLeast(SB_CONNECTED);        
         std::map<std::string, void 
(SwitchboardServerConnection::*)(std::vector<std::string> &)>::iterator i = 
commandHandlers.find(args[0]);
         if (i != commandHandlers.end())
             (this->*commandHandlers[args[0]])(args);
@@ -149,7 +153,7 @@
     
     void SwitchboardServerConnection::sendMessage(const Message *msg)
     {
-        this->assertConnectionStateIsAtLeast(SB_READY);        
+        assertConnectionStateIsAtLeast(SB_READY);        
         std::string s = msg->asString();
         
         std::ostringstream buf_;
@@ -165,7 +169,7 @@
     
     void SwitchboardServerConnection::handleInvite(Passport from, const 
std::string & friendly, const std::string & mime, const std::string & body)
     {
-        this->assertConnectionStateIsAtLeast(SB_READY);        
+        assertConnectionStateIsAtLeast(SB_READY);        
         Message::Headers headers = Message::Headers(body);
         std::string command = headers["Invitation-Command"];
         std::string cookie = headers["Invitation-Cookie"];
@@ -195,7 +199,7 @@
     
     void SwitchboardServerConnection::handleNewInvite(Passport & from, const 
std::string & friendly, const std::string & mime, const std::string & body)
     {
-        this->assertConnectionStateIsAtLeast(SB_READY);        
+        assertConnectionStateIsAtLeast(SB_READY);        
         Message::Headers headers = Message::Headers(body);
         std::string appname;
         std::string filename;
@@ -223,7 +227,7 @@
     
     void SwitchboardServerConnection::handle_BYE(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(SB_CONNECTED);        
+        assertConnectionStateIsAtLeast(SB_CONNECTED);        
         std::list<Passport> & list = this->users;
         std::list<Passport>::iterator i;
         
@@ -247,7 +251,7 @@
     
     void SwitchboardServerConnection::handle_JOI(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(SB_CONNECTED);        
+        assertConnectionStateIsAtLeast(SB_CONNECTED);        
         if (args[1] == this->auth.username)
             return;
         
@@ -260,19 +264,19 @@
     
     void SwitchboardServerConnection::handle_NAK(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(SB_CONNECTED);        
+        assertConnectionStateIsAtLeast(SB_CONNECTED);        
         
this->myNotificationServer()->externalCallbacks.failedSendingMessage(this);
     }
     
     void SwitchboardServerConnection::handle_MSG(std::vector<std::string> & 
args)
     {
-        this->assertConnectionStateIsAtLeast(SB_CONNECTED);        
+        assertConnectionStateIsAtLeast(SB_CONNECTED);        
         Connection::handle_MSG(args);
     }
     
     void SwitchboardServerConnection::sendTypingNotification()
     {
-        this->assertConnectionStateIsAtLeast(SB_READY);        
+        assertConnectionStateIsAtLeast(SB_READY);        
         std::ostringstream buf_, msg_;
         msg_ << "MIME-Version: 1.0\r\n";
         msg_ << "Content-Type: text/x-msmsgscontrol\r\n";
@@ -288,7 +292,7 @@
     
     void SwitchboardServerConnection::inviteUser(Passport userName)
     {
-        this->assertConnectionStateIsAtLeast(SB_WAITING_FOR_USERS);        
+        assertConnectionStateIsAtLeast(SB_WAITING_FOR_USERS);        
         std::ostringstream buf_;
         buf_ << "CAL " << this->trID++ << " " << userName << "\r\n";
         write(buf_);        
@@ -296,7 +300,7 @@
     
     void SwitchboardServerConnection::connect(const std::string & hostname, 
unsigned int port)
     {
-        this->assertConnectionStateIs(SB_DISCONNECTED);
+        assertConnectionStateIs(SB_DISCONNECTED);
 
         if ((this->sock = 
this->myNotificationServer()->externalCallbacks.connectToServer(hostname, port, 
&this->connected)) == -1)
         {
@@ -332,7 +336,7 @@
     
     void SwitchboardServerConnection::disconnect()
     {
-        this->assertConnectionStateIsNot(SB_DISCONNECTED);
+        assertConnectionStateIsNot(SB_DISCONNECTED);
         notificationServer.removeSwitchboardConnection(this);
         
this->myNotificationServer()->externalCallbacks.closingConnection(this);
         
@@ -349,7 +353,7 @@
     
     void SwitchboardServerConnection::socketConnectionCompleted()
     {
-        this->assertConnectionStateIs(SB_CONNECTING);
+        assertConnectionStateIs(SB_CONNECTING);
         Connection::socketConnectionCompleted();
         
this->myNotificationServer()->externalCallbacks.unregisterSocket(this->sock);
         
this->myNotificationServer()->externalCallbacks.registerSocket(this->sock, 1, 
0);
@@ -358,7 +362,7 @@
     
     void SwitchboardServerConnection::handleIncomingData()
     {
-        this->assertConnectionStateIsAtLeast(SB_CONNECTED);        
+        assertConnectionStateIsAtLeast(SB_CONNECTED);        
         while (this->isWholeLineAvailable())
         {                
             std::vector<std::string> args = this->getLine();
@@ -402,7 +406,7 @@
     
     void 
SwitchboardServerConnection::callback_InviteUsers(std::vector<std::string> & 
args, int trid, void *)
     {    
-        this->assertConnectionStateIsAtLeast(SB_CONNECTED);
+        assertConnectionStateIsAtLeast(SB_CONNECTED);
         this->removeCallback(trid);
         
         if (args[2] != "OK")
@@ -418,7 +422,7 @@
     
     void 
SwitchboardServerConnection::callback_AnsweredCall(std::vector<std::string> & 
args, int trid, void * data)
     {
-        this->assertConnectionStateIs(SB_WAITING_FOR_USERS);        
+        assertConnectionStateIs(SB_WAITING_FOR_USERS);        
         if (args.size() >= 3 && args[0] == "ANS" && args[2] == "OK")
             return;
         
@@ -447,7 +451,7 @@
     
     FileTransferInvitation *SwitchboardServerConnection::sendFile(const 
std::string path)
     {
-        this->assertConnectionStateIs(SB_READY);        
+        assertConnectionStateIs(SB_READY);        
         struct stat st_info;
         
         if (stat(path.c_str(), &st_info) < 0)

Modified: branches/libmsn-3.2.x/msn/switchboardserver.h
===================================================================
--- branches/libmsn-3.2.x/msn/switchboardserver.h       2005-02-16 10:44:40 UTC 
(rev 349)
+++ branches/libmsn-3.2.x/msn/switchboardserver.h       2005-02-16 11:35:18 UTC 
(rev 350)
@@ -182,9 +182,6 @@
         virtual void handleIncomingData();
 
         void setConnectionState(SwitchboardServerState s) { 
this->_connectionState = s; };
-        void assertConnectionStateIs(SwitchboardServerState s) { 
assert(this->_connectionState == s); };
-        void assertConnectionStateIsNot(SwitchboardServerState s) { 
assert(this->_connectionState != s); };
-        void assertConnectionStateIsAtLeast(SwitchboardServerState s) { 
assert(this->_connectionState >= s); };
 
         NotificationServerConnection & notificationServer;
         std::list<FileTransferConnection *> _fileTransferConnections;



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe