diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-02-02 13:06:20 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-02-02 13:06:20 +0000 |
commit | 35ded165ba1c21cd526191a47101da56c101d1a9 (patch) | |
tree | f86b9560ab673b013da05a35536d81fb98935202 | |
parent | 06ddd6b98d4b76bdc8ba20d4b2fd63211f92c93d (diff) |
added user id to status bar tips
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@104 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r-- | tipper/popwin.cpp | 13 | ||||
-rw-r--r-- | tipper/subst.cpp | 28 | ||||
-rw-r--r-- | tipper/subst.h | 4 | ||||
-rw-r--r-- | tipper/version.h | 2 |
4 files changed, 35 insertions, 12 deletions
diff --git a/tipper/popwin.cpp b/tipper/popwin.cpp index 4311789..fadbfe3 100644 --- a/tipper/popwin.cpp +++ b/tipper/popwin.cpp @@ -69,6 +69,19 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa a2t(pwd->clcit.proto, pwd->swzTitle, TITLE_TEXT_LEN); + TCHAR uid_buff[256], uid_name_buff[256]; + if(uid(0, pwd->clcit.proto, uid_buff, 256) && uid_name(pwd->clcit.proto, uid_name_buff, 253)) { // 253 to leave room for ': '
+ _tcscat(uid_name_buff, _T(": ")); +
+ pwd->rows = (RowData *) realloc(pwd->rows, sizeof(RowData) * (pwd->row_count + 1)); + + pwd->rows[pwd->row_count].swzLabel = _tcsdup(uid_name_buff); + pwd->rows[pwd->row_count].swzValue = _tcsdup(uid_buff); + pwd->rows[pwd->row_count].value_newline = false; + pwd->rows[pwd->row_count].line_above = false; + pwd->row_count++; + } + WORD status = CallProtoService(pwd->clcit.proto, PS_GETSTATUS, 0, 0); char *strptr = (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, (LPARAM)0); if(strptr) { diff --git a/tipper/subst.cpp b/tipper/subst.cpp index aac9e8f..c67e207 100644 --- a/tipper/subst.cpp +++ b/tipper/subst.cpp @@ -73,11 +73,12 @@ void format_timestamp(DWORD ts, char *format, TCHAR *buff, int bufflen) { }
}
-bool uid(HANDLE hContact, TCHAR *buff, int bufflen) {
+bool uid(HANDLE hContact, char *proto, TCHAR *buff, int bufflen) {
CONTACTINFO ci;
ci.cbSize = sizeof(CONTACTINFO);
ci.hContact = hContact;
- ci.szProto = 0;//(char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hcontact,0);
+ // pass in proto so we can get uid when hContact == 0 (i.e. our own uid for a given proto)
+ ci.szProto = proto;//(char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hcontact,0);
ci.dwFlag = CNF_UNIQUEID | (unicode_system ? CNF_UNICODE : 0);
if(!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
switch(ci.type) {
@@ -106,6 +107,17 @@ bool uid(HANDLE hContact, TCHAR *buff, int bufflen) { return false;
}
+bool uid_name(char *szProto, TCHAR *buff, int bufflen) {
+ if (szProto){
+ char *szUniqueId = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
+ if(szUniqueId) {
+ a2t(szUniqueId, buff, bufflen);
+ return true;
+ }
+ }
+ return false;
+}
+
TCHAR *GetLastMessageText(HANDLE hContact) { DBEVENTINFO dbei = {0}; dbei.cbSize = sizeof(dbei); @@ -167,7 +179,7 @@ TCHAR *GetStatusMessageText(HANDLE hContact) { bool GetSysSubstText(HANDLE hContact, TCHAR *raw_spec, TCHAR *buff, int bufflen) {
if (!_tcscmp(raw_spec, _T("uid"))) {
- return uid(hContact, buff, bufflen);
+ 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){
@@ -176,13 +188,7 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *raw_spec, TCHAR *buff, int bufflen) }
} else if (!_tcscmp(raw_spec, _T("uidname"))) {
char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if (szProto){
- char *szUniqueId = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
- if(szUniqueId) {
- a2t(szUniqueId, buff, bufflen);
- return true;
- }
- }
+ return uid_name(szProto, buff, bufflen);
} else if (!_tcscmp(raw_spec, _T("status_msg"))) {
TCHAR *msg = GetStatusMessageText(hContact);
if(msg) {
@@ -208,7 +214,7 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *raw_spec, TCHAR *buff, int bufflen) } else if (!_tcscmp(raw_spec, _T("meta_subuid"))){
HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0);
if(!hSubContact) return false;
- return uid(hSubContact, buff, bufflen);
+ 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);
diff --git a/tipper/subst.h b/tipper/subst.h index 8912aa6..755a587 100644 --- a/tipper/subst.h +++ b/tipper/subst.h @@ -11,4 +11,8 @@ bool GetValueText(HANDLE hContact, const DisplayItem &di, TCHAR *buff, int buffl void StripBBCodesInPlace(TCHAR *text);
+// can be used with hContact == 0 to get uid for a given proto
+bool uid_name(char *szProto, TCHAR *buff, int bufflen);
+bool uid(HANDLE hContact, char *proto, TCHAR *buff, int bufflen);
+
#endif
diff --git a/tipper/version.h b/tipper/version.h index 0b125fb..8a73fd9 100644 --- a/tipper/version.h +++ b/tipper/version.h @@ -4,7 +4,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 3
#define __RELEASE_NUM 0
-#define __BUILD_NUM 7
+#define __BUILD_NUM 8
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
|