summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tipper/common.h9
-rw-r--r--tipper/popwin.cpp18
-rw-r--r--tipper/subst.cpp40
3 files changed, 42 insertions, 25 deletions
diff --git a/tipper/common.h b/tipper/common.h
index 91beb49..5d8be21 100644
--- a/tipper/common.h
+++ b/tipper/common.h
@@ -33,6 +33,7 @@
#include <process.h>
#include <commctrl.h>
#include <stddef.h>
+#include <stdio.h>
#include <win2k.h>
#include <newpluginapi.h>
@@ -46,9 +47,8 @@
#include <m_clui.h>
#include <m_clist.h>
#include <m_clc.h>
-#include "m_cluiframes.h"
+#include <m_cluiframes.h>
#include <m_awaymsg.h>
-#include <stdio.h>
#include <m_utils.h>
#include <m_protocols.h>
#include <m_protosvc.h>
@@ -56,10 +56,10 @@
#include <m_contacts.h>
#include <m_popup.h>
-
-#include "m_updater.h"
#include <m_fontservice.h>
#include <m_avatars.h>
+
+#include "m_updater.h"
#include "m_variables.h"
#include "m_notify.h"
@@ -69,7 +69,6 @@
#include "m_metacontacts.h"
#include <m_icq.h>
-#include "m_ersatz.h"
#include <m_imgsrvc.h>
#define MODULE "Tipper"
diff --git a/tipper/popwin.cpp b/tipper/popwin.cpp
index 26afd34..7952c40 100644
--- a/tipper/popwin.cpp
+++ b/tipper/popwin.cpp
@@ -97,23 +97,25 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
pwd->row_count++;
}
- if(status >= ID_STATUS_OFFLINE && status <= ID_STATUS_IDLE) {
+ if(status >= ID_STATUS_OFFLINE && status <= ID_STATUS_IDLE)
+ {
TCHAR *swzText = 0;
char *status_msg = 0;
// supported by protocols from Miranda 0.8+
- char svc[256];
- mir_snprintf(svc, 256, "%s%s", pwd->clcit.proto, PS_GETMYAWAYMSG);
- if ( ServiceExists( svc )) {
- TCHAR* p = (TCHAR *)CallProtoService(pwd->clcit.proto, PS_GETMYAWAYMSG, 0, SGMA_TCHAR);
- if ( !p )
+ TCHAR* p = (TCHAR *)CallProtoService(pwd->clcit.proto, PS_GETMYAWAYMSG, 0, SGMA_TCHAR);
+ if ((INT_PTR)p != CALLSERVICE_NOTFOUND)
+ {
+ if (p == NULL)
status_msg = (char *)CallProtoService(pwd->clcit.proto, PS_GETMYAWAYMSG, 0, 0);
- else {
+ else
+ {
swzText = _tcsdup( p );
mir_free( p );
}
}
- else status_msg = (char *)CallService(MS_AWAYMSG_GETSTATUSMSG, status, 0);
+ else
+ status_msg = (char *)CallService(MS_AWAYMSG_GETSTATUSMSG, status, 0);
if(status_msg && status_msg[0]) swzText = a2t(status_msg);
diff --git a/tipper/subst.cpp b/tipper/subst.cpp
index efd71b4..f766116 100644
--- a/tipper/subst.cpp
+++ b/tipper/subst.cpp
@@ -192,10 +192,18 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *raw_spec, TCHAR *buff, int bufflen)
if (!_tcscmp(raw_spec, _T("uid"))) {
return uid(hContact, 0, buff, bufflen);
} else if (!_tcscmp(raw_spec, _T("proto"))) {
- char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if (szProto){
- a2t(szProto, buff, bufflen);
- return true;
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEACCOUNT, (WPARAM)hContact, 0);
+ if ((INT_PTR)szProto == CALLSERVICE_NOTFOUND) {
+ szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ if (szProto) {
+ a2t(szProto, buff, bufflen);
+ return true;
+ }
+ }
+ else if (szProto) {
+ PROTOACCOUNT *pa = ProtoGetAccount(szProto);
+ _tcsncpy(buff, pa->tszAccountName, bufflen);
+ return true;
}
} else if (!_tcscmp(raw_spec, _T("uidname"))) {
char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
@@ -217,24 +225,32 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *raw_spec, TCHAR *buff, int bufflen)
} else if (!_tcscmp(raw_spec, _T("meta_subname"))) {
// get contact list name of active subcontact
HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0);
- if(!hSubContact) return false;
+ if (!hSubContact || (INT_PTR)hSubContact == CALLSERVICE_NOTFOUND) return false;
TCHAR *stzCDN = (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hSubContact, GCDNF_TCHAR);
if(stzCDN) _tcsncpy(buff, stzCDN, bufflen);
return true;
} else if (!_tcscmp(raw_spec, _T("meta_subuid"))){
HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0);
- if(!hSubContact) return false;
+ if (!hSubContact || (INT_PTR)hSubContact == CALLSERVICE_NOTFOUND) return false;
return uid(hSubContact, 0, buff, bufflen);
} else if (!_tcscmp(raw_spec, _T("meta_subproto"))) {
// get protocol of active subcontact
HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0);
- if(!hSubContact) return false;
-
- char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hSubContact, 0);
- if (szProto){
- a2t(szProto, buff, bufflen);
- return true;
+ if (!hSubContact || (INT_PTR)hSubContact == CALLSERVICE_NOTFOUND) return false;
+
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEACCOUNT, (WPARAM)hContact, 0);
+ if ((INT_PTR)szProto == CALLSERVICE_NOTFOUND) {
+ szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ if (szProto) {
+ a2t(szProto, buff, bufflen);
+ return true;
+ }
+ }
+ else if (szProto) {
+ PROTOACCOUNT *pa = ProtoGetAccount(szProto);
+ _tcsncpy(buff, pa->tszAccountName, bufflen);
+ return true;
}
} else if (!_tcscmp(raw_spec, _T("last_msg_time"))) {
DWORD ts = last_message_timestamp(hContact);