diff options
author | George Hazan <george.hazan@gmail.com> | 2013-02-12 15:44:31 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-02-12 15:44:31 +0000 |
commit | d15f35d8cf97bdfc5c76a687274676b627fe6e83 (patch) | |
tree | 48ee9dac1cd2fdc8b00d8fbe0f8400d24591b2df /plugins | |
parent | 675e45c8deeeb75975fa5b48395c6395d86fba59 (diff) |
fix for mixing simple & extended statuses in MyDetails
git-svn-id: http://svn.miranda-ng.org/main/trunk@3570 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/MyDetails/src/data.cpp | 41 | ||||
-rw-r--r-- | plugins/MyDetails/src/data.h | 1 | ||||
-rw-r--r-- | plugins/MyDetails/src/frame.cpp | 6 |
3 files changed, 16 insertions, 32 deletions
diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp index 103f4d2f96..c14f25c337 100644 --- a/plugins/MyDetails/src/data.cpp +++ b/plugins/MyDetails/src/data.cpp @@ -118,56 +118,43 @@ bool Protocol::IsValid() int Protocol::GetStatus()
{
- int old_status = status;
INT_PTR iStatus = CallProtoService(name, PS_GETSTATUS, 0, 0);
if (iStatus == CALLSERVICE_NOTFOUND)
return status = ID_STATUS_OFFLINE;
- status = (int)iStatus;
-
- if (old_status != status)
+ if (iStatus != status)
data_changed = true;
+ status = (int)iStatus;
+
// check if protocol supports custom status
CUSTOM_STATUS css = { sizeof(css) };
+ TCHAR tszXStatusName[256], tszXStatusMessage[1024];
if ( ProtoServiceExists(name, PS_GETCUSTOMSTATUSEX)) {
// check if custom status is set
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;
+ css.ptszName = tszXStatusName;
+ css.ptszMessage = tszXStatusMessage;
if ( CallProtoService(name, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&css) != 0)
- status_message[0] = status_name[0] = 0, custom_status = 0;
+ tszXStatusMessage[0] = tszXStatusName[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;
+ if (custom_status < 0)
+ custom_status = 0;
if (custom_status == 0) {
- TCHAR *tmp = (TCHAR*) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, GSMDF_TCHAR);
+ TCHAR *tmp = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, GSMDF_TCHAR);
lcopystr(status_name, tmp, SIZEOF(status_name));
}
else {
- TCHAR tmp[256]; tmp[0] = 0;
-
- if (status_name[0] != '\0')
- lstrcpyn(tmp, status_name, SIZEOF(tmp));
+ TCHAR *p = (tszXStatusName[0] != 0) ? tszXStatusName : TranslateT("<no status name>");
+ if (tszXStatusMessage[0])
+ mir_sntprintf(status_name, SIZEOF(status_name), _T("%s: %s"), p, tszXStatusMessage);
else
- lstrcpyn(tmp, TranslateT("<no status name>"), SIZEOF(tmp));
-
- if (status_message[0] != '\0') {
- int len = lstrlen(tmp);
- if (len < SIZEOF(tmp))
- lstrcpyn(&tmp[len], _T(": "), SIZEOF(tmp) - len);
-
- len += 2;
-
- if (len < SIZEOF(tmp))
- lstrcpyn(&tmp[len], status_message, SIZEOF(tmp) - len);
- }
-
- lcopystr(status_name, tmp, SIZEOF(status_name));
+ lcopystr(status_name, p, SIZEOF(status_name));
}
return status;
diff --git a/plugins/MyDetails/src/data.h b/plugins/MyDetails/src/data.h index 9eb355e333..8578d993d2 100644 --- a/plugins/MyDetails/src/data.h +++ b/plugins/MyDetails/src/data.h @@ -55,7 +55,6 @@ public: bool data_changed;
-
// Methods ///////////////
Protocol(const char *name, const TCHAR *descr);
diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index 7be6ff38f9..6317432064 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -2078,6 +2078,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar break;
}
+ case WM_NCMOUSELEAVE:
case WM_MOUSELEAVE:
{
TRACKMOUSEEVENT tme;
@@ -2108,10 +2109,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_MOUSEMOVE:
proto = protocols->Get(data->protocol_number);
if (proto != NULL) {
- POINT p;
- p.x = LOWORD(lParam);
- p.y = HIWORD(lParam);
-
+ POINT p = { LOWORD(lParam), HIWORD(lParam) };
MakeHover(hwnd, data->draw_img, &data->mouse_over_img, &p, &data->img_rect);
MakeHover(hwnd, data->draw_nick, &data->mouse_over_nick, &p, &data->nick_rect);
MakeHover(hwnd, data->draw_proto, &data->mouse_over_proto, &p, &data->proto_rect);
|