r7938 - /branches/1.5-stable/rms/src/rms.cpp

[email protected]
Newsgroups gmane.network.licq.cvs
Message-ID <20101020151733.4574E224B80@thejon>
Author: flynd
Date: Thu Oct 21 00:17:29 2010
New Revision: 7938

Log:
Merged r7934, r7935 from trunk to not crash RMS plugin if user/owner doesn't exist.

Modified:
    branches/1.5-stable/rms/src/rms.cpp

Modified: branches/1.5-stable/rms/src/rms.cpp
==============================================================================
--- branches/1.5-stable/rms/src/rms.cpp (original)
+++ branches/1.5-stable/rms/src/rms.cpp Thu Oct 21 00:17:29 2010
@@ -887,6 +887,11 @@
     bool b;
     {
       Licq::OwnerReadGuard o(nPPID);
+      if (!o.isLocked())
+      {
+        fprintf(fs, "%d Invalid protocol.\n", CODE_INVALIDxUSER);
+        return -1;
+      }
       b = !o->isOnline();
     }
     unsigned long tag = gProtocolManager.setStatus(ownerId, status);
@@ -1314,12 +1319,14 @@
   if (!myUserId.isValid())
   {
     Licq::OwnerWriteGuard o(LICQ_PPID);
-    o->setAutoResponse(m_szText);
+    if (o.isLocked())
+      o->setAutoResponse(m_szText);
   }
   else
   {
     Licq::UserWriteGuard u(myUserId);
-    u->setCustomAutoResponse(m_szText);
+    if (u.isLocked())
+      u->setCustomAutoResponse(m_szText);
   }
 
   fprintf(fs, "%d Auto response saved.\n", CODE_RESULTxSUCCESS);
@@ -1596,14 +1603,13 @@
   else
   {
     Licq::UserReadGuard u(userId);
-   if (u->Secure() == 0)
-   {
-    fprintf(fs, "%d Status: secure connection is closed.\n", CODE_SECURExSTAT);
-   }
-   if (u->Secure() == 1)
-   {
-    fprintf(fs, "%d Status: secure connection is open.\n", CODE_SECURExSTAT);
-   }
+    if (u.isLocked())
+    {
+      if (u->Secure() == 0)
+        fprintf(fs, "%d Status: secure connection is closed.\n", CODE_SECURExSTAT);
+      if (u->Secure() == 1)
+        fprintf(fs, "%d Status: secure connection is open.\n", CODE_SECURExSTAT);
+    }
   }
 
   free(id);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.