diff options
author | pescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7> | 2010-01-21 03:19:47 +0000 |
---|---|---|
committer | pescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7> | 2010-01-21 03:19:47 +0000 |
commit | 29224b5cce3353b67784ada08165ff9259a5bee1 (patch) | |
tree | bad59af2de509f2a653e6358a4f495a6acfa8e9f /Protocols/SIP/SIPProto.cpp | |
parent | 6622a1c224fab2c6299219b4e134a62f80880469 (diff) |
SIP: 0.1.3.0
* Fix for going online after connecting error
* Fix for reconection crash
+ Added stun server to client API
+ Added list of hosts to client API
git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@214 c086bb3d-8645-0410-b8da-73a8550f86e7
Diffstat (limited to 'Protocols/SIP/SIPProto.cpp')
-rw-r--r-- | Protocols/SIP/SIPProto.cpp | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/Protocols/SIP/SIPProto.cpp b/Protocols/SIP/SIPProto.cpp index c0d042a..2f79e16 100644 --- a/Protocols/SIP/SIPProto.cpp +++ b/Protocols/SIP/SIPProto.cpp @@ -41,16 +41,6 @@ SIPProto::SIPProto(const char *aProtoName, const TCHAR *aUserName) memset(awayMessages, 0, sizeof(awayMessages));
- {
- pj_status_t status = pjsua_create();
- if (status != PJ_SUCCESS)
- {
- Error(status, _T("Error creating pjsua"));
- throw "Error creating pjsua";
- }
- hasToDestroy = true;
- }
-
InitializeCriticalSection(&cs);
m_tszUserName = mir_tstrdup(aUserName);
@@ -508,6 +498,19 @@ int SIPProto::Connect() BroadcastStatus(ID_STATUS_CONNECTING);
+ DestroySIP();
+
+ {
+ pj_status_t status = pjsua_create();
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error creating pjsua"));
+ Disconnect();
+ return 1;
+ }
+ hasToDestroy = true;
+ }
+
{
scoped_mir_free<char> stun;
scoped_mir_free<char> dns;
@@ -638,6 +641,7 @@ int SIPProto::Connect() }
cfg.publish_enabled = (opts.publish ? PJ_TRUE : PJ_FALSE);
+ cfg.mwi_enabled = PJ_TRUE;
if (!opts.sendKeepAlive)
cfg.ka_interval = 0;
@@ -929,6 +933,7 @@ void SIPProto::Disconnect() DBDeleteContactSetting(hContact, "CList", "StatusMsg");
}
+ m_iDesiredStatus = ID_STATUS_OFFLINE;
BroadcastStatus(ID_STATUS_OFFLINE);
}
@@ -994,15 +999,19 @@ int __cdecl SIPProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) }
-int __cdecl SIPProto::OnPreShutdown(WPARAM wParam, LPARAM lParam)
+void SIPProto::DestroySIP()
{
- if (hasToDestroy)
- {
- pjsua_destroy();
- hasToDestroy = false;
- }
+ if (!hasToDestroy)
+ return;
+ pjsua_destroy();
+ hasToDestroy = false;
+}
+
+int __cdecl SIPProto::OnPreShutdown(WPARAM wParam, LPARAM lParam)
+{
+ DestroySIP();
return 0;
}
|