summaryrefslogtreecommitdiff
path: root/Protocols/SIP/sip.cpp
diff options
context:
space:
mode:
authorpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2010-01-18 01:07:16 +0000
committerpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2010-01-18 01:07:16 +0000
commit6342ef9ae683c0080abd3d8fdb46d2a36c594063 (patch)
tree176a6f5bae5cc9f447bb187575ed56161f86218a /Protocols/SIP/sip.cpp
parenta36ca1b4d5d0c89b09382ac4215681b47865bea1 (diff)
sip: Client API
git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@211 c086bb3d-8645-0410-b8da-73a8550f86e7
Diffstat (limited to 'Protocols/SIP/sip.cpp')
-rw-r--r--Protocols/SIP/sip.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/Protocols/SIP/sip.cpp b/Protocols/SIP/sip.cpp
index 4bfaeff..138ad78 100644
--- a/Protocols/SIP/sip.cpp
+++ b/Protocols/SIP/sip.cpp
@@ -30,7 +30,7 @@ PLUGININFOEX pluginInfo={
#else
"SIP protocol (Ansi)",
#endif
- PLUGIN_MAKE_VERSION(0,1,1,0),
+ PLUGIN_MAKE_VERSION(0,1,2,0),
"Provides support for SIP protocol",
"Ricardo Pescuma Domenecci",
"pescuma@miranda-im.org",
@@ -263,13 +263,17 @@ int PreShutdown(WPARAM wParam, LPARAM lParam)
}
-static int ClientCall(SIP_CLIENT *sip, const TCHAR *username, const TCHAR *host, int port, int protocol)
+static int ClientCall(SIP_CLIENT *sip, const TCHAR *host, int port, int protocol)
{
if (sip == NULL || sip->data == NULL)
return -1;
+ if (host[0] == 0 || port <= 0)
+ return -2;
+ if (protocol < 1 || protocol > 3)
+ return -2;
SIPClient *cli = (SIPClient *) sip->data;
- return (int) cli->Call(username, host, port, protocol);
+ return (int) cli->Call(host, port, protocol);
}
static int ClientDropCall(SIP_CLIENT *sip, int callId)
@@ -314,7 +318,7 @@ static INT_PTR ClientRegister(WPARAM wParam, LPARAM lParam)
if (reg == NULL || reg->cbSize < sizeof(SIP_REGISTRATION))
return NULL;
- if (reg->name[0] == 0 || reg->username[0] == 0)
+ if (reg->name[0] == 0)
return NULL;
SIPClient *cli = new SIPClient(reg);
@@ -325,9 +329,10 @@ static INT_PTR ClientRegister(WPARAM wParam, LPARAM lParam)
return NULL;
}
+ clients.insert(cli);
+
SIP_CLIENT *ret = (SIP_CLIENT *) mir_alloc0(sizeof(SIP_CLIENT) + sizeof(SIPClient *));
ret->data = cli;
- * (TCHAR **) & ret->username = cli->username;
* (TCHAR **) & ret->host = cli->host;
* (int *) & ret->udp_port = cli->udp.port;
* (int *) & ret->tcp_port = cli->tcp.port;
@@ -349,7 +354,7 @@ static INT_PTR ClientUnregister(WPARAM wParam, LPARAM lParam)
SIPClient * cli = (SIPClient *) sc->data;
cli->Disconnect();
- delete cli;
+ clients.remove(cli);
mir_free(sc);
return 0;