summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2009-12-26 01:24:30 +0000
committerpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2009-12-26 01:24:30 +0000
commitfee31daf0c5470fdb8c1efe39bf934bc2e1463be (patch)
tree4e84a09e39c66b6d18eff5dcf1b64ed05e0215b9
parent21f8ca06b26fe42f8bbf8ca477a2824989ff13c7 (diff)
sip: initial commit
git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@194 c086bb3d-8645-0410-b8da-73a8550f86e7
-rw-r--r--Protocols/SIP/SIPProto.cpp1108
-rw-r--r--Protocols/SIP/SIPProto.h155
-rw-r--r--Protocols/SIP/commons.h135
-rw-r--r--Protocols/SIP/resource.h42
-rw-r--r--Protocols/SIP/resource.rc121
-rw-r--r--Protocols/SIP/sdk/m_folders.h205
-rw-r--r--Protocols/SIP/sdk/m_updater.h146
-rw-r--r--Protocols/SIP/sdk/m_variables.h718
-rw-r--r--Protocols/SIP/sip.cpp300
-rw-r--r--Protocols/SIP/sip.dsp243
-rw-r--r--Protocols/SIP/sip.dsw29
-rw-r--r--Protocols/SIP/sip.sln26
-rw-r--r--Protocols/SIP/sip.vcproj721
13 files changed, 3949 insertions, 0 deletions
diff --git a/Protocols/SIP/SIPProto.cpp b/Protocols/SIP/SIPProto.cpp
new file mode 100644
index 0000000..0d591fd
--- /dev/null
+++ b/Protocols/SIP/SIPProto.cpp
@@ -0,0 +1,1108 @@
+/*
+Copyright (C) 2009 Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+#include "commons.h"
+
+
+static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+static INT_PTR CALLBACK DlgOptions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+
+
+class SipToTchar
+{
+public:
+ SipToTchar(const pj_str_t &str) : tchar(NULL)
+ {
+ if (str.ptr == NULL)
+ return;
+
+ int size = MultiByteToWideChar(CP_UTF8, 0, str.ptr, str.slen, NULL, 0);
+ if (size < 0)
+ throw _T("Could not convert string to WCHAR");
+ size++;
+
+ WCHAR *tmp = (WCHAR *) mir_alloc(size * sizeof(WCHAR));
+ if (tmp == NULL)
+ throw _T("mir_alloc returned NULL");
+
+ MultiByteToWideChar(CP_UTF8, 0, str.ptr, str.slen, tmp, size);
+ tmp[size-1] = 0;
+
+#ifdef UNICODE
+
+ tchar = tmp;
+
+#else
+
+ size = WideCharToMultiByte(CP_ACP, 0, tmp, -1, NULL, 0, NULL, NULL);
+ if (size <= 0)
+ {
+ mir_free(tmp);
+ throw _T("Could not convert string to ACP");
+ }
+
+ tchar = (TCHAR *) mir_alloc(size * sizeof(char));
+ if (tchar == NULL)
+ {
+ mir_free(tmp);
+ throw _T("mir_alloc returned NULL");
+ }
+
+ WideCharToMultiByte(CP_ACP, 0, tmp, -1, tchar, size, NULL, NULL);
+
+ mir_free(tmp);
+
+#endif
+ }
+
+ ~SipToTchar()
+ {
+ if (tchar != NULL)
+ mir_free(tchar);
+ }
+
+ TCHAR *detach()
+ {
+ TCHAR *ret = tchar;
+ tchar = NULL;
+ return ret;
+ }
+
+ TCHAR * get() const
+ {
+ return tchar;
+ }
+
+ operator TCHAR *() const
+ {
+ return tchar;
+ }
+
+ TCHAR operator[](int pos) const
+ {
+ return tchar[pos];
+ }
+
+ TCHAR & operator[](int pos)
+ {
+ return tchar[pos];
+ }
+
+private:
+ TCHAR *tchar;
+};
+
+
+SIPProto::SIPProto(const char *aProtoName, const TCHAR *aUserName)
+{
+ //hasToDestroy = false;
+ transport_id = -1;
+ acc_id = -1;
+ hNetlibUser = 0;
+ hCallStateEvent = 0;
+ m_iDesiredStatus = m_iStatus = ID_STATUS_OFFLINE;
+
+ m_tszUserName = mir_tstrdup(aUserName);
+ m_szProtoName = mir_strdup(aProtoName);
+ m_szModuleName = mir_strdup(aProtoName);
+
+ static OptPageControl amCtrls[] = {
+ { NULL, CONTROL_TEXT, IDC_HOST, "Host", NULL, 0, 0, 256 },
+ { NULL, CONTROL_INT, IDC_PORT, "Port", 5060, 0, 1 },
+ { NULL, CONTROL_TEXT, IDC_USERNAME, "Username", NULL, 0, 0, 16 },
+ { NULL, CONTROL_PASSWORD, IDC_PASSWORD, "Password", NULL, IDC_SAVEPASSWORD, 0, 16 },
+ { NULL, CONTROL_CHECKBOX, IDC_SAVEPASSWORD, "SavePassword", (BYTE) TRUE },
+ };
+
+ memmove(accountManagerCtrls, amCtrls, sizeof(accountManagerCtrls));
+ accountManagerCtrls[0].var = &opts.host;
+ accountManagerCtrls[1].var = &opts.port;
+ accountManagerCtrls[2].var = &opts.username;
+ accountManagerCtrls[3].var = &opts.password;
+ accountManagerCtrls[4].var = &opts.savePassword;
+
+ static OptPageControl oCtrls[] = {
+ { NULL, CONTROL_TEXT, IDC_HOST, "Host", NULL, 0, 0, 256 },
+ { NULL, CONTROL_INT, IDC_PORT, "Port", 5060, 0, 1 },
+ { NULL, CONTROL_TEXT, IDC_USERNAME, "Username", NULL, 0, 0, 16 },
+ { NULL, CONTROL_PASSWORD, IDC_PASSWORD, "Password", NULL, IDC_SAVEPASSWORD, 0, 16 },
+ { NULL, CONTROL_CHECKBOX, IDC_SAVEPASSWORD, "SavePassword", (BYTE) TRUE },
+ { NULL, CONTROL_TEXT, IDC_STUN_HOST, "StunHost", NULL, 0, 0, 256 },
+ { NULL, CONTROL_INT, IDC_STUN_PORT, "StunPort", 0, 0, 1 },
+ };
+
+ memmove(optionsCtrls, oCtrls, sizeof(optionsCtrls));
+ optionsCtrls[0].var = &opts.host;
+ optionsCtrls[1].var = &opts.port;
+ optionsCtrls[2].var = &opts.username;
+ optionsCtrls[3].var = &opts.password;
+ optionsCtrls[4].var = &opts.savePassword;
+ optionsCtrls[5].var = &opts.stun.host;
+ optionsCtrls[6].var = &opts.stun.port;
+
+ LoadOpts(optionsCtrls, MAX_REGS(optionsCtrls), m_szModuleName);
+
+ CreateProtoService(PS_CREATEACCMGRUI, &SIPProto::CreateAccMgrUI);
+
+ CreateProtoService(PS_VOICE_CAPS, &SIPProto::VoiceCaps);
+ CreateProtoService(PS_VOICE_CALL, &SIPProto::VoiceCall);
+ CreateProtoService(PS_VOICE_ANSWERCALL, &SIPProto::VoiceAnswerCall);
+ CreateProtoService(PS_VOICE_DROPCALL, &SIPProto::VoiceDropCall);
+ CreateProtoService(PS_VOICE_HOLDCALL, &SIPProto::VoiceHoldCall);
+ CreateProtoService(PS_VOICE_SEND_DTMF, &SIPProto::VoiceSendDTMF);
+ CreateProtoService(PS_VOICE_CALL_STRING_VALID, &SIPProto::VoiceCallStringValid);
+
+ hCallStateEvent = CreateProtoEvent(PE_VOICE_CALL_STATE);
+
+ HookProtoEvent(ME_OPT_INITIALISE, &SIPProto::OnOptionsInit);
+}
+
+
+SIPProto::~SIPProto()
+{
+ Netlib_CloseHandle(hNetlibUser);
+
+ mir_free(m_tszUserName);
+ mir_free(m_szProtoName);
+ mir_free(m_szModuleName);
+}
+
+
+DWORD_PTR __cdecl SIPProto::GetCaps( int type, HANDLE hContact )
+{
+ switch(type)
+ {
+ case PFLAGNUM_1:
+ return 0;
+
+ case PFLAGNUM_2:
+ return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND
+ | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE | PF2_INVISIBLE | PF2_IDLE;
+
+ case PFLAGNUM_3:
+ return 0;
+
+ case PFLAGNUM_4:
+ return PF4_NOCUSTOMAUTH;
+
+ case PFLAG_UNIQUEIDTEXT:
+ return (UINT_PTR) Translate("User");
+
+ case PFLAG_UNIQUEIDSETTING:
+ return (UINT_PTR) "Username";
+
+ case PFLAG_MAXLENOFMESSAGE:
+ return 100;
+ }
+
+ return 0;
+}
+
+
+int SIPProto::Connect()
+{
+ Trace(_T("Connecting..."));
+
+ BroadcastStatus(ID_STATUS_CONNECTING);
+/*
+ {
+ pj_status_t status = pjsua_create();
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error creating pjsua!"));
+ return -1;
+ }
+ hasToDestroy = true;
+ }
+
+ {
+ pjsua_config cfg;
+ pjsua_config_default(&cfg);
+ cfg.cb.on_incoming_call = &static_on_incoming_call;
+ cfg.cb.on_call_media_state = &static_on_call_media_state;
+ cfg.cb.on_call_state = &static_on_call_state;
+ cfg.cb.on_reg_state = &static_on_reg_state;
+
+ pjsua_logging_config log_cfg;
+ pjsua_logging_config_default(&log_cfg);
+ log_cfg.console_level = 4;
+ log_cfg.cb = &static_on_log;
+
+ pj_status_t status = pjsua_init(&cfg, &log_cfg, NULL);
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error initializing pjsua"));
+ Disconnect();
+ return 1;
+ }
+ }
+*/
+ {
+ pjsua_transport_config cfg;
+ pjsua_transport_config_default(&cfg);
+ pj_status_t status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, &cfg, &transport_id);
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error creating transport"));
+ Disconnect();
+ return 2;
+ }
+ }
+/*
+ {
+ pj_status_t status = pjsua_start();
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error starting pjsua"));
+ Disconnect();
+ return 3;
+ }
+ }
+*/
+ {
+ TCHAR tmp[1024];
+
+ pjsua_acc_config cfg;
+ pjsua_acc_config_default(&cfg);
+ cfg.user_data = this;
+ cfg.transport_id = transport_id;
+
+ mir_sntprintf(tmp, MAX_REGS(tmp), _T("sip:%s@%s"), opts.username, opts.host);
+ TcharToUtf8 id(tmp);
+ cfg.id = pj_str(id);
+
+ mir_sntprintf(tmp, MAX_REGS(tmp), _T("sip:%s:%d"), opts.host, opts.port);
+ TcharToUtf8 reg_uri(tmp);
+ cfg.reg_uri = pj_str(reg_uri);
+
+ cfg.publish_enabled = PJ_TRUE;
+
+ cfg.cred_count = 1;
+ TcharToUtf8 host(opts.host);
+ cfg.cred_info[0].realm = pj_str(host);
+ cfg.cred_info[0].scheme = pj_str("digest");
+ TcharToUtf8 username(opts.username);
+ cfg.cred_info[0].username = pj_str(username);
+ cfg.cred_info[0].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD; // TODO
+ cfg.cred_info[0].data = pj_str(opts.password);
+
+ pj_status_t status = pjsua_acc_add(&cfg, PJ_TRUE, &acc_id);
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error adding account"));
+ Disconnect();
+ return 4;
+ }
+ }
+
+ return 0;
+}
+
+
+int __cdecl SIPProto::SetStatus( int iNewStatus )
+{
+ if (m_iStatus == iNewStatus)
+ return 0;
+ m_iDesiredStatus = iNewStatus;
+
+ if (m_iDesiredStatus == ID_STATUS_OFFLINE)
+ {
+ Disconnect();
+ }
+ else if (m_iStatus == ID_STATUS_OFFLINE)
+ {
+ return Connect();
+ }
+ else if (m_iStatus > ID_STATUS_OFFLINE)
+ {
+ SendPresence(m_iDesiredStatus);
+ BroadcastStatus(m_iDesiredStatus);
+ }
+
+ return 0;
+}
+
+
+INT_PTR __cdecl SIPProto::CreateAccMgrUI(WPARAM wParam, LPARAM lParam)
+{
+ return (INT_PTR) CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ACCMGRUI),
+ (HWND) lParam, DlgProcAccMgrUI, (LPARAM)this);
+}
+
+
+void SIPProto::BroadcastStatus(int newStatus)
+{
+ Trace(_T("BroadcastStatus %d"), newStatus);
+
+ int oldStatus = m_iStatus;
+ m_iStatus = newStatus;
+ SendBroadcast(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
+}
+
+
+void SIPProto::CreateProtoService(const char* szService, SIPServiceFunc serviceProc)
+{
+ char str[MAXMODULELABELLENGTH];
+
+ mir_snprintf(str, sizeof(str), "%s%s", m_szModuleName, szService);
+ ::CreateServiceFunctionObj(str, (MIRANDASERVICEOBJ)*(void**)&serviceProc, this);
+}
+
+
+void SIPProto::CreateProtoService(const char* szService, SIPServiceFuncParam serviceProc, LPARAM lParam)
+{
+ char str[MAXMODULELABELLENGTH];
+ mir_snprintf(str, sizeof(str), "%s%s", m_szModuleName, szService);
+ ::CreateServiceFunctionObjParam(str, (MIRANDASERVICEOBJPARAM)*(void**)&serviceProc, this, lParam);
+}
+
+
+HANDLE SIPProto::CreateProtoEvent(const char* szService)
+{
+ char str[MAXMODULELABELLENGTH];
+ mir_snprintf(str, sizeof(str), "%s%s", m_szModuleName, szService);
+ return ::CreateHookableEvent(str);
+}
+
+
+void SIPProto::HookProtoEvent(const char* szEvent, SIPEventFunc pFunc)
+{
+ ::HookEventObj(szEvent, (MIRANDAHOOKOBJ)*(void**)&pFunc, this);
+}
+
+
+
+int SIPProto::SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
+{
+ ACKDATA ack = {0};
+ ack.cbSize = sizeof(ACKDATA);
+ ack.szModule = m_szModuleName;
+ ack.hContact = hContact;
+ ack.type = type;
+ ack.result = result;
+ ack.hProcess = hProcess;
+ ack.lParam = lParam;
+ return CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack);
+}
+
+
+#define MESSAGE_TYPE_TRACE 0
+#define MESSAGE_TYPE_INFO 1
+#define MESSAGE_TYPE_ERROR 2
+
+
+void SIPProto::Trace(TCHAR *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+
+ ShowMessage(MESSAGE_TYPE_TRACE, fmt, args);
+
+ va_end(args);
+}
+
+
+void SIPProto::Info(TCHAR *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+
+ ShowMessage(MESSAGE_TYPE_INFO, TranslateTS(fmt), args);
+
+ va_end(args);
+}
+
+
+void SIPProto::Error(TCHAR *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+
+ ShowMessage(MESSAGE_TYPE_ERROR, TranslateTS(fmt), args);
+
+ va_end(args);
+}
+
+
+void SIPProto::Error(pj_status_t status, TCHAR *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+
+ TCHAR buff[1024];
+ mir_vsntprintf(buff, MAX_REGS(buff), TranslateTS(fmt), args);
+
+ va_end(args);
+
+ char errmsg[PJ_ERR_MSG_SIZE];
+ pj_strerror(status, errmsg, sizeof(errmsg));
+
+ Error(_T("%s: %s"), buff, Utf8ToTchar(errmsg));
+}
+
+
+void SIPProto::ShowMessage(int type, TCHAR *fmt, va_list args)
+{
+ TCHAR buff[1024];
+ if (type == MESSAGE_TYPE_TRACE)
+ lstrcpy(buff, _T("TRACE: "));
+ else if (type == MESSAGE_TYPE_INFO)
+ lstrcpy(buff, _T("INFO : "));
+ else
+ lstrcpy(buff, _T("ERROR: "));
+
+ mir_vsntprintf(&buff[7], MAX_REGS(buff)-7, fmt, args);
+
+ OutputDebugString(buff);
+ OutputDebugString(_T("\n"));
+ CallService(MS_NETLIB_LOG, (WPARAM) hNetlibUser, (LPARAM) TcharToChar(buff).get());
+}
+
+
+void SIPProto::Disconnect()
+{
+ Trace(_T("Disconnecting..."));
+
+ if (acc_id >= 0)
+ {
+ SendPresence(ID_STATUS_OFFLINE);
+ pjsua_acc_del(acc_id);
+ acc_id = -1;
+ }
+
+ if (transport_id >= 0)
+ {
+ pjsua_transport_close(transport_id, PJ_FALSE);
+ transport_id = -1;
+ }
+/*
+ if (hasToDestroy)
+ {
+ pjsua_destroy();
+ hasToDestroy = false;
+ }
+*/
+ BroadcastStatus(ID_STATUS_OFFLINE);
+}
+
+
+int __cdecl SIPProto::OnEvent( PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam )
+{
+ switch(iEventType)
+ {
+ case EV_PROTO_ONLOAD:
+ return OnModulesLoaded(0, 0);
+
+ case EV_PROTO_ONEXIT:
+ return OnPreShutdown(0, 0);
+
+ case EV_PROTO_ONOPTIONS:
+ return OnOptionsInit(wParam, lParam);
+
+ case EV_PROTO_ONRENAME:
+ {
+ break;
+ }
+ }
+ return 1;
+}
+
+
+int __cdecl SIPProto::OnModulesLoaded(WPARAM wParam, LPARAM lParam)
+{
+ TCHAR buffer[MAX_PATH];
+ mir_sntprintf(buffer, MAX_REGS(buffer), TranslateT("%s plugin connections"), m_tszUserName);
+
+ NETLIBUSER nl_user = {0};
+ nl_user.cbSize = sizeof(nl_user);
+ nl_user.flags = /* NUF_INCOMING | NUF_OUTGOING | */ NUF_NOOPTIONS | NUF_TCHAR;
+ nl_user.szSettingsModule = m_szModuleName;
+ nl_user.ptszDescriptiveName = buffer;
+ hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nl_user);
+
+ if (!ServiceExists(MS_VOICESERVICE_REGISTER))
+ {
+ Error(_T("SIP needs Voice Service plugin to work!"));
+ return 1;
+ }
+
+ return 0;
+}
+
+
+int __cdecl SIPProto::OnOptionsInit(WPARAM wParam, LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp = {0};
+ odp.cbSize = sizeof(odp);
+ odp.hInstance = hInst;
+ odp.ptszGroup = LPGENT("Network");
+ odp.ptszTitle = m_tszUserName;
+ odp.pfnDlgProc = DlgOptions;
+ odp.dwInitParam = (LPARAM) this;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
+ CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+
+ return 0;
+}
+
+
+int __cdecl SIPProto::OnPreShutdown(WPARAM wParam, LPARAM lParam)
+{
+ return 0;
+}
+
+
+void SIPProto::NotifyCall(pjsua_call_id call_id, int state, HANDLE hContact, TCHAR *name, TCHAR *number)
+{
+ Trace(_T("NotifyCall %d -> %d"), call_id, state);
+
+ char tmp[16];
+
+ VOICE_CALL vc = {0};
+ vc.cbSize = sizeof(vc);
+ vc.szModule = m_szModuleName;
+ vc.id = itoa((int) call_id, tmp, 10);
+ vc.flags = VOICE_TCHAR;
+ vc.hContact = hContact;
+ vc.ptszName = name;
+ vc.ptszNumber = number;
+ vc.state = state;
+
+ NotifyEventHooks(hCallStateEvent, (WPARAM) &vc, 0);
+}
+
+
+bool SIPProto::SendPresence(int proto_status)
+{
+ pjsua_acc_info info;
+ pj_status_t status = pjsua_acc_get_info(acc_id, &info);
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error obtaining call info"));
+ return false;
+ }
+
+ if (info.status != PJSIP_SC_OK)
+ return false;
+
+ pjrpid_element elem;
+ pj_bzero(&elem, sizeof(elem));
+ elem.type = PJRPID_ELEMENT_TYPE_PERSON;
+
+ switch(proto_status)
+ {
+ case ID_STATUS_AWAY:
+ elem.activity = PJRPID_ACTIVITY_AWAY;
+ elem.note = pj_str("Away");
+ break;
+ case ID_STATUS_NA:
+ elem.activity = PJRPID_ACTIVITY_AWAY;
+ elem.note = pj_str("Not avaible");
+ break;
+ case ID_STATUS_DND:
+ elem.activity = PJRPID_ACTIVITY_BUSY;
+ elem.note = pj_str("Do not disturb");
+ break;
+ case ID_STATUS_OCCUPIED:
+ elem.activity = PJRPID_ACTIVITY_BUSY;
+ elem.note = pj_str("Occupied");
+ break;
+ case ID_STATUS_FREECHAT:
+ elem.activity = PJRPID_ACTIVITY_UNKNOWN;
+ elem.note = pj_str("Free for chat");
+ break;
+ case ID_STATUS_ONTHEPHONE:
+ elem.activity = PJRPID_ACTIVITY_BUSY;
+ elem.note = pj_str("On the phone");
+ break;
+ case ID_STATUS_OUTTOLUNCH:
+ elem.activity = PJRPID_ACTIVITY_AWAY;
+ elem.note = pj_str("Out to lunch");
+ break;
+ default:
+ break;
+ }
+
+ pj_bool_t online = (proto_status == ID_STATUS_INVISIBLE ? PJ_FALSE : PJ_TRUE);
+
+ if (online == info.online_status && pj_strcmp(&info.online_status_text, &elem.note) == 0)
+ return false;
+
+ pjsua_acc_set_online_status2(acc_id, online, &elem);
+ return true;
+}
+
+
+void CALLBACK SIPProto::DisconnectProto(void *param)
+{
+ SIPProto *proto = (SIPProto *) param;
+ proto->Disconnect();
+}
+
+
+void SIPProto::on_reg_state()
+{
+ Trace(_T("on_reg_state"));
+
+ pjsua_acc_info info;
+ pj_status_t status = pjsua_acc_get_info(acc_id, &info);
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error obtaining call info"));
+ return;
+ }
+
+ if (info.status == PJSIP_SC_OK)
+ {
+ int status = (m_iDesiredStatus > ID_STATUS_OFFLINE ? m_iDesiredStatus : ID_STATUS_ONLINE);
+ SendPresence(status);
+ BroadcastStatus(status);
+ }
+ else
+ {
+ CallFunctionAsync(&SIPProto::DisconnectProto, this);
+ }
+}
+
+static void RemoveLtGt(TCHAR *str)
+{
+ int len = lstrlen(str);
+ if (str[0] == _T('<') && str[len-1] == _T('>'))
+ {
+ str[len-1] = 0;
+ memmove(str, &str[1], len * sizeof(TCHAR));
+ }
+}
+
+void SIPProto::on_incoming_call(pjsua_call_id call_id, pjsip_rx_data *rdata)
+{
+ Trace(_T("on_incoming_call: %d"), call_id);
+
+ pjsua_call_info info;
+ pj_status_t status = pjsua_call_get_info(call_id, &info);
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error obtaining call info"));
+ return;
+ }
+
+ TCHAR numberBuff[1024];
+ lstrcpyn(numberBuff, SipToTchar(info.remote_contact), MAX_REGS(numberBuff));
+ RemoveLtGt(numberBuff);
+
+ TCHAR name[256];
+ name[0] = 0;
+ SipToTchar remote_info(info.remote_info);
+ if (remote_info[0] == _T('"'))
+ {
+ TCHAR *other = _tcsstr(&remote_info[1], _T("\" <"));
+ if (other != NULL)
+ {
+ lstrcpyn(name, &remote_info[1], min(MAX_REGS(name), other - remote_info));
+ if (IsEmpty(numberBuff))
+ {
+ lstrcpyn(numberBuff, other+2, MAX_REGS(numberBuff));
+ RemoveLtGt(numberBuff);
+ }
+ }
+ }
+
+ if (IsEmpty(name) && IsEmpty(numberBuff))
+ lstrcpyn(numberBuff, remote_info, MAX_REGS(numberBuff));
+
+ TCHAR *number = numberBuff;
+
+ if (_tcsnicmp(_T("sip:"), number, 4) == 0)
+ {
+ number += 4;
+
+ TCHAR *host = _tcschr(number, _T('@'));
+ if (host != NULL && _tcsicmp(opts.host, host+1) == 0)
+ *host = 0;
+ }
+
+ NotifyCall(call_id, VOICE_STATE_RINGING, NULL, name, number);
+}
+
+
+void SIPProto::on_call_state(pjsua_call_id call_id, pjsip_event *e)
+{
+ Trace(_T("on_call_state: %d"), call_id);
+
+ pjsua_call_info info;
+ pj_status_t status = pjsua_call_get_info(call_id, &info);
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error obtaining call info"));
+ return;
+ }
+
+ Trace(_T("Call info: %d / last: %d %s"), info.state, info.last_status, info.last_status_text);
+
+ switch(info.state)
+ {
+ case PJSIP_INV_STATE_NULL:
+ case PJSIP_INV_STATE_DISCONNECTED:
+ {
+ NotifyCall(call_id, VOICE_STATE_ENDED);
+ break;
+ }
+ case PJSIP_INV_STATE_CONFIRMED:
+ {
+ NotifyCall(call_id, VOICE_STATE_TALKING);
+ break;
+ }
+ }
+
+}
+
+
+void SIPProto::on_call_media_state(pjsua_call_id call_id)
+{
+ Trace(_T("on_call_media_state: %d"), call_id);
+
+ pjsua_call_info info;
+ pj_status_t status = pjsua_call_get_info(call_id, &info);
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error obtaining call info"));
+ return;
+ }
+
+ // Connect ports appropriately when media status is ACTIVE or REMOTE HOLD,
+ // otherwise we should NOT connect the ports.
+ if (info.media_status == PJSUA_CALL_MEDIA_ACTIVE || info.media_status == PJSUA_CALL_MEDIA_REMOTE_HOLD)
+ {
+ ConfigureDevices();
+
+ pjsua_conf_connect(info.conf_slot, 0);
+ pjsua_conf_connect(0, info.conf_slot);
+ }
+
+ if (info.media_status == PJSUA_CALL_MEDIA_ACTIVE)
+ {
+ NotifyCall(call_id, VOICE_STATE_TALKING);
+ }
+ else if (info.media_status == PJSUA_CALL_MEDIA_LOCAL_HOLD)
+ {
+ NotifyCall(call_id, VOICE_STATE_ON_HOLD);
+ }
+}
+
+
+static int GetDevice(bool out, int defaultVal)
+{
+ DBVARIANT dbv;
+ if (DBGetContactSettingString(NULL, "VoiceService", out ? "Output" : "Input", &dbv))
+ return defaultVal;
+
+ int ret = defaultVal;
+
+ unsigned count = pjmedia_aud_dev_count();
+ for (unsigned i = 0; i < count; ++i)
+ {
+ pjmedia_aud_dev_info info;
+
+ pj_status_t status = pjmedia_aud_dev_get_info(i, &info);
+ if (status != PJ_SUCCESS)
+ continue;
+
+ if (!out && info.input_count < 1)
+ continue;
+ if (out && info.output_count < 1)
+ continue;
+
+ if (strcmp(dbv.pszVal, info.name) == 0)
+ {
+ ret = i;
+ break;
+ }
+ }
+
+ DBFreeVariant(&dbv);
+ return ret;
+}
+
+
+void SIPProto::ConfigureDevices()
+{
+ int input, output;
+ pjsua_get_snd_dev(&input, &output);
+
+ int expectedInput = GetDevice(false, input);
+ int expectedOutput = GetDevice(true, output);
+
+ if (input != expectedInput || output != expectedOutput)
+ pjsua_set_snd_dev(input, output);
+
+ if (DBGetContactSettingByte(NULL, "VoiceService", "EchoCancelation", TRUE))
+ pjsua_set_ec(PJSUA_DEFAULT_EC_TAIL_LEN, 0);
+ else
+ pjsua_set_ec(0, 0);
+}
+
+
+int __cdecl SIPProto::VoiceCaps(WPARAM wParam,LPARAM lParam)
+{
+ return VOICE_CAPS_VOICE | VOICE_CAPS_CALL_STRING;
+}
+
+
+void SIPProto::BuildURI(TCHAR *out, int outSize, const TCHAR *number)
+{
+ bool hasSip = (_tcsnicmp(_T("sip:"), number, 4) == 0);
+ bool hasHost = (_tcschr(number, _T('@')) != NULL);
+
+ if (!hasSip && !hasHost)
+ mir_sntprintf(out, outSize, _T("sip:%s@%s"), number, opts.host);
+ else if (!hasSip)
+ mir_sntprintf(out, outSize, _T("sip:%s"), number);
+ else
+ mir_sntprintf(out, outSize, _T("%s"), number);
+}
+
+
+int __cdecl SIPProto::VoiceCall(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact = (HANDLE) wParam;
+ TCHAR *number = (TCHAR *) lParam;
+
+ TCHAR uri[1024];
+
+ if (number != NULL)
+ {
+ if (!VoiceCallStringValid((WPARAM) number, 0))
+ return 1;
+
+ BuildURI(uri, MAX_REGS(uri), number);
+ }
+ else
+ {
+ // TODO
+ return 2;
+ }
+
+ pjsua_call_id call_id;
+ pj_status_t status = pjsua_call_make_call(acc_id, &pj_str(TcharToUtf8(uri)), 0, NULL, NULL, &call_id);
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error making call"));
+ return -1;
+ }
+
+ NotifyCall(call_id, VOICE_STATE_CALLING, hContact, number);
+
+ return 0;
+}
+
+
+int __cdecl SIPProto::VoiceAnswerCall(WPARAM wParam, LPARAM lParam)
+{
+ char *id = (char *) wParam;
+ if (id == NULL || id[0] == 0)
+ return 1;
+
+ pjsua_call_id call_id = (pjsua_call_id) atoi(id);
+ if (call_id < 0 || call_id >= (int) pjsua_call_get_max_count())
+ return 2;
+
+ pjsua_call_info info;
+ pj_status_t status = pjsua_call_get_info(call_id, &info);
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error obtaining call info"));
+ return -1;
+ }
+
+ if (info.state == PJSIP_INV_STATE_INCOMING)
+ {
+ pj_status_t status = pjsua_call_answer(call_id, 200, NULL, NULL);
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error answering call"));
+ return -1;
+ }
+ }
+ else if (info.media_status == PJSUA_CALL_MEDIA_LOCAL_HOLD)
+ {
+ pj_status_t status = pjsua_call_reinvite(call_id, PJ_TRUE, NULL);
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error un-holding call"));
+ return -1;
+ }
+ }
+ else
+ {
+ // Wrong state
+ return 3;
+ }
+
+ return 0;
+}
+
+
+int __cdecl SIPProto::VoiceDropCall(WPARAM wParam, LPARAM lParam)
+{
+ char *id = (char *) wParam;
+ if (id == NULL || id[0] == 0)
+ return 1;
+
+ pjsua_call_id call_id = (pjsua_call_id) atoi(id);
+ if (call_id < 0 || call_id >= (int) pjsua_call_get_max_count())
+ return 2;
+
+ pj_status_t status = pjsua_call_hangup(call_id, 0, NULL, NULL);
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error hanging up call"));
+ return -1;
+ }
+
+ return 0;
+}
+
+
+int __cdecl SIPProto::VoiceHoldCall(WPARAM wParam, LPARAM lParam)
+{
+ char *id = (char *) wParam;
+ if (id == NULL || id[0] == 0)
+ return 1;
+
+ pjsua_call_id call_id = (pjsua_call_id) atoi(id);
+ if (call_id < 0 || call_id >= (int) pjsua_call_get_max_count())
+ return 2;
+
+ pj_status_t status = pjsua_call_set_hold(call_id, NULL);
+ if (status != PJ_SUCCESS)
+ {
+ Error(status, _T("Error holding call"));
+ return -1;
+ }
+
+ // NotifyCall(0, VOICE_STATE_ON_HOLD);
+
+ return 0;
+}
+
+
+static bool IsValidDTMF(TCHAR c)
+{
+ if (c >= _T('A') && c <= _T('D'))
+ return true;
+ if (c >= _T('0') && c <= _T('9'))
+ return true;
+ if (c == _T('#') || c == _T('*'))
+ return true;
+
+ return false;
+}
+
+
+int __cdecl SIPProto::VoiceSendDTMF(WPARAM wParam, LPARAM lParam)
+{
+ char *id = (char *) wParam;
+ TCHAR c = (TCHAR) lParam;
+ if (id == NULL || id[0] == 0 || c == 0)
+ return 1;
+
+ pjsua_call_id call_id = (pjsua_call_id) atoi(id);
+ if (call_id < 0 || call_id >= (int) pjsua_call_get_max_count())
+ return 2;
+
+ if (c >= _T('a') && c <= _T('d'))
+ c += _T('A') - _T('a');
+
+ if (!IsValidDTMF(c))
+ return 3;
+
+ TCHAR tmp[2];
+ tmp[0] = c;
+ tmp[1] = 0;
+ pjsua_call_dial_dtmf(call_id, &pj_str(TcharToUtf8(tmp)));
+
+ return 0;
+}
+
+
+int __cdecl SIPProto::VoiceCallStringValid(WPARAM wParam, LPARAM lParam)
+{
+ TCHAR *number = (TCHAR *) wParam;
+
+ if (m_iStatus <= ID_STATUS_OFFLINE)
+ return 0;
+
+ if (number == NULL || number[0] == 0)
+ return 0;
+
+ TCHAR tmp[1024];
+ BuildURI(tmp, MAX_REGS(tmp), number);
+ return pjsua_verify_sip_url(TcharToUtf8(tmp)) == PJ_SUCCESS;
+}
+
+
+
+
+
+
+static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ SIPProto *proto = (SIPProto *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
+
+ switch(msg)
+ {
+ case WM_INITDIALOG:
+ {
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
+ proto = (SIPProto *) lParam;
+ break;
+ }
+ }
+
+ if (proto == NULL)
+ return FALSE;
+
+ return SaveOptsDlgProc(proto->accountManagerCtrls, MAX_REGS(proto->accountManagerCtrls),
+ proto->m_szModuleName, hwnd, msg, wParam, lParam);
+}
+
+
+static INT_PTR CALLBACK DlgOptions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ SIPProto *proto = (SIPProto *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
+
+ switch(msg)
+ {
+ case WM_INITDIALOG:
+ {
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
+ proto = (SIPProto *) lParam;
+ break;
+ }
+ }
+
+ if (proto == NULL)
+ return FALSE;
+
+ return SaveOptsDlgProc(proto->optionsCtrls, MAX_REGS(proto->optionsCtrls),
+ proto->m_szModuleName, hwnd, msg, wParam, lParam);
+}
+
+
diff --git a/Protocols/SIP/SIPProto.h b/Protocols/SIP/SIPProto.h
new file mode 100644
index 0000000..53f81e8
--- /dev/null
+++ b/Protocols/SIP/SIPProto.h
@@ -0,0 +1,155 @@
+/*
+Copyright (C) 2009 Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __SIPPROTO_H__
+#define __SIPPROTO_H__
+
+
+class SIPProto;
+typedef INT_PTR (__cdecl SIPProto::*SIPServiceFunc)(WPARAM, LPARAM);
+typedef INT_PTR (__cdecl SIPProto::*SIPServiceFuncParam)(WPARAM, LPARAM, LPARAM);
+typedef int (__cdecl SIPProto::*SIPEventFunc)(WPARAM, LPARAM);
+
+class SIPProto : public PROTO_INTERFACE
+{
+private:
+ HANDLE hNetlibUser;
+ HANDLE hCallStateEvent;
+ //bool hasToDestroy;
+ pjsua_transport_id transport_id;
+ pjsua_acc_id acc_id;
+
+ struct {
+ TCHAR host[256];
+ int port;
+ TCHAR username[16];
+ char password[16];
+ BYTE savePassword;
+
+ struct {
+ TCHAR host[256];
+ TCHAR port;
+ } stun;
+ } opts;
+
+public:
+ OptPageControl accountManagerCtrls[5];
+ OptPageControl optionsCtrls[7];
+
+ SIPProto(const char *aProtoName, const TCHAR *aUserName);
+ virtual ~SIPProto();
+
+ virtual HANDLE __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr ) { return 0; }
+ virtual HANDLE __cdecl AddToListByEvent( int flags, int iContact, HANDLE hDbEvent ) { return 0; }
+
+ virtual int __cdecl Authorize( HANDLE hDbEvent ) { return 1; }
+ virtual int __cdecl AuthDeny( HANDLE hDbEvent, const char* szReason ) { return 1; }
+ virtual int __cdecl AuthRecv( HANDLE hContact, PROTORECVEVENT* ) { return 1; }
+ virtual int __cdecl AuthRequest( HANDLE hContact, const char* szMessage ) { return 1; }
+
+ virtual HANDLE __cdecl ChangeInfo( int iInfoType, void* pInfoData ) { return 0; }
+
+ virtual HANDLE __cdecl FileAllow( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath ) { return 0; }
+ virtual int __cdecl FileCancel( HANDLE hContact, HANDLE hTransfer ) { return 1; }
+ virtual int __cdecl FileDeny( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason ) { return 1; }
+ virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const PROTOCHAR** szFilename ) { return 1; }
+
+ virtual DWORD_PTR __cdecl GetCaps( int type, HANDLE hContact = NULL );
+
+ virtual HICON __cdecl GetIcon( int iconIndex ) { return 0; }
+ virtual int __cdecl GetInfo( HANDLE hContact, int infoType ) { return 1; }
+
+ virtual HANDLE __cdecl SearchBasic( const char* id ) { return 0; }
+ virtual HANDLE __cdecl SearchByEmail( const char* email ) { return 0; }
+ virtual HANDLE __cdecl SearchByName( const char* nick, const char* firstName, const char* lastName ) { return 0; }
+ virtual HWND __cdecl SearchAdvanced( HWND owner ) { return 0; }
+ virtual HWND __cdecl CreateExtendedSearchUI( HWND owner ) { return 0; }
+
+ virtual int __cdecl RecvContacts( HANDLE hContact, PROTORECVEVENT* ) { return 1; }
+ virtual int __cdecl RecvFile( HANDLE hContact, PROTOFILEEVENT* ) { return 1; }
+ virtual int __cdecl RecvMsg( HANDLE hContact, PROTORECVEVENT* ) { return 1; }
+ virtual int __cdecl RecvUrl( HANDLE hContact, PROTORECVEVENT* ) { return 1; }
+
+ virtual int __cdecl SendContacts( HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList ) { return 1; }
+ virtual HANDLE __cdecl SendFile( HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles ) { return 0; }
+ virtual int __cdecl SendMsg( HANDLE hContact, int flags, const char* msg ) { return 1; }
+ virtual int __cdecl SendUrl( HANDLE hContact, int flags, const char* url ) { return 1; }
+
+ virtual int __cdecl SetApparentMode( HANDLE hContact, int mode ) { return 1; }
+
+ virtual int __cdecl SetStatus( int iNewStatus );
+
+ virtual HANDLE __cdecl GetAwayMsg( HANDLE hContact ) { return 0; }
+ virtual int __cdecl RecvAwayMsg( HANDLE hContact, int mode, PROTORECVEVENT* evt ) { return 1; }
+ virtual int __cdecl SendAwayMsg( HANDLE hContact, HANDLE hProcess, const char* msg ) { return 1; }
+ virtual int __cdecl SetAwayMsg( int iStatus, const char* msg ) { return 1; }
+
+ virtual int __cdecl UserIsTyping( HANDLE hContact, int type ) { return 0; }
+
+ virtual int __cdecl OnEvent( PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam );
+
+ void on_reg_state();
+ void on_incoming_call(pjsua_call_id call_id, pjsip_rx_data *rdata);
+ void on_call_state(pjsua_call_id call_id, pjsip_event *e);
+ void on_call_media_state(pjsua_call_id call_id);
+
+private:
+ void BroadcastStatus(int newStatus);
+ void CreateProtoService(const char* szService, SIPServiceFunc serviceProc);
+ void CreateProtoService(const char* szService, SIPServiceFuncParam serviceProc, LPARAM lParam);
+ HANDLE CreateProtoEvent(const char* szService);
+ void HookProtoEvent(const char* szEvent, SIPEventFunc pFunc);
+ int SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam);
+
+ int __cdecl OnModulesLoaded(WPARAM wParam, LPARAM lParam);
+ int __cdecl OnOptionsInit(WPARAM wParam,LPARAM lParam);
+ int __cdecl OnPreShutdown(WPARAM wParam,LPARAM lParam);
+
+ void Trace(TCHAR *fmt, ...);
+ void Info(TCHAR *fmt, ...);
+ void Error(TCHAR *fmt, ...);
+ void Error(pj_status_t status, TCHAR *fmt, ...);
+ void ShowMessage(int type, TCHAR *fmt, va_list args);
+
+ bool SendPresence(int status);
+ int Connect();
+ void Disconnect();
+ INT_PTR __cdecl CreateAccMgrUI(WPARAM wParam, LPARAM lParam);
+
+ void ConfigureDevices();
+ void BuildURI(TCHAR *out, int outSize, const TCHAR *number);
+
+ // Voice services
+ void NotifyCall(pjsua_call_id call_id, int state, HANDLE hContact = NULL, TCHAR *name = NULL, TCHAR *number = NULL);
+ int __cdecl VoiceCaps(WPARAM wParam,LPARAM lParam);
+ int __cdecl VoiceCall(WPARAM wParam,LPARAM lParam);
+ int __cdecl VoiceAnswerCall(WPARAM wParam,LPARAM lParam);
+ int __cdecl VoiceDropCall(WPARAM wParam,LPARAM lParam);
+ int __cdecl VoiceHoldCall(WPARAM wParam,LPARAM lParam);
+ int __cdecl VoiceSendDTMF(WPARAM wParam,LPARAM lParam);
+ int __cdecl VoiceCallStringValid(WPARAM wParam,LPARAM lParam);
+
+ // Static callbacks
+ static void CALLBACK DisconnectProto(void *param);
+};
+
+
+
+
+#endif // __SIPPROTO_H__
diff --git a/Protocols/SIP/commons.h b/Protocols/SIP/commons.h
new file mode 100644
index 0000000..a310667
--- /dev/null
+++ b/Protocols/SIP/commons.h
@@ -0,0 +1,135 @@
+/*
+Copyright (C) 2009 Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+
+#ifndef __COMMONS_H__
+# define __COMMONS_H__
+
+
+#define OEMRESOURCE
+#define _WIN32_WINNT 0x0400
+#include <windows.h>
+#include <commctrl.h>
+#include <tchar.h>
+#include <stdio.h>
+#include <time.h>
+
+#include <vector>
+#include <list>
+
+// Miranda headers
+#define MIRANDA_VER 0x0900
+#include <win2k.h>
+#include <newpluginapi.h>
+#include <m_system.h>
+#include <m_system_cpp.h>
+#include <m_protocols.h>
+#include <m_protosvc.h>
+#include <m_protomod.h>
+#include <m_protoint.h>
+#include <m_clist.h>
+#include <m_contacts.h>
+#include <m_langpack.h>
+#include <m_database.h>
+#include <m_options.h>
+#include <m_utils.h>
+#include <m_updater.h>
+#include <m_popup.h>
+#include <m_history.h>
+#include <m_message.h>
+#include <m_folders.h>
+#include <m_icolib.h>
+#include <m_avatars.h>
+#include <m_netlib.h>
+#include <m_fontservice.h>
+
+#include <pjlib.h>
+#include <pjlib-util.h>
+#include <pjsip.h>
+#include <pjsip_ua.h>
+#include <pjsip_simple.h>
+#include <pjsua-lib/pjsua.h>
+#include <pjmedia.h>
+#include <pjmedia-codec.h>
+
+#include "../../plugins/utils/mir_memory.h"
+#include "../../plugins/utils/mir_options.h"
+#include "../../plugins/utils/mir_icons.h"
+#include "../../plugins/utils/mir_log.h"
+#include "../../plugins/utils/utf8_helpers.h"
+#include "../../plugins/utils/scope.h"
+#include "../../plugins/voiceservice/m_voice.h"
+#include "../../plugins/voiceservice/m_voiceservice.h"
+
+#include "resource.h"
+#include "SIPProto.h"
+
+
+#define MODULE_NAME "SIP"
+
+
+// Global Variables
+extern HINSTANCE hInst;
+extern PLUGINLINK *pluginLink;
+extern OBJLIST<SIPProto> instances;
+
+#define MAX_REGS(_A_) ( sizeof(_A_) / sizeof(_A_[0]) )
+#define MIR_FREE(_X_) if (_X_ != NULL) { mir_free(_X_); _X_ = NULL; }
+
+
+
+static TCHAR *lstrtrim(TCHAR *str)
+{
+ int len = lstrlen(str);
+
+ int i;
+ for(i = len - 1; i >= 0 && (str[i] == ' ' || str[i] == '\t'); --i) ;
+ if (i < len - 1)
+ {
+ ++i;
+ str[i] = _T('\0');
+ len = i;
+ }
+
+ for(i = 0; i < len && (str[i] == ' ' || str[i] == '\t'); ++i) ;
+ if (i > 0)
+ memmove(str, &str[i], (len - i + 1) * sizeof(TCHAR));
+
+ return str;
+}
+
+
+static BOOL IsEmptyA(const char *str)
+{
+ return str == NULL || str[0] == 0;
+}
+
+static BOOL IsEmptyW(const WCHAR *str)
+{
+ return str == NULL || str[0] == 0;
+}
+
+#ifdef UNICODE
+# define IsEmpty IsEmptyW
+#else
+# define IsEmpty IsEmptyA
+#endif
+
+
+#endif // __COMMONS_H__
diff --git a/Protocols/SIP/resource.h b/Protocols/SIP/resource.h
new file mode 100644
index 0000000..4569f2a
--- /dev/null
+++ b/Protocols/SIP/resource.h
@@ -0,0 +1,42 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by resource.rc
+//
+#define IDD_OPTIONS 119
+#define IDD_OPTIONS_OLD 120
+#define IDD_EMOTICON_SELECTION 126
+#define IDD_ACCMGRUI 227
+#define IDC_USERNAME 1000
+#define IDC_PASSWORD 1001
+#define IDC_NAME 1002
+#define IDC_NUMBER 1003
+#define IDC_PORT 1004
+#define IDC_STUN_PORT 1005
+#define IDC_HOST 1043
+#define IDC_STUN_HOST 1044
+#define IDC_SAVEPASSWORD 1048
+#define IDC_INPUT_TOO 1060
+#define IDC_IGNORE_UPPERCASE 1065
+#define IDC_AUTO_USER 1066
+#define IDC_USE_DEFAULT_PACK 1066
+#define IDC_PACK 1075
+#define IDC_GETMORE 1076
+#define IDC_EMOTICONS 1080
+#define IDC_ONLY_ISOLATED 1086
+#define IDC_ONLY_ISOLATED2 1087
+#define IDC_CUSTOM_SMILEYS 1087
+#define IDC_VIDEO 1088
+#define IDC_STATIC -1
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NO_MFC 1
+#define _APS_3D_CONTROLS 1
+#define _APS_NEXT_RESOURCE_VALUE 128
+#define _APS_NEXT_COMMAND_VALUE 40005
+#define _APS_NEXT_CONTROL_VALUE 1087
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/Protocols/SIP/resource.rc b/Protocols/SIP/resource.rc
new file mode 100644
index 0000000..229bfdf
--- /dev/null
+++ b/Protocols/SIP/resource.rc
@@ -0,0 +1,121 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "resource.h"
+#include "winresrc.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ACCMGRUI DIALOGEX 0, 0, 186, 134
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ LTEXT "Server:",IDC_STATIC,0,0,53,12,SS_CENTERIMAGE
+ EDITTEXT IDC_HOST,54,0,92,12,ES_AUTOHSCROLL
+ CTEXT ":",IDC_STATIC,147,0,8,12,SS_CENTERIMAGE
+ EDITTEXT IDC_PORT,155,0,30,12,ES_AUTOHSCROLL | ES_NUMBER
+ LTEXT "User:",IDC_STATIC,0,16,53,12,SS_CENTERIMAGE
+ EDITTEXT IDC_USERNAME,54,16,131,12,ES_AUTOHSCROLL
+ LTEXT "Password:",IDC_STATIC,0,31,53,12,SS_CENTERIMAGE
+ EDITTEXT IDC_PASSWORD,54,32,131,12,ES_PASSWORD | ES_AUTOHSCROLL
+ CONTROL "Save password",IDC_SAVEPASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,48,131,10
+END
+
+IDD_OPTIONS DIALOGEX 0, 0, 216, 152
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ GROUPBOX "SIP",IDC_STATIC,3,4,209,76
+ LTEXT "Server:",IDC_STATIC,14,17,53,12,SS_CENTERIMAGE
+ EDITTEXT IDC_HOST,68,17,92,12,ES_AUTOHSCROLL
+ CTEXT ":",IDC_STATIC,162,17,8,12,SS_CENTERIMAGE
+ EDITTEXT IDC_PORT,170,17,30,12,ES_AUTOHSCROLL | ES_NUMBER
+ LTEXT "User:",IDC_STATIC,14,33,53,12,SS_CENTERIMAGE
+ EDITTEXT IDC_USERNAME,68,33,131,12,ES_AUTOHSCROLL
+ LTEXT "Password:",IDC_STATIC,14,48,53,12,SS_CENTERIMAGE
+ EDITTEXT IDC_PASSWORD,68,49,131,12,ES_PASSWORD | ES_AUTOHSCROLL
+ CONTROL "Save password",IDC_SAVEPASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,65,131,10
+ GROUPBOX "Advanced",IDC_STATIC,3,84,209,33,NOT WS_VISIBLE
+ LTEXT "STUN Server:",IDC_STATIC,14,98,53,12,SS_CENTERIMAGE | NOT WS_VISIBLE
+ EDITTEXT IDC_STUN_HOST,68,98,92,12,ES_AUTOHSCROLL | NOT WS_VISIBLE
+ CTEXT ":",IDC_STATIC,162,98,8,12,SS_CENTERIMAGE | NOT WS_VISIBLE
+ EDITTEXT IDC_STUN_PORT,170,98,30,12,ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (Canada) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""resource.h""\r\n"
+ "#include ""winresrc.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (Canada) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/Protocols/SIP/sdk/m_folders.h b/Protocols/SIP/sdk/m_folders.h
new file mode 100644
index 0000000..c232410
--- /dev/null
+++ b/Protocols/SIP/sdk/m_folders.h
@@ -0,0 +1,205 @@
+/*
+Custom profile folders plugin for Miranda IM
+
+Copyright © 2005 Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#ifndef M_CUSTOM_FOLDERS_H
+#define M_CUSTOM_FOLDERS_H
+
+#define FOLDERS_API 501 //dunno why it's here but it is :)
+
+#define PROFILE_PATH "%profile_path%"
+#define CURRENT_PROFILE "%current_profile%"
+#define MIRANDA_PATH "%miranda_path%"
+#define PLUGINS_PATH "%miranda_path%" "\\plugins"
+
+#define TO_WIDE(x) L ## x
+
+#define PROFILE_PATHW L"%profile_path%"
+#define CURRENT_PROFILEW L"%current_profile%"
+#define MIRANDA_PATHW L"%miranda_path%"
+
+#define FOLDER_AVATARS PROFILE_PATH "\\" CURRENT_PROFILE "\\avatars"
+#define FOLDER_VCARDS PROFILE_PATH "\\" CURRENT_PROFILE "\\vcards"
+#define FOLDER_LOGS PROFILE_PATH "\\" CURRENT_PROFILE "\\logs"
+#define FOLDER_RECEIVED_FILES PROFILE_PATH "\\" CURRENT_PROFILE "\\received files"
+#define FOLDER_DOCS MIRANDA_PATH "\\" "docs"
+
+#define FOLDER_CONFIG PLUGINS_PATH "\\" "config"
+
+#define FOLDER_SCRIPTS MIRANDA_PATH "\\" "scripts"
+
+#define FOLDER_UPDATES MIRANDA_PATH "\\" "updates"
+
+#define FOLDER_CUSTOMIZE MIRANDA_PATH "\\" "customize"
+#define FOLDER_CUSTOMIZE_SOUNDS FOLDER_CUSTOMIZE "\\sounds"
+#define FOLDER_CUSTOMIZE_ICONS FOLDER_CUSTOMIZE "\\icons"
+#define FOLDER_CUSTOMIZE_SMILEYS FOLDER_CUSTOMIZE "\\smileys"
+#define FOLDER_CUSTOMIZE_SKINS FOLDER_CUSTOMIZE "\\skins"
+#define FOLDER_CUSTOMIZE_THEMES FOLDER_CUSTOMIZE "\\themes"
+
+
+#define FOLDERS_NAME_MAX_SIZE 64 //maximum name and section size
+
+#define FF_UNICODE 0x00000001
+
+typedef struct{
+ int cbSize; //size of struct
+ char szSection[FOLDERS_NAME_MAX_SIZE]; //section name, if it doesn't exist it will be created otherwise it will just add this entry to it
+ char szName[FOLDERS_NAME_MAX_SIZE]; //entry name - will be shown in options
+ union{
+ const char *szFormat; //default string format. Fallback string in case there's no entry in the database for this folder. This should be the initial value for the path, users will be able to change it later.
+ const wchar_t *szFormatW; //String is dup()'d so you can free it later. If you set the unicode string don't forget to set the flag accordingly.
+ const TCHAR *szFormatT;
+ };
+ DWORD flags; //FF_* flags
+} FOLDERSDATA;
+
+/*Folders/Register/Path service
+ wParam - not used, must be 0
+ lParam - (LPARAM) (const FOLDERDATA *) - Data structure filled with
+ the necessary information.
+ Returns a handle to the registered path or 0 on error.
+ You need to use this to call the other services.
+*/
+#define MS_FOLDERS_REGISTER_PATH "Folders/Register/Path"
+
+/*Folders/Get/PathSize service
+ wParam - (WPARAM) (int) - handle to registered path
+ lParam - (LPARAM) (int *) - pointer to the variable that receives the size of the path
+ string (not including the null character). Depending on the flags set when creating the path
+ it will either call strlen() or wcslen() to get the length of the string.
+ Returns the size of the buffer.
+*/
+#define MS_FOLDERS_GET_SIZE "Folders/Get/PathSize"
+
+typedef struct{
+ int cbSize;
+ int nMaxPathSize; //maximum size of buffer. This represents the number of characters that can be copied to it (so for unicode strings you don't send the number of bytes but the length of the string).
+ union{
+ char *szPath; //pointer to the buffer that receives the path without the last "\\"
+ wchar_t *szPathW; //unicode version of the buffer.
+ TCHAR *szPathT;
+ };
+} FOLDERSGETDATA;
+
+/*Folders/Get/Path service
+ wParam - (WPARAM) (int) - handle to registered path
+ lParam - (LPARAM) (FOLDERSGETDATA *) pointer to a FOLDERSGETDATA that has all the relevant fields filled.
+ Should return 0 on success, or nonzero otherwise.
+*/
+#define MS_FOLDERS_GET_PATH "Folders/Get/Path"
+
+typedef struct{
+ int cbSize;
+ union{
+ char **szPath; //address of a string variable (char *) or (wchar_t*) where the path should be stored (the last \ won't be copied).
+ wchar_t **szPathW; //unicode version of string.
+ TCHAR **szPathT;
+ };
+} FOLDERSGETALLOCDATA;
+
+/*Folders/GetRelativePath/Alloc service
+ wParam - (WPARAM) (int) - Handle to registered path
+ lParam - (LPARAM) (FOLDERSALLOCDATA *) data
+ This service is the same as MS_FOLDERS_GET_PATH with the difference that this service
+ allocates the needed space for the buffer. It uses miranda's memory functions for that and you need
+ to use those to free the resulting buffer.
+ Should return 0 on success, or nonzero otherwise. Currently it only returns 0.
+*/
+#define MS_FOLDERS_GET_PATH_ALLOC "Folders/Get/Path/Alloc"
+
+
+/*Folders/On/Path/Changed
+ wParam - (WPARAM) 0
+ lParam - (LPARAM) 0
+ Triggered when the folders change, you should reget the paths you registered.
+*/
+#define ME_FOLDERS_PATH_CHANGED "Folders/On/Path/Changed"
+
+#ifndef FOLDERS_NO_HELPER_FUNCTIONS
+//#include "../../../include/newpluginapi.h"
+
+__inline static int FoldersRegisterCustomPath(const char *section, const char *name, const char *defaultPath)
+{
+ FOLDERSDATA fd = {0};
+ if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) return 1;
+ fd.cbSize = sizeof(FOLDERSDATA);
+ strncpy(fd.szSection, section, FOLDERS_NAME_MAX_SIZE);
+ fd.szSection[FOLDERS_NAME_MAX_SIZE - 1] = '\0';
+ strncpy(fd.szName, name, FOLDERS_NAME_MAX_SIZE);
+ fd.szName[FOLDERS_NAME_MAX_SIZE - 1] = '\0';
+ fd.szFormat = defaultPath;
+ return CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM) &fd);
+}
+
+__inline static int FoldersRegisterCustomPathW(const char *section, const char *name, const wchar_t *defaultPathW)
+{
+ FOLDERSDATA fd = {0};
+ if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) return 1;
+ fd.cbSize = sizeof(FOLDERSDATA);
+ strncpy(fd.szSection, section, FOLDERS_NAME_MAX_SIZE);
+ fd.szSection[FOLDERS_NAME_MAX_SIZE - 1] = '\0'; //make sure it's NULL terminated
+ strncpy(fd.szName, name, FOLDERS_NAME_MAX_SIZE);
+ fd.szName[FOLDERS_NAME_MAX_SIZE - 1] = '\0'; //make sure it's NULL terminated
+ fd.szFormatW = defaultPathW;
+ fd.flags = FF_UNICODE;
+ return CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM) &fd);
+}
+
+__inline static int FoldersGetCustomPath(HANDLE hFolderEntry, char *path, const int size, char *notFound)
+{
+ FOLDERSGETDATA fgd = {0};
+ fgd.cbSize = sizeof(FOLDERSGETDATA);
+ fgd.nMaxPathSize = size;
+ fgd.szPath = path;
+ int res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
+ if (res)
+ {
+ strncpy(path, notFound, size);
+ path[size - 1] = '\0'; //make sure it's NULL terminated
+ }
+ return res;
+}
+
+__inline static int FoldersGetCustomPathW(HANDLE hFolderEntry, wchar_t *pathW, const int count, wchar_t *notFoundW)
+{
+ FOLDERSGETDATA fgd = {0};
+ fgd.cbSize = sizeof(FOLDERSGETDATA);
+ fgd.nMaxPathSize = count;
+ fgd.szPathW = pathW;
+ int res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
+ if (res)
+ {
+ wcsncpy(pathW, notFoundW, count);
+ pathW[count - 1] = '\0';
+ }
+ return res;
+}
+
+# ifdef _UNICODE
+# define FoldersGetCustomPathT FoldersGetCustomPathW
+# define FoldersRegisterCustomPathT FoldersRegisterCustomPathW
+#else
+# define FoldersGetCustomPathT FoldersGetCustomPath
+# define FoldersRegisterCustomPathT FoldersRegisterCustomPath
+#endif
+
+#endif
+
+#endif //M_CUSTOM_FOLDERS_H \ No newline at end of file
diff --git a/Protocols/SIP/sdk/m_updater.h b/Protocols/SIP/sdk/m_updater.h
new file mode 100644
index 0000000..371b743
--- /dev/null
+++ b/Protocols/SIP/sdk/m_updater.h
@@ -0,0 +1,146 @@
+#ifndef _M_UPDATER_H
+#define _M_UPDATER_H
+
+// NOTES:
+// - For langpack updates, include a string of the following format in the langpack text file:
+// ";FLID: <file listing name> <version>"
+// version must be four numbers seperated by '.', in the range 0-255 inclusive
+// - Updater will disable plugins that are downloaded but were not active prior to the update (this is so that, if an archive contains e.g. ansi and
+// unicode versions, the correct plugin will be the only one active after the new version is installed)...so if you add a support plugin, you may need
+// to install an ini file to make the plugin activate when miranda restarts after the update
+// - Updater will replace all dlls that have the same internal shortName as a downloaded update dll (this is so that msn1.dll and msn2.dll, for example,
+// will both be updated) - so if you have a unicode and a non-unicode version of a plugin in your archive, you should make the internal names different (which will break automatic
+// updates from the file listing if there is only one file listing entry for both versions, unless you use the 'MS_UPDATE_REGISTER' service below)
+// - Updater will install all files in the root of the archive into the plugins folder, except for langpack files that contain the FLID string which go into the root folder (same
+// folder as miranda32.exe)...all folders in the archive will also be copied to miranda's root folder, and their contents transferred into the new folders. The only exception is a
+// special folder called 'root_files' - if there is a folder by that name in the archive, it's contents will also be copied into miranda's root folder - this is intended to be used
+// to install additional dlls etc that a plugin may require)
+
+// if you set Update.szUpdateURL to the following value when registering, as well as setting your beta site and version data,
+// Updater will ignore szVersionURL and pbVersionPrefix, and attempt to find the file listing URL's from the backend XML data.
+// for this to work, the plugin name in pluginInfo.shortName must match the file listing exactly (except for case)
+#define UPDATER_AUTOREGISTER "UpdaterAUTOREGISTER"
+// Updater will also use the backend xml data if you provide URL's that reference the miranda file listing for updates (so you can use that method
+// if e.g. your plugin shortName does not match the file listing) - it will grab the file listing id from the end of these URLs
+
+typedef struct Update_tag {
+ int cbSize;
+ char *szComponentName; // component name as it will appear in the UI (will be translated before displaying)
+
+ char *szVersionURL; // URL where the current version can be found (NULL to disable)
+ BYTE *pbVersionPrefix; // bytes occuring in VersionURL before the version, used to locate the version information within the URL data
+ // (note that this URL could point at a binary file - dunno why, but it could :)
+ int cpbVersionPrefix; // number of bytes pointed to by pbVersionPrefix
+ char *szUpdateURL; // URL where dll/zip is located
+ // set to UPDATER_AUTOREGISTER if you want Updater to find the file listing URLs (ensure plugin shortName matches file listing!)
+
+ char *szBetaVersionURL; // URL where the beta version can be found (NULL to disable betas)
+ BYTE *pbBetaVersionPrefix; // bytes occuring in VersionURL before the version, used to locate the version information within the URL data
+ int cpbBetaVersionPrefix; // number of bytes pointed to by pbVersionPrefix
+ char *szBetaUpdateURL; // URL where dll/zip is located
+
+ BYTE *pbVersion; // bytes of current version, used for comparison with those in VersionURL
+ int cpbVersion; // number of bytes pointed to by pbVersion
+
+ char *szBetaChangelogURL; // url for displaying changelog for beta versions
+} Update;
+
+// register a comonent with Updater
+//
+// wparam = 0
+// lparam = (LPARAM)&Update
+#define MS_UPDATE_REGISTER "Update/Register"
+
+// utility functions to create a version string from a DWORD or from pluginInfo
+// point buf at a buffer at least 16 chars wide - but note the version string returned may be shorter
+//
+__inline static char *CreateVersionString(DWORD version, char *buf) {
+ mir_snprintf(buf, 16, "%d.%d.%d.%d", (version >> 24) & 0xFF, (version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);
+ return buf;
+}
+
+__inline static char *CreateVersionStringPlugin(PLUGININFO *pluginInfo, char *buf) {
+ return CreateVersionString(pluginInfo->version, buf);
+}
+
+
+// register the 'easy' way - use this method if you have no beta URL and the plugin is on the miranda file listing
+// NOTE: the plugin version string on the file listing must be the string version of the version in pluginInfo (i.e. 0.0.0.1,
+// four numbers between 0 and 255 inclusivem, so no letters, brackets, etc.)
+//
+// wParam = (int)fileID - this is the file ID from the file listing (i.e. the number at the end of the download link)
+// lParam = (PLUGININFO*)&pluginInfo
+#define MS_UPDATE_REGISTERFL "Update/RegisterFL"
+
+// this function can be used to 'unregister' components - useful for plugins that register non-plugin/langpack components and
+// may need to change those components on the fly
+// lParam = (char *)szComponentName
+#define MS_UPDATE_UNREGISTER "Update/Unregister"
+
+// this event is fired when the startup process is complete, but NOT if a restart is imminent
+// it is designed for status managment plugins to use as a trigger for beggining their own startup process
+// wParam = lParam = 0 (unused)
+// (added in version 0.1.6.0)
+#define ME_UPDATE_STARTUPDONE "Update/StartupDone"
+
+// this service can be used to enable/disable Updater's global status control
+// it can be called from the StartupDone event handler
+// wParam = (BOOL)enable
+// lParam = 0
+// (added in version 0.1.6.0)
+#define MS_UPDATE_ENABLESTATUSCONTROL "Update/EnableStatusControl"
+
+// An description of usage of the above service and event:
+// Say you are a status control plugin that normally sets protocol or global statuses in your ModulesLoaded event handler.
+// In order to make yourself 'Updater compatible', you would move the status control code from ModulesLoaded to another function,
+// say DoStartup. Then, in ModulesLoaded you would check for the existence of the MS_UPDATE_ENABLESTATUSCONTROL service.
+// If it does not exist, call DoStartup. If it does exist, hook the ME_UPDATE_STARTUPDONE event and call DoStartup from there. You may
+// also wish to call MS_UPDATE_ENABLESTATUSCONTROL with wParam == FALSE at this time, to disable Updater's own status control feature.
+
+// this service can be used to determine whether updates are possible for a component with the given name
+// wParam = 0
+// lParam = (char *)szComponentName
+// returns TRUE if updates are supported, FALSE otherwise
+#define MS_UPDATE_ISUPDATESUPPORTED "Update/IsUpdateSupported"
+
+#endif
+
+
+/////////////// Usage Example ///////////////
+
+#ifdef EXAMPLE_CODE
+
+// you need to #include "m_updater.h" and HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded) in your Load function...
+
+int OnModulesLoaded(WPARAM wParam, LPARAM lParam) {
+
+ Update update = {0}; // for c you'd use memset or ZeroMemory...
+ char szVersion[16];
+
+ update.cbSize = sizeof(Update);
+
+ update.szComponentName = pluginInfo.shortName;
+ update.pbVersion = (BYTE *)CreateVersionString(&pluginInfo, szVersion);
+ update.cpbVersion = strlen((char *)update.pbVersion);
+
+ // these are the three lines that matter - the archive, the page containing the version string, and the text (or data)
+ // before the version that we use to locate it on the page
+ // (note that if the update URL and the version URL point to standard file listing entries, the backend xml
+ // data will be used to check for updates rather than the actual web page - this is not true for beta urls)
+ update.szUpdateURL = "http://scottellis.com.au:81/test/updater.zip";
+ update.szVersionURL = "http://scottellis.com.au:81/test/updater_test.html";
+ update.pbVersionPrefix = (BYTE *)"Updater version ";
+
+ update.cpbVersionPrefix = strlen((char *)update.pbVersionPrefix);
+
+ // do the same for the beta versions of the above struct members if you wish to allow beta updates from another URL
+
+ CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
+
+ // Alternatively, to register a plugin with e.g. file ID 2254 on the file listing...
+ // CallService(MS_UPDATE_REGISTERFL, (WPARAM)2254, (LPARAM)&pluginInfo);
+
+ return 0;
+}
+
+#endif
diff --git a/Protocols/SIP/sdk/m_variables.h b/Protocols/SIP/sdk/m_variables.h
new file mode 100644
index 0000000..3f13c96
--- /dev/null
+++ b/Protocols/SIP/sdk/m_variables.h
@@ -0,0 +1,718 @@
+/*
+ Variables Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef __M_VARS
+#define __M_VARS
+
+#if !defined(_TCHAR_DEFINED)
+#include <tchar.h>
+#endif
+
+#ifndef VARIABLES_NOHELPER
+#include <m_button.h>
+#endif
+
+// --------------------------------------------------------------------------
+// Memory management
+// --------------------------------------------------------------------------
+
+// Release memory that was allocated by the Variables plugin, e.g. returned
+// strings.
+
+#define MS_VARS_FREEMEMORY "Vars/FreeMemory"
+
+// Parameters:
+// ------------------------
+// wParam = (WPARAM)(void *)pntr
+// Pointer to memory that was allocated by the Variables plugin (e.g. a
+// returned string) (can be NULL).
+// lParam = 0
+
+// Return Value:
+// ------------------------
+// Does return 0 on success, nozero otherwise.
+
+// Note: Do only use this service to free memory that was *explicitliy*
+// stated that it should be free with this service.
+
+
+
+#define MS_VARS_GET_MMI "Vars/GetMMI"
+
+// Get Variable's RTL/CRT function poiners to malloc(), free() and
+// realloc().
+
+// Parameters:
+// ------------------------
+// wParam = 0
+// lParam = (LPARAM) &MM_INTERFACE
+// Pointer to a memory manager interface struct (see m_system.h).
+
+// Return Value:
+// ------------------------
+// Returns 0 on success, nozero otherwise
+
+// Note: Works exactly the same as the MS_SYSTEM_GET_MMI service
+// service of m_system.h.
+
+// Helper function for easy using:
+#ifndef VARIABLES_NOHELPER
+__inline static void variables_free(void *pntr) {
+
+ CallService(MS_VARS_FREEMEMORY, (WPARAM)pntr, 0);
+}
+#endif
+
+
+
+// --------------------------------------------------------------------------
+// String formatting
+// --------------------------------------------------------------------------
+
+#define MS_VARS_FORMATSTRING "Vars/FormatString"
+
+// This service can be used to parse tokens in a text. The tokens will be
+// replaced by their resolved values. A token can either be a field or a
+// function. A field takes no arguments and is represented between
+// %-characters, e.g. "%winampsong%". A function can take any number of
+// arguments and is represented by a ? or !-character followed by the name
+// of the function and a list of arguments, e.g. "?add(1,2)".
+
+// Parameters:
+// ------------------------
+// wParam = (WPARAM)(FORMATINFO *)&fi
+// See below.
+// lParam = 0
+
+// Return Value:
+// ------------------------
+// Returns a pointer to the resolved string or NULL in case of an error.
+
+// Note: The returned pointer needs to be freed using MS_VARS_FREEMEMORY.
+
+typedef struct {
+ int cbSize; // Set this to sizeof(FORMATINFO).
+ int flags; // Flags to use (see FIF_* below).
+ union {
+ char *szFormat; // Text in which the tokens will be replaced (can't be
+ // NULL).
+ WCHAR *wszFormat;
+ TCHAR *tszFormat;
+ };
+ union {
+ char *szExtraText; // Extra, context-specific string (can be NULL) ->
+ // The field "extratext" will be replaced by this
+ // string. (Previously szSource).
+ WCHAR *wszExtraText;
+ TCHAR *tszExtraText;
+ };
+ HANDLE hContact; // Handle to contact (can be NULL) -> The field "subject"
+ // represents this contact.
+ int pCount; // (output) Number of succesful parsed tokens, needs to be set
+ // to 0 before the call
+ int eCount; // (output) Number of failed tokens, needs to be set to 0
+ // before the call
+ union {
+ char **szaTemporaryVars; // Temporary variables valid only in the duration of the format call
+ TCHAR **tszaTemporaryVars; // By pos: [i] is var name, [i + 1] is var value
+ WCHAR **wszaTemporaryVars;
+ };
+ int cbTemporaryVarsSize; // Number of elements in szaTemporaryVars array
+
+} FORMATINFO;
+
+#define FORMATINFOV2_SIZE 28
+
+// Possible flags:
+#define FIF_UNICODE 0x01 // Expects and returns unicode text (WCHAR*).
+
+#if defined(UNICODE) || defined(_UNICODE)
+#define FIF_TCHAR FIF_UNICODE // Strings in structure are TCHAR*.
+#else
+#define FIF_TCHAR 0
+#endif
+
+// Helper functions for easy using:
+
+// Helper #1: variables_parse
+// ------------------------
+// The returned string needs to be freed using MS_VARS_FREEMEMORY.
+
+#ifndef VARIABLES_NOHELPER
+__inline static TCHAR *variables_parse(TCHAR *tszFormat, TCHAR *tszExtraText, HANDLE hContact) {
+
+ FORMATINFO fi;
+
+ ZeroMemory(&fi, sizeof(fi));
+ fi.cbSize = sizeof(fi);
+ fi.tszFormat = tszFormat;
+ fi.tszExtraText = tszExtraText;
+ fi.hContact = hContact;
+ fi.flags = FIF_TCHAR;
+
+ return (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
+}
+#endif
+
+__inline static TCHAR *variables_parse_ex(TCHAR *tszFormat, TCHAR *tszExtraText, HANDLE hContact,
+ TCHAR **tszaTemporaryVars, int cbTemporaryVarsSize) {
+
+ FORMATINFO fi;
+
+ ZeroMemory(&fi, sizeof(fi));
+ fi.cbSize = sizeof(fi);
+ fi.tszFormat = tszFormat;
+ fi.tszExtraText = tszExtraText;
+ fi.hContact = hContact;
+ fi.flags = FIF_TCHAR;
+ fi.tszaTemporaryVars = tszaTemporaryVars;
+ fi.cbTemporaryVarsSize = cbTemporaryVarsSize;
+
+ return (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
+}
+// Helper #2: variables_parsedup
+// ------------------------
+// Returns a _strdup()'ed copy of the unparsed string when Variables is not
+// installed, returns a strdup()'ed copy of the parsed result otherwise.
+
+// Note: The returned pointer needs to be released using your own free().
+
+#ifndef VARIABLES_NOHELPER
+__inline static TCHAR *variables_parsedup(TCHAR *tszFormat, TCHAR *tszExtraText, HANDLE hContact) {
+
+ if (ServiceExists(MS_VARS_FORMATSTRING)) {
+ FORMATINFO fi;
+ TCHAR *tszParsed, *tszResult;
+
+ ZeroMemory(&fi, sizeof(fi));
+ fi.cbSize = sizeof(fi);
+ fi.tszFormat = tszFormat;
+ fi.tszExtraText = tszExtraText;
+ fi.hContact = hContact;
+ fi.flags |= FIF_TCHAR;
+ tszParsed = (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
+ if (tszParsed) {
+ tszResult = _tcsdup(tszParsed);
+ CallService(MS_VARS_FREEMEMORY, (WPARAM)tszParsed, 0);
+ return tszResult;
+ }
+ }
+ return tszFormat?_tcsdup(tszFormat):tszFormat;
+}
+
+__inline static TCHAR *variables_parsedup_ex(TCHAR *tszFormat, TCHAR *tszExtraText, HANDLE hContact,
+ TCHAR **tszaTemporaryVars, int cbTemporaryVarsSize) {
+
+ if (ServiceExists(MS_VARS_FORMATSTRING)) {
+ FORMATINFO fi;
+ TCHAR *tszParsed, *tszResult;
+
+ ZeroMemory(&fi, sizeof(fi));
+ fi.cbSize = sizeof(fi);
+ fi.tszFormat = tszFormat;
+ fi.tszExtraText = tszExtraText;
+ fi.hContact = hContact;
+ fi.flags |= FIF_TCHAR;
+ fi.tszaTemporaryVars = tszaTemporaryVars;
+ fi.cbTemporaryVarsSize = cbTemporaryVarsSize;
+ tszParsed = (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
+ if (tszParsed) {
+ tszResult = _tcsdup(tszParsed);
+ CallService(MS_VARS_FREEMEMORY, (WPARAM)tszParsed, 0);
+ return tszResult;
+ }
+ }
+ return tszFormat?_tcsdup(tszFormat):tszFormat;
+}
+#endif
+
+
+
+// --------------------------------------------------------------------------
+// Register tokens
+// --------------------------------------------------------------------------
+
+// Plugins can define tokens which will be parsed by the Variables plugin.
+
+#define MS_VARS_REGISTERTOKEN "Vars/RegisterToken"
+
+// With this service you can define your own token. The newly added tokens
+// using this service are taken into account on every call to
+// MS_VARS_FORMATSTRING.
+
+// Parameters:
+// ------------------------
+// wParam = 0
+// lParam = (LPARAM)(TOKENREGISTER*)&tr
+// See below.
+
+// Return Value:
+// ------------------------
+// Returns 0 on success, nonzero otherwise. Existing tokens will be
+// 'overwritten' if registered twice.
+
+// Needed for szService and parseFunction:
+typedef struct {
+ int cbSize; // You need to check if this is >=sizeof(ARGUMENTSINFO)
+ // (already filled in).
+ FORMATINFO *fi; // Arguments passed to MS_VARS_FORMATSTRING.
+ unsigned int argc; // Number of elements in the argv array.
+ union {
+ char **argv; // Argv[0] will be the token name, the following elements
+ // are the additional arguments.
+ WCHAR **wargv; // If the registered token was registered as a unicode
+ // token, wargv should be accessed.
+ TCHAR **targv;
+ };
+ int flags; // (output) You can set flags here (initially 0), use the
+ // AIF_* flags (see below).
+} ARGUMENTSINFO;
+
+// Available flags for ARGUMENTSINFO:
+// Set the flags of the ARGUMENTSINFO struct to any of these to influence
+// further parsing.
+#define AIF_DONTPARSE 0x01 // Don't parse the result of this function,
+ // usually the result of a token is parsed
+ // again, if the `?` is used as a function
+ // character.
+#define AIF_FALSE 0x02 // The function returned logical false.
+
+// Definition of parse/cleanup functions:
+typedef char* (*VARPARSEFUNCA)(ARGUMENTSINFO *ai);
+typedef WCHAR* (*VARPARSEFUNCW)(ARGUMENTSINFO *ai);
+typedef void (*VARCLEANUPFUNCA)(char *szReturn);
+typedef void (*VARCLEANUPFUNCW)(WCHAR *wszReturn);
+
+#if defined(UNICODE) || defined(_UNICODE)
+#define VARPARSEFUNC VARPARSEFUNCW
+#define VARCLEANUPFUNC VARCLEANUPFUNCW
+#else
+#define VARPARSEFUNC VARPARSEFUNCA
+#define VARCLEANUPFUNC VARCLEANUPFUNCA
+#endif
+
+typedef struct {
+ int cbSize; // Set this to sizeof(TOKENREGISTER).
+ union {
+ char *szTokenString; // Name of the new token to be created, without %,
+ // ?, ! etc. signs (can't be NULL).
+ WCHAR *wszTokenString;
+ TCHAR *tszTokenString;
+ };
+ union {
+ char *szService; // Name of a service that is used to request the
+ // token's value, if no service is used, a function
+ // and TRF_PARSEFUNC must be used.
+ VARPARSEFUNCA parseFunction; // See above, use with TRF_PARSEFUNC.
+ VARPARSEFUNCW parseFunctionW;
+ VARPARSEFUNC parseFunctionT;
+ };
+ union {
+ char *szCleanupService; // Name of a service to be called when the
+ // memory allocated in szService can be freed
+ // (only used when flag VRF_CLEANUP is set,
+ // else set this to NULL).
+ VARCLEANUPFUNCA cleanupFunction; // See above, use with TRF_CLEANUPFUNC.
+ VARCLEANUPFUNCW cleanupFunctionW;
+ VARCLEANUPFUNC cleanupFunctionT;
+ };
+ char *szHelpText; // Help info shown in help dialog (can be NULL). Has to
+ // be in the following format:
+ // "subject\targuments\tdescription"
+ // (Example: "math\t(x, y ,...)\tx + y + ..."), or:
+ // "subject\tdescription"
+ // (Example: "miranda\tPath to the Miranda-IM
+ // executable").
+ // Note: subject and description are translated by
+ // Variables.
+ int memType; // Describes which method Varibale's plugin needs to use to
+ // free the returned buffer, use one of the VR_MEM_* values
+ // (see below). Only valid if the flag VRF_FREEMEM is set,
+ // use TR_MEM_OWNER otherwise).
+ int flags; // Flags to use (see below), one of TRF_* (see below).
+} TOKENREGISTER;
+
+// Available Memory Storage Types:
+// These values describe which method Variables Plugin will use to free the
+// buffer returned by the parse function or service
+#define TR_MEM_VARIABLES 1 // Memory is allocated using the functions
+ // retrieved by MS_VARS_GET_MMI.
+#define TR_MEM_MIRANDA 2 // Memory is allocated using Miranda's Memory
+ // Manager Interface (using the functions
+ // returned by MS_SYSTEM_GET_MMI), if
+ // VRF_FREEMEM is set, the memory will be
+ // freed by Variables.
+#define TR_MEM_OWNER 3 // Memory is owned by the calling plugin
+ // (can't be freed by Variables Plugin
+ // automatically). This should be used if
+ // VRF_FREEMEM is not specified in the flags.
+
+// Available Flags for TOKENREGISTER:
+#define TRF_FREEMEM 0x01 // Variables Plugin will automatically free the
+ // pointer returned by the parse function or
+ // service (which method it will us is
+ // specified in memType -> see above).
+#define TRF_CLEANUP 0x02 // Call cleanup service or function, notifying
+ // that the returned buffer can be freed.
+ // Normally you should use either TRF_FREEMEM
+ // or TRF_CLEANUP.
+#define TRF_PARSEFUNC 0x40 // parseFunction will be used instead of a
+ // service.
+#define TRF_CLEANUPFUNC 0x80 // cleanupFunction will be used instead of a
+ // service.
+#define TRF_USEFUNCS TRF_PARSEFUNC|TRF_CLEANUPFUNC
+#define TRF_UNPARSEDARGS 0x04 // Provide the arguments for the parse
+ // function in their raw (unparsed) form.
+ // By default, arguments are parsed before
+ // presenting them to the parse function.
+#define TRF_FIELD 0x08 // The token can be used as a %field%.
+#define TRF_FUNCTION 0x10 // The token can be used as a ?function().
+ // Normally you should use either TRF_FIELD or
+ // TRF_FUNCTION.
+#define TRF_UNICODE 0x20 // Strings in structure are unicode (WCHAR*).
+ // In this case, the strings pointing to the
+ // arguments in the ARGUMENTS struct are
+ // unicode also. The returned buffer is
+ // expected to be unicode also, and the
+ // unicode parse and cleanup functions are
+ // called.
+
+#if defined(UNICODE) || defined(_UNICODE)
+#define TRF_TCHAR TRF_UNICODE // Strings in structure are TCHAR*.
+#else
+#define TRF_TCHAR 0
+#endif
+
+// Deprecated:
+#define TRF_CALLSVC TRF_CLEANUP
+
+// Callback Service (szService) / parseFunction:
+// ------------------------
+// Service that is called automatically by the Variable's Plugin to resolve a
+// registered variable.
+
+// Parameters:
+// wParam = 0
+// lParam = (LPARAM)(ARGUMENTSINFO *)&ai
+// see above
+
+// Return Value:
+// Needs to return the pointer to a dynamically allocacated string or NULL.
+// A return value of NULL is regarded as an error (eCount will be increaded).
+// Flags in the ARGUMENTSINFO struct can be set (see above).
+
+// Callback Service (szCallbackService) / cleanupFunction:
+// ------------------------
+// This service is called when the memory that was allocated by the parse
+// function or service can be freed. Note: It will only be called when the
+// flag VRF_CLEANUP of TOKENREGISTER is set.
+
+// Parameters:
+// wParam = 0
+// lParam = (LPARAM)(char *)&res
+// Result from parse function or service (pointer to a string).
+
+// Return Value:
+// Should return 0 on success.
+
+
+
+// --------------------------------------------------------------------------
+// Show the help dialog
+// --------------------------------------------------------------------------
+
+// Plugins can invoke Variables' help dialog which can be used for easy input
+// by users.
+
+#define MS_VARS_SHOWHELPEX "Vars/ShowHelpEx"
+
+// This service can be used to open the help dialog of Variables. This dialog
+// provides easy input for the user and/or information about the available
+// tokens.
+
+// Parameters:
+// ------------------------
+// wParam = (WPARAM)(HWND)hwndParent
+// lParam = (LPARAM)(VARHELPINFO)&vhi
+// See below.
+
+// Return Value:
+// ------------------------
+// Returns 0 on succes, any other value on error.
+
+typedef struct {
+ int cbSize; // Set to sizeof(VARHELPINFO).
+ FORMATINFO *fi; // Used for both input and output. If this pointer is not
+ // NULL, the information is used as the initial values for
+ // the dialog.
+ HWND hwndCtrl; // Used for both input and output. The window text of this
+ // window will be read and used as the initial input of the
+ // input dialog. If the user presses the OK button the window
+ // text of this window will be set to the text of the input
+ // field and a EN_CHANGE message via WM_COMMAND is send to
+ // this window. (Can be NULL).
+ char *szSubjectDesc; // The description of the %subject% token will be set
+ // to this text, if not NULL. This is translated
+ // automatically.
+ char *szExtraTextDesc; // The description of the %extratext% token will be
+ // set to this text, if not NULL. This is translated
+ // automatically.
+ int flags; // Flags, see below.
+} VARHELPINFO;
+
+
+// Flags for VARHELPINFO
+#define VHF_TOKENS 0x00000001 // Create a dialog with the list of
+ // tokens
+#define VHF_INPUT 0x00000002 // Create a dialog with an input
+ // field (this contains the list of
+ // tokens as well).
+#define VHF_SUBJECT 0x00000004 // Create a dialog to select a
+ // contact for the %subject% token.
+#define VHF_EXTRATEXT 0x00000008 // Create a dialog to enter a text
+ // for the %extratext% token.
+#define VHF_HELP 0x00000010 // Create a dialog with help info.
+#define VHF_HIDESUBJECTTOKEN 0x00000020 // Hide the %subject% token in the
+ // list of tokens.
+#define VHF_HIDEEXTRATEXTTOKEN 0x00000040 // Hide the %extratext% token in
+ // the list of tokens.
+#define VHF_DONTFILLSTRUCT 0x00000080 // Don't fill the struct with the
+ // new information if OK is pressed
+#define VHF_FULLFILLSTRUCT 0x00000100 // Fill all members of the struct
+ // when OK is pressed. By default
+ // only szFormat is set. With this
+ // flag on, hContact and
+ // szExtraText are also set.
+#define VHF_SETLASTSUBJECT 0x00000200 // Set the last contact that was
+ // used in the %subject% dialog in
+ // case fi.hContact is NULL.
+
+// Predefined flags
+#define VHF_FULLDLG VHF_INPUT|VHF_SUBJECT|VHF_EXTRATEXT|VHF_HELP
+#define VHF_SIMPLEDLG VHF_INPUT|VHF_HELP
+#define VHF_NOINPUTDLG VHF_TOKENS|VHF_HELP
+
+// If the service fills information in the struct for szFormat or szExtraText,
+// these members must be free'd using the free function of Variables.
+// If wParam==NULL, the dialog is created modeless. Only one dialog can be
+// shown at the time.
+// If both hwndCtrl and fi are NULL, the user input will not be retrievable.
+// In this case, the dialog is created with only a "Close" button, instead of
+// the "OK" and "Cancel" buttons.
+// In case of modeless dialog and fi != NULL, please make sure this pointer
+// stays valid while the dialog is open.
+
+// Helper function for easy use in standard case:
+#ifndef VARIABLES_NOHELPER
+__inline static int variables_showhelp(HWND hwndDlg, UINT uIDEdit, int flags, char *szSubjectDesc, char *szExtraDesc) {
+
+ VARHELPINFO vhi;
+
+ ZeroMemory(&vhi, sizeof(VARHELPINFO));
+ vhi.cbSize = sizeof(VARHELPINFO);
+ if (flags == 0) {
+ flags = VHF_SIMPLEDLG;
+ }
+ vhi.flags = flags;
+ vhi.hwndCtrl = GetDlgItem(hwndDlg, uIDEdit);
+ vhi.szSubjectDesc = szSubjectDesc;
+ vhi.szExtraTextDesc = szExtraDesc;
+
+ return CallService(MS_VARS_SHOWHELPEX, (WPARAM)hwndDlg, (LPARAM)&vhi);
+}
+#endif
+
+
+#define MS_VARS_GETSKINITEM "Vars/GetSkinItem"
+
+// This service can be used to get the icon you can use for example on the
+// Variables help button in your options screen. You can also get the tooltip
+// text to use with such a button. If icon library is available the icon will
+// be retrieved from icon library manager, otherwise the default is returned.
+
+// Parameters:
+// ------------------------
+// wParam = (WPARAM)0
+// lParam = (LPARAM)VSI_* (see below)
+
+// Return Value:
+// ------------------------
+// Depends on the information to retrieve (see below).
+
+// VSI_ constants
+#define VSI_HELPICON 1 // Can be used on the button accessing the
+ // Variables help dialog. Returns (HICON)hIcon on
+ // success or NULL on failure;
+#define VSI_HELPTIPTEXT 2 // Returns the tooltip text you can use for the
+ // help button. Returns (char *)szTipText, a
+ // static, translated buffer containing the help
+ // text or NULL on error.
+
+// Helper to set the icon on a button accessing the help dialog.
+// Preferably a 16x14 MButtonClass control, but it works on a standard
+// button control as well. If no icon is availble (because of old version of
+// Variables) the string "V" is shown on the button. If Variables is not
+// available, the button will be hidden.
+#ifndef VARIABLES_NOHELPER
+__inline static int variables_skin_helpbutton(HWND hwndDlg, UINT uIDButton) {
+
+ int res;
+ HICON hIcon;
+ TCHAR tszClass[32];
+
+ hIcon = NULL;
+ res = 0;
+ if (ServiceExists(MS_VARS_GETSKINITEM)) {
+ hIcon = (HICON)CallService(MS_VARS_GETSKINITEM, 0, (LPARAM)VSI_HELPICON);
+ }
+ GetClassName(GetDlgItem(hwndDlg, uIDButton), tszClass, sizeof(tszClass));
+ if (!_tcscmp(tszClass, _T("Button"))) {
+ if (hIcon != NULL) {
+ SetWindowLong(GetDlgItem(hwndDlg, uIDButton), GWL_STYLE, GetWindowLong(GetDlgItem(hwndDlg, uIDButton), GWL_STYLE)|BS_ICON);
+ SendMessage(GetDlgItem(hwndDlg, uIDButton), BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)hIcon);
+ }
+ else {
+ SetWindowLong(GetDlgItem(hwndDlg, uIDButton), GWL_STYLE, GetWindowLong(GetDlgItem(hwndDlg, uIDButton), GWL_STYLE)&~BS_ICON);
+ SetDlgItemText(hwndDlg, uIDButton, _T("V"));
+ }
+ }
+ else if (!_tcscmp(tszClass, MIRANDABUTTONCLASS)) {
+ if (hIcon != NULL) {
+ char *szTipInfo;
+
+ SendMessage(GetDlgItem(hwndDlg, uIDButton), BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)hIcon);
+ if (ServiceExists(MS_VARS_GETSKINITEM)) {
+ szTipInfo = (char *)CallService(MS_VARS_GETSKINITEM, 0, (LPARAM)VSI_HELPTIPTEXT);
+ }
+ if (szTipInfo == NULL) {
+ szTipInfo = Translate("Open String Formatting Help");
+ }
+ SendMessage(GetDlgItem(hwndDlg, uIDButton), BUTTONADDTOOLTIP, (WPARAM)szTipInfo, 0);
+ SendDlgItemMessage(hwndDlg, uIDButton, BUTTONSETASFLATBTN, 0, 0);
+ }
+ else {
+ SetDlgItemText(hwndDlg, uIDButton, _T("V"));
+ }
+ }
+ else {
+ res = -1;
+ }
+ ShowWindow(GetDlgItem(hwndDlg, uIDButton), ServiceExists(MS_VARS_FORMATSTRING));
+
+ return res;
+}
+#endif
+
+
+#define MS_VARS_SHOWHELP "Vars/ShowHelp"
+
+// WARNING: This service is obsolete, please use MS_VARS_SHOWHELPEX
+
+// Shows a help dialog where all possible tokens are displayed. The tokens
+// are explained on the dialog, too. The user can edit the initial string and
+// insert as many tokens as he likes.
+
+// Parameters:
+// ------------------------
+// wParam = (HWND)hwndEdit
+// Handle to an edit control in which the modified string
+// should be inserted (When the user clicks OK in the dialog the edited
+// string will be set to hwndEdit) (can be NULL).
+// lParam = (char *)pszInitialString
+// String that the user is provided with initially when
+// the dialog gets opened (If this is NULL then the current text in the
+// hwndEdit edit control will be used) (can be NULL).
+
+// Return Value:
+// ------------------------
+// Returns the handle to the help dialog (HWND).
+
+// Note: Only one help dialog can be opened at a time. When the dialog gets
+// closed an EN_CHANGE of the edit controll will be triggered because the
+// contents were updated. (Only when user selected OK).
+
+// Example:
+// CallService(MS_VARS_SHOWHELP, (WPARAM)hwndEdit, (LPARAM)"some initial text");
+
+// --------------------------------------------------------------------------
+// Retrieve a contact's HANDLE given a string
+// --------------------------------------------------------------------------
+
+#define MS_VARS_GETCONTACTFROMSTRING "Vars/GetContactFromString"
+
+// Searching for contacts in the database. You can find contacts in db by
+// searching for their name, e.g first name.
+
+// Parameters:
+// ------------------------
+// wParam = (WPARAM)(CONTACTSINFO *)&ci
+// See below.
+// lParam = 0
+
+// Return Value:
+// ------------------------
+// Returns number of contacts found matching the given string representation.
+// The hContacts array of CONTACTSINFO struct contains these hContacts after
+// the call.
+
+// Note: The hContacts array needs to be freed after use using
+// MS_VARS_FREEMEMORY.
+
+typedef struct {
+ int cbSize; // Set this to sizeof(CONTACTSINFO).
+ union {
+ char *szContact; // String to search for, e.g. last name (can't be NULL).
+ WCHAR *wszContact;
+ TCHAR *tszContact;
+ };
+ HANDLE *hContacts; // (output) Array of contacts found.
+ DWORD flags; // Contact details that will be matched with the search
+ // string (flags can be combined).
+} CONTACTSINFO;
+
+// Possible flags:
+#define CI_PROTOID 0x00000001 // The contact in the string is encoded
+ // in the format <PROTOID:UNIQUEID>, e.g.
+ // <ICQ:12345678>.
+#define CI_NICK 0x00000002 // Search nick names.
+#define CI_LISTNAME 0x00000004 // Search custom names shown in contact
+ // list.
+#define CI_FIRSTNAME 0x00000008 // Search contact's first names (contact
+ // details).
+#define CI_LASTNAME 0x00000010 // Search contact's last names (contact
+ // details).
+#define CI_EMAIL 0x00000020 // Search contact's email adresses
+ // (contact details).
+#define CI_UNIQUEID 0x00000040 // Search unique ids of the contac, e.g.
+ // UIN.
+#define CI_CNFINFO 0x40000000 // Searches one of the CNF_* flags (set
+ // flags to CI_CNFINFO|CNF_X), only one
+ // CNF_ type possible
+#define CI_UNICODE 0x80000000 // tszContact is a unicode string
+ // (WCHAR*).
+
+#if defined(UNICODE) || defined(_UNICODE)
+#define CI_TCHAR CI_UNICODE // Strings in structure are TCHAR*.
+#else
+#define CI_TCHAR 0
+#endif
+
+
+
+#endif //__M_VARS
diff --git a/Protocols/SIP/sip.cpp b/Protocols/SIP/sip.cpp
new file mode 100644
index 0000000..96b9dea
--- /dev/null
+++ b/Protocols/SIP/sip.cpp
@@ -0,0 +1,300 @@
+/*
+Copyright (C) 2009 Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+#include "commons.h"
+
+
+// Prototypes ///////////////////////////////////////////////////////////////////////////
+
+
+PLUGININFOEX pluginInfo={
+ sizeof(PLUGININFOEX),
+#ifdef UNICODE
+ "SIP protocol (Unicode)",
+#else
+ "SIP protocol (Ansi)",
+#endif
+ PLUGIN_MAKE_VERSION(0,1,0,0),
+ "Provides support for SIP protocol",
+ "Ricardo Pescuma Domenecci",
+ "pescuma@miranda-im.org",
+ "© 2009 Ricardo Pescuma Domenecci",
+ "http://pescuma.org/miranda/sip",
+ UNICODE_AWARE,
+ 0, //doesn't replace anything built-in
+#ifdef UNICODE
+ { 0x9976da3b, 0x8c73, 0x41e3, { 0x9a, 0x22, 0x33, 0xf0, 0xb4, 0xed, 0x74, 0x41 } } // {9976DA3B-8C73-41e3-9A22-33F0B4ED7441}
+#else
+ { 0xea7edb84, 0xb87c, 0x4b2d, { 0xbb, 0xce, 0x6f, 0x29, 0xfd, 0x4b, 0xb8, 0x86 } } // {EA7EDB84-B87C-4b2d-BBCE-6F29FD4BB886}
+#endif
+};
+
+
+HINSTANCE hInst;
+PLUGINLINK *pluginLink;
+MM_INTERFACE mmi;
+UTF8_INTERFACE utfi;
+LIST_INTERFACE li;
+
+std::vector<HANDLE> hHooks;
+
+int ModulesLoaded(WPARAM wParam, LPARAM lParam);
+int PreShutdown(WPARAM wParam, LPARAM lParam);
+
+
+static int sttCompareProtocols(const SIPProto *p1, const SIPProto *p2)
+{
+ return strcmp(p1->m_szModuleName, p2->m_szModuleName);
+}
+OBJLIST<SIPProto> instances(1, &sttCompareProtocols);
+
+
+
+
+// Functions ////////////////////////////////////////////////////////////////////////////
+
+
+extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+ hInst = hinstDLL;
+ return TRUE;
+}
+
+
+extern "C" __declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion)
+{
+ pluginInfo.cbSize = sizeof(PLUGININFO);
+ return (PLUGININFO*) &pluginInfo;
+}
+
+
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+{
+ pluginInfo.cbSize = sizeof(PLUGININFOEX);
+ return &pluginInfo;
+}
+
+
+static const MUUID interfaces[] = { MIID_PROTOCOL, MIID_LAST };
+extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
+{
+ return interfaces;
+}
+
+
+static SIPProto *SIPProtoInit(const char* pszProtoName, const TCHAR* tszUserName)
+{
+/* if (instances.getCount() != 0)
+ {
+ MessageBox(NULL, TranslateT("Only one instance is allowed.\nI will crash now."), _T("SIP"), MB_OK | MB_ICONERROR);
+ return NULL;
+ }
+*/
+ SIPProto *proto = new SIPProto(pszProtoName, tszUserName);
+ instances.insert(proto);
+ return proto;
+}
+
+
+static int SIPProtoUninit(SIPProto *proto)
+{
+ instances.remove(proto);
+ return 0;
+}
+
+
+static void ShowError(TCHAR *msg, pj_status_t status)
+{
+ char errmsg[PJ_ERR_MSG_SIZE];
+ pj_strerror(status, errmsg, sizeof(errmsg));
+
+ TCHAR err[1024];
+ mir_sntprintf(err, MAX_REGS(err), _T("%s: %s"), msg, Utf8ToTchar(errmsg));
+
+ MessageBox(NULL, err, TranslateT("SIP"), MB_OK | MB_ICONERROR);
+}
+
+
+static void static_on_reg_state(pjsua_acc_id acc_id)
+{
+ SIPProto *proto = (SIPProto *) pjsua_acc_get_user_data(acc_id);
+ if (proto == NULL)
+ return;
+
+ proto->on_reg_state();
+}
+
+static void static_on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id, pjsip_rx_data *rdata)
+{
+ SIPProto *proto = (SIPProto *) pjsua_acc_get_user_data(acc_id);
+ if (proto == NULL)
+ return;
+
+ proto->on_incoming_call(call_id, rdata);
+}
+
+static void static_on_call_state(pjsua_call_id call_id, pjsip_event *e)
+{
+ pjsua_call_info info;
+ pj_status_t status = pjsua_call_get_info(call_id, &info);
+ if (status != PJ_SUCCESS)
+ return;
+
+ SIPProto *proto = (SIPProto *) pjsua_acc_get_user_data(info.acc_id);
+ if (proto == NULL)
+ return;
+
+ proto->on_call_state(call_id, e);
+}
+
+static void static_on_call_media_state(pjsua_call_id call_id)
+{
+ pjsua_call_info info;
+ pj_status_t status = pjsua_call_get_info(call_id, &info);
+ if (status != PJ_SUCCESS)
+ return;
+
+ SIPProto *proto = (SIPProto *) pjsua_acc_get_user_data(info.acc_id);
+ if (proto == NULL)
+ return;
+
+ proto->on_call_media_state(call_id);
+}
+
+static void static_on_log(int level, const char *data, int len)
+{
+ char tmp[1024];
+ mir_snprintf(tmp, MAX_REGS(tmp), "Level %d : %*s", level, len, data);
+ OutputDebugStringA(tmp);
+}
+
+
+extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
+{
+ pluginLink = link;
+
+ CHECK_VERSION("SIP")
+
+ // TODO Assert results here
+ mir_getMMI(&mmi);
+ mir_getUTFI(&utfi);
+ mir_getLI(&li);
+
+ pj_status_t status = pjsua_create();
+ if (status != PJ_SUCCESS)
+ {
+ ShowError(TranslateT("Error creating pjsua"), status);
+ return -1;
+ }
+
+ pjsua_config cfg;
+ pjsua_config_default(&cfg);
+ cfg.cb.on_incoming_call = &static_on_incoming_call;
+ cfg.cb.on_call_media_state = &static_on_call_media_state;
+ cfg.cb.on_call_state = &static_on_call_state;
+ cfg.cb.on_reg_state = &static_on_reg_state;
+
+ pjsua_logging_config log_cfg;
+ pjsua_logging_config_default(&log_cfg);
+ log_cfg.console_level = 4;
+ log_cfg.cb = &static_on_log;
+
+ status = pjsua_init(&cfg, &log_cfg, NULL);
+ if (status != PJ_SUCCESS)
+ {
+ ShowError(TranslateT("Error initializing pjsua"), status);
+ pjsua_destroy();
+ return -2;
+ }
+
+ status = pjsua_start();
+ if (status != PJ_SUCCESS)
+ {
+ ShowError(TranslateT("Error starting pjsua"), status);
+ pjsua_destroy();
+ return -3;
+ }
+
+ hHooks.push_back( HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded) );
+ hHooks.push_back( HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown) );
+
+ PROTOCOLDESCRIPTOR pd = {0};
+ pd.cbSize = sizeof(pd);
+ pd.szName = MODULE_NAME;
+ pd.fnInit = (pfnInitProto) SIPProtoInit;
+ pd.fnUninit = (pfnUninitProto) SIPProtoUninit;
+ pd.type = PROTOTYPE_PROTOCOL;
+ CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM) &pd);
+
+ return 0;
+}
+
+
+extern "C" int __declspec(dllexport) Unload(void)
+{
+ pjsua_destroy();
+
+ return 0;
+}
+
+
+// Called when all the modules are loaded
+int ModulesLoaded(WPARAM wParam, LPARAM lParam)
+{
+ // Add our modules to the KnownModules list
+ CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME, 0);
+
+ // Updater plugin support
+ if(ServiceExists(MS_UPDATE_REGISTER))
+ {
+ Update upd = {0};
+ char szCurrentVersion[30];
+
+ upd.cbSize = sizeof(upd);
+ upd.szComponentName = pluginInfo.shortName;
+
+ upd.szUpdateURL = UPDATER_AUTOREGISTER;
+
+ upd.szBetaVersionURL = "http://pescuma.org/miranda/sip_version.txt";
+ upd.szBetaChangelogURL = "http://pescuma.org/miranda/sip#Changelog";
+ upd.pbBetaVersionPrefix = (BYTE *)"SIP protocol ";
+ upd.cpbBetaVersionPrefix = strlen((char *)upd.pbBetaVersionPrefix);
+#ifdef UNICODE
+ upd.szBetaUpdateURL = "http://pescuma.org/miranda/sipW.zip";
+#else
+ upd.szBetaUpdateURL = "http://pescuma.org/miranda/sip.zip";
+#endif
+
+ upd.pbVersion = (BYTE *)CreateVersionStringPlugin((PLUGININFO*) &pluginInfo, szCurrentVersion);
+ upd.cpbVersion = strlen((char *)upd.pbVersion);
+
+ CallService(MS_UPDATE_REGISTER, 0, (LPARAM)&upd);
+ }
+
+ return 0;
+}
+
+
+int PreShutdown(WPARAM wParam, LPARAM lParam)
+{
+ for(unsigned int i = 0; i < hHooks.size(); ++i)
+ UnhookEvent(hHooks[i]);
+
+ return 0;
+}
diff --git a/Protocols/SIP/sip.dsp b/Protocols/SIP/sip.dsp
new file mode 100644
index 0000000..b4cce31
--- /dev/null
+++ b/Protocols/SIP/sip.dsp
@@ -0,0 +1,243 @@
+# Microsoft Developer Studio Project File - Name="sip" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=sip - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "sip.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "sip.mak" CFG="sip - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "sip - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "sip - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "sip - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "sip - Win32 Unicode Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "sip - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O1 /YX /FD /c
+# SUBTRACT BASE CPP /Fr
+# ADD CPP /nologo /G4 /MT /W3 /GX /O2 /Ob0 /I "../../include" /I "sdk" /I "lib/sipclient" /D "WIN32" /D "W32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Fr /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x417 /d "NDEBUG"
+# ADD RSC /l 0x417 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 user32.lib shell32.lib wininet.lib gdi32.lib /nologo /base:"0x67100000" /dll /machine:I386 /filealign:0x200
+# SUBTRACT BASE LINK32 /pdb:none /map
+# ADD LINK32 libgsm.lib libsip2.lib libsipclient.lib libogg.lib libportaudio.lib libportmixer.lib libspeex.lib ws2_32.lib kernel32.lib user32.lib /nologo /base:"0x3EC20000" /dll /map /debug /debugtype:both /machine:I386 /out:"..\..\bin\release\Plugins\sip.dll" /pdbtype:sept /libpath:"lib/sipclient/Release" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT LINK32 /profile /pdb:none
+
+!ELSEIF "$(CFG)" == "sip - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /G4 /MT /W3 /GX /O2 /Ob0 /I "../../include" /FR /YX /FD /c
+# ADD CPP /nologo /G4 /MDd /W3 /GX /ZI /Od /I "../../include" /I "sdk" /I "lib/sipclient" /D "WIN32" /D "W32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x417 /d "NDEBUG"
+# ADD RSC /l 0x417 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..bin\release\Plugins\sip.dll" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT BASE LINK32 /profile /pdb:none
+# ADD LINK32 libgsm.lib libsip2.lib libsipclient.lib libogg.lib libportaudio.lib libportmixer.lib libspeex.lib ws2_32.lib kernel32.lib user32.lib /nologo /base:"0x3EC20000" /dll /incremental:yes /debug /machine:I386 /out:"..\..\bin\debug\Plugins\sip.dll" /libpath:"lib/sipclient/Debug" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT LINK32 /profile /pdb:none
+
+!ELSEIF "$(CFG)" == "sip - Win32 Unicode Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "sip___Win32_Unicode_Debug"
+# PROP BASE Intermediate_Dir "sip___Win32_Unicode_Debug"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Unicode_Debug"
+# PROP Intermediate_Dir "Unicode_Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /G4 /MTd /W3 /GX /ZI /Od /I "../../include" /FR /YX /FD /c
+# ADD CPP /nologo /G4 /MDd /W3 /GX /ZI /Od /I "lib/sipclient" /I "../../include" /I "sdk" /D "WIN32" /D "W32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "_USRDLL" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x417 /d "NDEBUG"
+# ADD RSC /l 0x417 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x32100000" /dll /incremental:yes /debug /machine:I386 /out:"..\..\bin\debug\Plugins\sip.dll" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT BASE LINK32 /profile /pdb:none
+# ADD LINK32 libgsm.lib libsip2.lib libsipclient.lib libogg.lib libportaudio.lib libportmixer.lib libspeex.lib ws2_32.lib kernel32.lib user32.lib /nologo /base:"0x3EC20000" /dll /incremental:yes /debug /machine:I386 /out:"..\..\bin\debug unicode\Plugins\sipW.dll" /libpath:"lib/sipclient/Debug" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT LINK32 /profile /pdb:none
+
+!ELSEIF "$(CFG)" == "sip - Win32 Unicode Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "sip___Win32_Unicode_Release"
+# PROP BASE Intermediate_Dir "sip___Win32_Unicode_Release"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Unicode_Release"
+# PROP Intermediate_Dir "Unicode_Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /G4 /MT /W3 /GX /O2 /Ob0 /I "../../include" /Fr /YX /FD /c
+# ADD CPP /nologo /G4 /MT /W3 /GX /O2 /Ob0 /I "../../include" /I "sdk" /I "lib/sipclient" /D "WIN32" /D "W32" /D "NDEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "_USRDLL" /Fr /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x417 /d "NDEBUG"
+# ADD RSC /l 0x417 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x32100000" /dll /map /machine:I386 /out:"..\..\bin\release\Plugins\sip.dll" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT BASE LINK32 /profile /pdb:none
+# ADD LINK32 libgsm.lib libsip2.lib libsipclient.lib libogg.lib libportaudio.lib libportmixer.lib libspeex.lib ws2_32.lib kernel32.lib user32.lib /nologo /base:"0x3EC20000" /dll /map /debug /debugtype:both /machine:I386 /out:"..\..\bin\release unicode\Plugins\sipW.dll" /pdbtype:sept /libpath:"lib/sipclient/Release" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT LINK32 /profile /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "sip - Win32 Release"
+# Name "sip - Win32 Debug"
+# Name "sip - Win32 Unicode Debug"
+# Name "sip - Win32 Unicode Release"
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\commons.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\plugins\utils\mir_icons.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\plugins\utils\mir_log.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\plugins\utils\mir_memory.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\plugins\utils\mir_options.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\SIPProto.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\resource.rc
+# End Source File
+# End Group
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\..\plugins\utils\mir_icons.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\plugins\utils\mir_log.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\plugins\utils\mir_options.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sip.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\SIPProto.cpp
+# End Source File
+# End Group
+# Begin Group "Docs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\Docs\langpack_sip.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\Docs\sip_changelog.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\Docs\sip_readme.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\Docs\sip_version.txt
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/Protocols/SIP/sip.dsw b/Protocols/SIP/sip.dsw
new file mode 100644
index 0000000..8edf757
--- /dev/null
+++ b/Protocols/SIP/sip.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "sip"=.\sip.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/Protocols/SIP/sip.sln b/Protocols/SIP/sip.sln
new file mode 100644
index 0000000..3923765
--- /dev/null
+++ b/Protocols/SIP/sip.sln
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sip", "sip.vcproj", "{7CFE6F6E-6913-4308-9F57-B8730F61E202}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ Unicode Debug|Win32 = Unicode Debug|Win32
+ Unicode Release|Win32 = Unicode Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {7CFE6F6E-6913-4308-9F57-B8730F61E202}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7CFE6F6E-6913-4308-9F57-B8730F61E202}.Debug|Win32.Build.0 = Debug|Win32
+ {7CFE6F6E-6913-4308-9F57-B8730F61E202}.Release|Win32.ActiveCfg = Release|Win32
+ {7CFE6F6E-6913-4308-9F57-B8730F61E202}.Release|Win32.Build.0 = Release|Win32
+ {7CFE6F6E-6913-4308-9F57-B8730F61E202}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32
+ {7CFE6F6E-6913-4308-9F57-B8730F61E202}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32
+ {7CFE6F6E-6913-4308-9F57-B8730F61E202}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32
+ {7CFE6F6E-6913-4308-9F57-B8730F61E202}.Unicode Release|Win32.Build.0 = Unicode Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Protocols/SIP/sip.vcproj b/Protocols/SIP/sip.vcproj
new file mode 100644
index 0000000..d27fd98
--- /dev/null
+++ b/Protocols/SIP/sip.vcproj
@@ -0,0 +1,721 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="sip"
+ ProjectGUID="{7CFE6F6E-6913-4308-9F57-B8730F61E202}"
+ TargetFrameworkVersion="0"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Unicode Release|Win32"
+ OutputDirectory=".\Unicode_Release"
+ IntermediateDirectory=".\Unicode_Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Unicode_Release/sip.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="0"
+ AdditionalIncludeDirectories="../../include;sdk;lib\pjsip\pjlib\include;&quot;lib\pjsip\pjlib-util\include&quot;;lib\pjsip\pjmedia\include;lib\pjsip\pjsip\include;lib\pjsip\pjnath\include"
+ PreprocessorDefinitions="PJ_WIN32=1;WIN32;W32;NDEBUG;_WINDOWS;UNICODE;_USRDLL;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Unicode_Release/sip.pch"
+ AssemblerListingLocation=".\Unicode_Release/"
+ ObjectFile=".\Unicode_Release/"
+ ProgramDataBaseFileName=".\Unicode_Release/"
+ BrowseInformation="2"
+ BrowseInformationFile=".\Unicode_Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1047"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/ALIGN:4096 /filealign:0x200 /ignore:4108 "
+ AdditionalDependencies="wsock32.lib ws2_32.lib ole32.lib dsound.lib libpjproject-i386-Win32-vc8-Release-Static.lib"
+ OutputFile="..\..\bin\release unicode\Plugins\sipW.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="lib\pjsip\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Unicode_Release/sipW.pdb"
+ GenerateMapFile="true"
+ MapFileName=".\Unicode_Release/sipW.map"
+ BaseAddress="0x3EC20000"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Unicode_Release/sipW.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Unicode_Release/sip.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/sip.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../include;sdk;lib\pjsip\pjlib\include;&quot;lib\pjsip\pjlib-util\include&quot;;lib\pjsip\pjmedia\include;lib\pjsip\pjsip\include;lib\pjsip\pjnath\include"
+ PreprocessorDefinitions="PJ_WIN32=1;WIN32;W32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS"
+ RuntimeLibrary="3"
+ PrecompiledHeaderFile=".\Debug/sip.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1047"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/ALIGN:4096 /filealign:0x200 /ignore:4108 "
+ AdditionalDependencies="wsock32.lib ws2_32.lib ole32.lib dsound.lib libpjproject-i386-Win32-vc8-Debug-Dynamic.lib"
+ OutputFile="..\..\bin\debug\Plugins\sip.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="lib\pjsip\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/sip.pdb"
+ BaseAddress="0x3EC20000"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Debug/sip.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/sip.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/sip.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="0"
+ AdditionalIncludeDirectories="../../include;sdk;lib\pjsip\pjlib\include;&quot;lib\pjsip\pjlib-util\include&quot;;lib\pjsip\pjmedia\include;lib\pjsip\pjsip\include;lib\pjsip\pjnath\include"
+ PreprocessorDefinitions="PJ_WIN32=1;WIN32;W32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release/sip.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ BrowseInformation="2"
+ BrowseInformationFile=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1047"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/ALIGN:4096 /filealign:0x200 /ignore:4108 "
+ AdditionalDependencies="wsock32.lib ws2_32.lib ole32.lib dsound.lib libpjproject-i386-Win32-vc8-Release-Static.lib"
+ OutputFile="..\..\bin\release\Plugins\sip.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="lib\pjsip\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Release/sip.pdb"
+ GenerateMapFile="true"
+ MapFileName=".\Release/sip.map"
+ BaseAddress="0x3EC20000"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Release/sip.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/sip.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Unicode Debug|Win32"
+ OutputDirectory=".\Unicode_Debug"
+ IntermediateDirectory=".\Unicode_Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Unicode_Debug/sip.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../include;sdk;lib\pjsip\pjlib\include;&quot;lib\pjsip\pjlib-util\include&quot;;lib\pjsip\pjmedia\include;lib\pjsip\pjsip\include;lib\pjsip\pjnath\include"
+ PreprocessorDefinitions="PJ_WIN32=1;WIN32;W32;_DEBUG;_WINDOWS;UNICODE;_USRDLL;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS"
+ RuntimeLibrary="3"
+ PrecompiledHeaderFile=".\Unicode_Debug/sip.pch"
+ AssemblerListingLocation=".\Unicode_Debug/"
+ ObjectFile=".\Unicode_Debug/"
+ ProgramDataBaseFileName=".\Unicode_Debug/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1047"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/ALIGN:4096 /filealign:0x200 /ignore:4108 "
+ AdditionalDependencies="wsock32.lib ws2_32.lib ole32.lib dsound.lib libpjproject-i386-Win32-vc8-Debug-Dynamic.lib"
+ OutputFile="..\..\bin\debug unicode\Plugins\sipW.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="lib\pjsip\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Unicode_Debug/sipW.pdb"
+ BaseAddress="0x3EC20000"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ ImportLibrary=".\Unicode_Debug/sipW.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Unicode_Debug/sip.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="commons.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\plugins\utils\mir_icons.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\plugins\utils\mir_log.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\plugins\utils\mir_memory.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\plugins\utils\mir_options.h"
+ >
+ </File>
+ <File
+ RelativePath="resource.h"
+ >
+ </File>
+ <File
+ RelativePath="SIPProto.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath="resource.rc"
+ >
+ <FileConfiguration
+ Name="Unicode Release|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\plugins\utils\mir_icons.cpp"
+ >
+ <FileConfiguration
+ Name="Unicode Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\plugins\utils\mir_log.cpp"
+ >
+ <FileConfiguration
+ Name="Unicode Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\plugins\utils\mir_options.cpp"
+ >
+ <FileConfiguration
+ Name="Unicode Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sip.cpp"
+ >
+ <FileConfiguration
+ Name="Unicode Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="SIPProto.cpp"
+ >
+ <FileConfiguration
+ Name="Unicode Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Docs"
+ >
+ <File
+ RelativePath="Docs\langpack_sip.txt"
+ >
+ </File>
+ <File
+ RelativePath="Docs\sip_changelog.txt"
+ >
+ </File>
+ <File
+ RelativePath="Docs\sip_readme.txt"
+ >
+ </File>
+ <File
+ RelativePath="Docs\sip_version.txt"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>