< Previous by Date Date Index Next by Date >
  Thread Index  

[reSIProcate-users] removeSupportedMethod() method?


Hello all,
i could not find a method that removes a SIP method so
for the time being i was storing the list of supported methods (either defaults and user-added via addSupportedMethod()) and then when user asks to remove one I would clear them all and re-add only the supported ones.

Attached is a small patch that adds removeSupportedMethods() to MasterProfile, from my, limited, tests it seems to be working as expected.

best regards

P.S. in the removeSupportedMethod() I was clearing also the MimeTypes associated to that method, however, since i saw that in the clearSupportedMethod() call they were not cleared I commented that part.

P.P.S. i would suggest renaming getAllowedMethods to getSupportedMethods for coherence with the other API naming
Common subdirectories: dum-original/.deps and dum/.deps
Common subdirectories: dum-original/doc and dum/doc
Common subdirectories: dum-original/.libs and dum/.libs
diff -u dum-original/MasterProfile.cxx dum/MasterProfile.cxx
--- dum-original/MasterProfile.cxx	2017-07-26 12:22:32.662268358 +0200
+++ dum/MasterProfile.cxx	2017-07-26 12:18:31.213276948 +0200
@@ -66,6 +66,24 @@
    mSupportedMethods.push_back(Token(getMethodName(method)));
 }
 
+void 
+MasterProfile::removeSupportedMethod(const MethodTypes& method)
+{
+   mSupportedMethodTypes.erase(method);
+   for (Tokens::iterator i = mSupportedMethods.begin();
+            i != mSupportedMethods.end(); ++i)
+   {
+       if (getMethodType(i->value()) == method)
+       {
+           mSupportedMethods.erase(i);
+           break;
+       }
+   }
+
+   // Should we clear the mimetypes as well?
+   // clearSupportedMimeTypes(method);
+}
+
 bool 
 MasterProfile::isMethodSupported(MethodTypes method) const
 {
Common subdirectories: dum-original/ssl and dum/ssl
Common subdirectories: dum-original/test and dum/test