summaryrefslogtreecommitdiff
path: root/plugins/MyDetails/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-20 13:36:00 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-20 13:36:00 +0000
commit5b378496114ec47ffa27d3d9e7bc2a744d9e0a77 (patch)
treef7550dadde23f61182af6e542101eb5fedfa2d85 /plugins/MyDetails/src
parent0ba80eef50988ca3e88a16839eaf0a840f1cb139 (diff)
- all xstatus services moved to m_xstatus.h
- old obsoleted services PS_GETXSTATUS & PS_SETXSTATUS removed git-svn-id: http://svn.miranda-ng.org/main/trunk@2390 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MyDetails/src')
-rw-r--r--plugins/MyDetails/src/commons.h2
-rw-r--r--plugins/MyDetails/src/data.cpp55
-rw-r--r--plugins/MyDetails/src/data.h2
-rw-r--r--plugins/MyDetails/src/frame.cpp33
4 files changed, 34 insertions, 58 deletions
diff --git a/plugins/MyDetails/src/commons.h b/plugins/MyDetails/src/commons.h
index 4753c28d70..5d875f8aff 100644
--- a/plugins/MyDetails/src/commons.h
+++ b/plugins/MyDetails/src/commons.h
@@ -51,7 +51,7 @@ Boston, MA 02111-1307, USA.
#include <m_variables.h>
#include <m_avatars.h>
#include <m_statusplugins.h>
-#include <m_icq.h>
+#include <m_xstatus.h>
#include <m_icolib.h>
#include "m_cluiframes.h"
#include "m_simpleaway.h"
diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp
index ddd96e920c..930afa2bda 100644
--- a/plugins/MyDetails/src/data.cpp
+++ b/plugins/MyDetails/src/data.cpp
@@ -130,11 +130,17 @@ int Protocol::GetStatus()
data_changed = true;
// check if protocol supports custom status
- if (ProtoServiceExists(name, PS_ICQ_GETCUSTOMSTATUS))
+ CUSTOM_STATUS css = { sizeof(css) };
+ if ( ProtoServiceExists(name, PS_GETCUSTOMSTATUSEX)) {
// check if custom status is set
- custom_status = CallProtoService(name, PS_ICQ_GETCUSTOMSTATUS, (WPARAM) &custom_status_name, (LPARAM) &custom_status_message);
- else
- custom_status = 0;
+ css.flags = CSSF_TCHAR | CSSF_MASK_STATUS | CSSF_MASK_NAME | CSSF_MASK_MESSAGE | CSSF_DEFAULT_NAME;
+ css.status = &custom_status;
+ css.ptszName = status_name;
+ css.ptszMessage = status_message;
+ if ( CallProtoService(name, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&css) != 0)
+ status_message[0] = status_name[0] = 0, custom_status = 0;
+ }
+ else custom_status = 0;
// if protocol supports custom status, but it is not set (custom_status will be -1), show normal status
if (custom_status < 0) custom_status = 0;
@@ -142,35 +148,24 @@ int Protocol::GetStatus()
if (custom_status == 0) {
TCHAR *tmp = (TCHAR*) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, GSMDF_TCHAR);
lcopystr(status_name, tmp, SIZEOF(status_name));
- } else {
- DBVARIANT dbv;
+ }
+ else {
TCHAR tmp[256]; tmp[0] = 0;
- if (custom_status_name != NULL && custom_status_name[0] != '\0' && !DBGetContactSettingTString(0, name, custom_status_name, &dbv)) {
- if (dbv.ptszVal != NULL && dbv.ptszVal[0] != _T('\0'))
- lstrcpyn(tmp, dbv.ptszVal, SIZEOF(tmp));
- else
- lstrcpyn(tmp, TranslateT("<no status name>"), SIZEOF(tmp));
-
- DBFreeVariant(&dbv);
- } else {
+ if (status_name[0] != '\0')
+ lstrcpyn(tmp, status_name, SIZEOF(tmp));
+ else
lstrcpyn(tmp, TranslateT("<no status name>"), SIZEOF(tmp));
- }
-
- if (custom_status_message != NULL && custom_status_message[0] != '\0' && !DBGetContactSettingTString(0, name, custom_status_message, &dbv)) {
- if (dbv.ptszVal != NULL && dbv.ptszVal[0] != '\0') {
- int len = lstrlen(tmp);
-
- if (len < SIZEOF(tmp))
- lstrcpyn(&tmp[len], _T(": "), SIZEOF(tmp) - len);
- len += 2;
+ if (status_message[0] != '\0') {
+ int len = lstrlen(tmp);
+ if (len < SIZEOF(tmp))
+ lstrcpyn(&tmp[len], _T(": "), SIZEOF(tmp) - len);
- if (len < SIZEOF(tmp))
- lstrcpyn(&tmp[len], dbv.ptszVal, SIZEOF(tmp) - len);
- }
+ len += 2;
- DBFreeVariant(&dbv);
+ if (len < SIZEOF(tmp))
+ lstrcpyn(&tmp[len], status_message, SIZEOF(tmp) - len);
}
lcopystr(status_name, tmp, SIZEOF(status_name));
@@ -450,7 +445,7 @@ TCHAR * Protocol::GetListeningTo()
}
lcopystr(listening_to, dbv.ptszVal, SIZEOF(listening_to));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return listening_to;
}
@@ -604,7 +599,7 @@ void ProtocolArray::GetDefaultNick()
DBVARIANT dbv;
if ( !DBGetContactSettingTString(0, MODULE_NAME, SETTING_DEFAULT_NICK, &dbv)) {
lstrcpyn(default_nick, dbv.ptszVal, SIZEOF(default_nick));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else default_nick[0] = '\0';
}
@@ -614,7 +609,7 @@ void ProtocolArray::GetDefaultAvatar()
DBVARIANT dbv;
if ( !DBGetContactSettingTString(0, "ContactPhoto", "File", &dbv)) {
lstrcpyn(default_avatar_file, dbv.ptszVal, SIZEOF(default_avatar_file));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else default_avatar_file[0] = '\0';
}
diff --git a/plugins/MyDetails/src/data.h b/plugins/MyDetails/src/data.h
index 468bc6c590..9eb355e333 100644
--- a/plugins/MyDetails/src/data.h
+++ b/plugins/MyDetails/src/data.h
@@ -42,9 +42,7 @@ public:
TCHAR description[256];
TCHAR nickname[256];
TCHAR status_name[256];
- char *custom_status_name;
TCHAR status_message[1024];
- char *custom_status_message;
TCHAR listening_to[1024];
AVATARCACHEENTRY *ace;
TCHAR avatar_file[1024];
diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp
index 690bd84a9d..f2e056082b 100644
--- a/plugins/MyDetails/src/frame.cpp
+++ b/plugins/MyDetails/src/frame.cpp
@@ -1287,18 +1287,13 @@ void Draw(HWND hwnd, HDC hdc_orig)
SelectClipRgn(hdc, rgn);
HICON status_icon;
- if (proto->custom_status != 0 && ProtoServiceExists(proto->name, PS_ICQ_GETCUSTOMSTATUSICON))
- {
- status_icon = (HICON) CallProtoService(proto->name, PS_ICQ_GETCUSTOMSTATUSICON, proto->custom_status, 0);
- }
+ if (proto->custom_status != 0 && ProtoServiceExists(proto->name, PS_GETCUSTOMSTATUSICON))
+ status_icon = (HICON) CallProtoService(proto->name, PS_GETCUSTOMSTATUSICON, proto->custom_status, 0);
else
- {
status_icon = LoadSkinnedProtoIcon(proto->name, proto->status);
- }
- if (status_icon != NULL)
- {
- DrawIconEx(hdc, data->status_icon_rect.left, data->status_icon_rect.top, status_icon,
- ICON_SIZE, ICON_SIZE, 0, NULL, DI_NORMAL);
+
+ if (status_icon != NULL) {
+ DrawIconEx(hdc, data->status_icon_rect.left, data->status_icon_rect.top, status_icon, ICON_SIZE, ICON_SIZE, 0, NULL, DI_NORMAL);
DeleteObject(status_icon);
}
@@ -2668,21 +2663,9 @@ int SettingsChangedHook(WPARAM wParam, LPARAM lParam)
if ((HANDLE)wParam == NULL)
{
- Protocol *proto = protocols->Get((const char *) cws->szModule);
-
- if ( !strcmp(cws->szSetting,"Status")
- || ( proto != NULL && proto->custom_status != 0
- && proto->custom_status_name != NULL
- && !strcmp(cws->szSetting, proto->custom_status_name))
- || ( proto != NULL && proto->custom_status != 0
- && proto->custom_status_message != NULL
- && !strcmp(cws->szSetting, proto->custom_status_message)))
- {
- // Status changed
- if (proto != NULL)
- PostMessage(hwnd_frame, MWM_STATUS_CHANGED, (WPARAM) proto->name, 0);
- }
- else if (!strcmp(cws->szSetting,"MyHandle")
+ Protocol *proto = protocols->Get((const char*)cws->szModule);
+
+ if (!strcmp(cws->szSetting,"MyHandle")
|| !strcmp(cws->szSetting,"UIN")
|| !strcmp(cws->szSetting,"Nick")
|| !strcmp(cws->szSetting,"FirstName")