From ffc370d5135d3c4a4d08f5f5990c7b347c318e49 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 27 Feb 2014 13:03:16 +0000 Subject: MS_AWAYMSG_GETSTATUSMSGW service added to NAS git-svn-id: http://svn.miranda-ng.org/main/trunk@8290 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewAwaySysMod/src/AwaySys.cpp | 5 ++++- plugins/NewAwaySysMod/src/Services.cpp | 17 +++++++++-------- plugins/NewAwaySysMod/src/Services.h | 1 + plugins/NewAwaySysMod/src/version.h | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) (limited to 'plugins/NewAwaySysMod') diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index cad89b6c49..2ee9c2832a 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -680,12 +680,15 @@ int MirandaLoaded(WPARAM, LPARAM) CreateServiceFunction(MS_AWAYSYS_AUTOREPLY_ON, srvAutoreplyOn); CreateServiceFunction(MS_AWAYSYS_AUTOREPLY_OFF, srvAutoreplyOff); CreateServiceFunction(MS_AWAYSYS_AUTOREPLY_USEDEFAULT, srvAutoreplyUseDefault); + CreateServiceFunction(MS_AWAYMSG_GETSTATUSMSG, GetStatusMsg); + CreateServiceFunction(MS_AWAYMSG_GETSTATUSMSGW, GetStatusMsgW); + CreateServiceFunction(MS_NAS_GETSTATEA, GetStateA); CreateServiceFunction(MS_NAS_SETSTATEA, SetStateA); CreateServiceFunction(MS_NAS_GETSTATEW, GetStateW); CreateServiceFunction(MS_NAS_SETSTATEW, SetStateW); CreateServiceFunction(MS_NAS_INVOKESTATUSWINDOW, InvokeStatusWindow); - CreateServiceFunction(MS_AWAYMSG_GETSTATUSMSG, GetStatusMsg); + // and old AwaySysMod service, for compatibility reasons CreateServiceFunction(MS_AWAYSYS_SETSTATUSMODE, SetStatusMode); diff --git a/plugins/NewAwaySysMod/src/Services.cpp b/plugins/NewAwaySysMod/src/Services.cpp index 5696b98766..bce50f84d3 100644 --- a/plugins/NewAwaySysMod/src/Services.cpp +++ b/plugins/NewAwaySysMod/src/Services.cpp @@ -53,18 +53,19 @@ __inline void PSSetStatus(char *szProto, WORD Status, int bNoClistSetStatusMode INT_PTR GetStatusMsg(WPARAM wParam, LPARAM) { LogMessage("MS_AWAYMSG_GETSTATUSMSG called. status=%d", wParam); - CString Msg(_T2A(GetDynamicStatMsg(INVALID_CONTACT_ID, NULL, 0, wParam))); - char *szMsg; - if (Msg == NULL) // it's ok to return NULL, so we'll do it - szMsg = NULL; - else { - szMsg = (char*)mir_alloc(Msg.GetLen() + 1); - lstrcpyA(szMsg, Msg); - } + char *szMsg = mir_t2a(GetDynamicStatMsg(INVALID_CONTACT_ID, NULL, 0, wParam)); LogMessage("returned szMsg:\n%s", szMsg ? szMsg : "NULL"); return (INT_PTR)szMsg; } +INT_PTR GetStatusMsgW(WPARAM wParam, LPARAM) +{ + LogMessage("MS_AWAYMSG_GETSTATUSMSG called. status=%d", wParam); + WCHAR *szMsg = mir_t2u(GetDynamicStatMsg(INVALID_CONTACT_ID, NULL, 0, wParam)); + LogMessage("returned szMsg:\n%S", szMsg ? szMsg : L"NULL"); + return (INT_PTR)szMsg; +} + // wParam = int iMode // lParam = char* szMsg, may be null - then we need to use the default message INT_PTR SetStatusMode(WPARAM wParam, LPARAM lParam) // called by GamerStatus and StatCtrl diff --git a/plugins/NewAwaySysMod/src/Services.h b/plugins/NewAwaySysMod/src/Services.h index 903bbd3784..2aac3c7cc0 100644 --- a/plugins/NewAwaySysMod/src/Services.h +++ b/plugins/NewAwaySysMod/src/Services.h @@ -18,6 +18,7 @@ */ INT_PTR GetStatusMsg(WPARAM wParam, LPARAM lParam); +INT_PTR GetStatusMsgW(WPARAM wParam, LPARAM lParam); INT_PTR SetStatusMode(WPARAM wParam, LPARAM lParam); // int IgnoreNextStatusChange(WPARAM wParam, LPARAM lParam); INT_PTR GetStateA(WPARAM wParam, LPARAM lParam); diff --git a/plugins/NewAwaySysMod/src/version.h b/plugins/NewAwaySysMod/src/version.h index c6783a1bcc..5335e9900e 100644 --- a/plugins/NewAwaySysMod/src/version.h +++ b/plugins/NewAwaySysMod/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 4 #define __RELEASE_NUM 0 -#define __BUILD_NUM 2 +#define __BUILD_NUM 3 #include -- cgit v1.2.3