From 08dc125be616458112368e7154b29d5d23f1126e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 19 Jul 2012 08:02:41 +0000 Subject: Unicode in status message plugins git-svn-id: http://svn.miranda-ng.org/main/trunk@1033 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MyDetails/commons.h | 23 +- plugins/MyDetails/data.cpp | 327 ++++++++-------------------- plugins/MyDetails/data.h | 12 +- plugins/MyDetails/frame.cpp | 246 +++++++++------------ plugins/MyDetails/mydetails.cpp | 287 ++++++------------------ plugins/MyDetails/mydetails.h | 25 --- plugins/MyDetails/mydetails.vcxproj | 29 +-- plugins/MyDetails/mydetails.vcxproj.filters | 3 - plugins/MyDetails/options.cpp | 10 +- 9 files changed, 288 insertions(+), 674 deletions(-) delete mode 100644 plugins/MyDetails/mydetails.h (limited to 'plugins/MyDetails') diff --git a/plugins/MyDetails/commons.h b/plugins/MyDetails/commons.h index cc176e193a..eeff18a681 100644 --- a/plugins/MyDetails/commons.h +++ b/plugins/MyDetails/commons.h @@ -28,10 +28,12 @@ Boston, MA 02111-1307, USA. #include #include #include + #include #include #include #include +#include #include #include #include @@ -45,7 +47,6 @@ Boston, MA 02111-1307, USA. #include #include -#include #include #include #include @@ -91,9 +92,6 @@ extern long status_msg_dialog_open; #define PS_GETMYNICKNAMEMAXLENGTH "/GetMyNicknameMaxLength" -#define MAX_REGS(_A_) ( sizeof(_A_) / sizeof(_A_[0]) ) - - // See if a protocol service exists __inline static int ProtoServiceExists(const char *szModule,const char *szService) { @@ -105,21 +103,14 @@ __inline static int ProtoServiceExists(const char *szModule,const char *szServic // Helper -static __inline int DRAW_TEXT(HDC hDC, LPCSTR lpString, int nCount, LPRECT lpRect, UINT uFormat, const char *protocol, +static __inline int DRAW_TEXT(HDC hDC, LPCTSTR lpString, int nCount, LPRECT lpRect, UINT uFormat, const char *protocol, SmileysParseInfo parseInfo) { - if (opts.replace_smileys) - { - return Smileys_DrawText(hDC, lpString, nCount, lpRect, uFormat | (opts.resize_smileys ? DT_RESIZE_SMILEYS : 0), - opts.use_contact_list_smileys ? "clist" : protocol, parseInfo); - } - else - { + if (!opts.replace_smileys) return DrawText(hDC, lpString, nCount, lpRect, uFormat); - } + + return Smileys_DrawText(hDC, lpString, nCount, lpRect, uFormat | (opts.resize_smileys ? DT_RESIZE_SMILEYS : 0), + opts.use_contact_list_smileys ? "clist" : protocol, parseInfo); } - - - #endif // __COMMONS_H__ diff --git a/plugins/MyDetails/data.cpp b/plugins/MyDetails/data.cpp index 728e601a06..8a01c94c72 100644 --- a/plugins/MyDetails/data.cpp +++ b/plugins/MyDetails/data.cpp @@ -72,7 +72,7 @@ void DeInitProtocolData() Protocol::Protocol(const char *aName) { - lstrcpyn(name, aName, MAX_REGS(name)); + lstrcpynA(name, aName, SIZEOF(name)); description[0] = _T('\0'); nickname[0] = _T('\0'); @@ -91,7 +91,7 @@ Protocol::Protocol(const char *aName) caps = CallProtoService(name, PS_GETCAPS, PFLAGNUM_1, 0); valid = (caps & PF1_IM) == PF1_IM && strcmp(aName, "MetaContacts"); - if (!valid) + if ( !valid) return; can_have_listening_to = (ProtoServiceExists(name, PS_SET_LISTENINGTO) != 0); @@ -104,11 +104,11 @@ Protocol::Protocol(const char *aName) avatar_max_width = 0; avatar_max_height = 0; if (ProtoServiceExists(name, PS_GETMYAVATARMAXSIZE)) - { CallProtoService(name, PS_GETMYAVATARMAXSIZE, (WPARAM) &avatar_max_width, (LPARAM) &avatar_max_height); - } - CallProtoService(name, PS_GETNAME, sizeof(description),(LPARAM) description); + char tmp[100]; + CallProtoService(name, PS_GETNAME, SIZEOF(tmp), (LPARAM)tmp); + lstrcpyn(description, _A2T(tmp), SIZEOF(description)); can_set_nick = ProtoServiceExists(name, PS_SETMYNICKNAME) != FALSE; @@ -158,49 +158,49 @@ int Protocol::GetStatus() if (custom_status == 0) { - TCHAR *tmp = (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, GSMDF_TCHAR); - lcopystr(status_name, tmp, MAX_REGS(status_name)); + TCHAR *tmp = (TCHAR*) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, GSMDF_TCHAR); + lcopystr(status_name, tmp, SIZEOF(status_name)); } else { DBVARIANT dbv; - TCHAR tmp[256] = "\0"; + TCHAR tmp[256]; tmp[0] = 0; if (custom_status_name != NULL && custom_status_name[0] != '\0' - && !DBGetContactSettingTString(0, name, custom_status_name, &dbv)) + && !DBGetContactSettingTString(0, name, _T2A(custom_status_name), &dbv)) { if (dbv.ptszVal != NULL && dbv.ptszVal[0] != _T('\0')) - lstrcpyn(tmp, dbv.ptszVal, MAX_REGS(tmp)); + lstrcpyn(tmp, dbv.ptszVal, SIZEOF(tmp)); else - lstrcpyn(tmp, TranslateTS(""), MAX_REGS(tmp)); + lstrcpyn(tmp, TranslateT(""), SIZEOF(tmp)); DBFreeVariant(&dbv); } else { - lstrcpyn(tmp, TranslateTS(""), MAX_REGS(tmp)); + lstrcpyn(tmp, TranslateT(""), SIZEOF(tmp)); } if (custom_status_message != NULL && custom_status_message[0] != '\0' - && !DBGetContactSettingTString(0, name, custom_status_message, &dbv)) + && !DBGetContactSettingTString(0, name, _T2A(custom_status_message), &dbv)) { if (dbv.ptszVal != NULL && dbv.ptszVal[0] != '\0') { int len = lstrlen(tmp); - if (len < MAX_REGS(tmp)) - lstrcpyn(&tmp[len], _T(": "), MAX_REGS(tmp) - len); + if (len < SIZEOF(tmp)) + lstrcpyn(&tmp[len], _T(": "), SIZEOF(tmp) - len); len += 2; - if (len < MAX_REGS(tmp)) - lstrcpyn(&tmp[len], dbv.ptszVal, MAX_REGS(tmp) - len); + if (len < SIZEOF(tmp)) + lstrcpyn(&tmp[len], dbv.ptszVal, SIZEOF(tmp) - len); } DBFreeVariant(&dbv); } - lcopystr(status_name, tmp, MAX_REGS(status_name)); + lcopystr(status_name, tmp, SIZEOF(status_name)); } return status; @@ -208,7 +208,7 @@ int Protocol::GetStatus() void Protocol::SetStatus(int aStatus) { - char status_msg[256]; + TCHAR status_msg[256]; if (ServiceExists(MS_CS_SETSTATUSEX)) { @@ -220,7 +220,7 @@ void Protocol::SetStatus(int aStatus) pCount = 0; CallService(MS_PROTO_ENUMPROTOCOLS,(WPARAM)&count,(LPARAM)&protos); - for(i=0;itype!=PROTOTYPE_PROTOCOL || CallProtoService(protos[i]->szName,PS_GETCAPS,PFLAGNUM_2,0)==0) continue; pCount += 1; } @@ -229,7 +229,7 @@ void Protocol::SetStatus(int aStatus) PROTOCOLSETTINGEX **pse = (PROTOCOLSETTINGEX **) mir_alloc0(pCount * sizeof(PROTOCOLSETTINGEX *)); - for(i = 0; i < pCount; i++) + for (i = 0; i < pCount; i++) { pse[i] = (PROTOCOLSETTINGEX *) mir_alloc0(sizeof(PROTOCOLSETTINGEX)); pse[i]->szName = ""; @@ -239,12 +239,12 @@ void Protocol::SetStatus(int aStatus) pse[0]->status = aStatus; pse[0]->szName = name; - GetStatusMsg(aStatus, status_msg, sizeof(status_msg)); + GetStatusMsg(aStatus, status_msg, SIZEOF(status_msg)); pse[0]->szMsg = status_msg; CallService(MS_CS_SETSTATUSEX, (WPARAM) &pse, 0); - for(i = 0; i < pCount; i++) + for (i = 0; i < pCount; i++) mir_free(pse[i]); mir_free(pse); } @@ -252,10 +252,9 @@ void Protocol::SetStatus(int aStatus) { CallProtoService(name, PS_SETSTATUS, aStatus, 0); - if (CanSetStatusMsg(aStatus)) - { - char status_msg[MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE]; - GetStatusMsg(aStatus, status_msg, sizeof(status_msg)); + if (CanSetStatusMsg(aStatus)) { + TCHAR status_msg[MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE]; + GetStatusMsg(aStatus, status_msg, SIZEOF(status_msg)); SetStatusMsg(aStatus, status_msg); } } @@ -276,9 +275,7 @@ bool Protocol::CanGetStatusMsg(int aStatus) bool Protocol::CanSetStatusMsg() { - return CanSetStatusMsg(GetStatus()) // <- Simple away handled by this one - || ServiceExists(MS_NAS_INVOKESTATUSWINDOW); - + return CanSetStatusMsg(GetStatus()); // <- Simple away handled by this one } bool Protocol::CanSetStatusMsg(int aStatus) @@ -286,152 +283,49 @@ bool Protocol::CanSetStatusMsg(int aStatus) return CanGetStatusMsg(aStatus); } -void Protocol::GetStatusMsg(int aStatus, char *msg, size_t msg_size) +void Protocol::GetStatusMsg(int aStatus, TCHAR *msg, size_t msg_size) { - if (!CanGetStatusMsg()) + if ( !CanGetStatusMsg()) { - lcopystr(msg, "", msg_size); + lcopystr(msg, _T(""), msg_size); return; } if (aStatus == status && ProtoServiceExists(name, PS_GETMYAWAYMSG) ) { - char *tmp = (char *) CallProtoService(name, PS_GETMYAWAYMSG, 0, 0); - lcopystr(msg, tmp == NULL ? "" : tmp, msg_size); + TCHAR *tmp = (TCHAR*) CallProtoService(name, PS_GETMYAWAYMSG, 0, SGMA_TCHAR); + lcopystr(msg, tmp == NULL ? _T("") : tmp, msg_size); } - else if (ServiceExists(MS_NAS_GETSTATE)) - { - NAS_PROTOINFO pi; - - ZeroMemory(&pi, sizeof(pi)); - pi.cbSize = sizeof(NAS_PROTOINFO); - pi.szProto = name; - pi.status = aStatus == status ? 0 : aStatus; - pi.szMsg = NULL; - - if (CallService(MS_NAS_GETSTATE, (WPARAM) &pi, 1) == 0) - { - if (pi.szMsg == NULL) - { - pi.szProto = NULL; - - if (CallService(MS_NAS_GETSTATE, (WPARAM) &pi, 1) == 0) - { - if (pi.szMsg != NULL) - { - lcopystr(msg, pi.szMsg, msg_size); - mir_free(pi.szMsg); - } - else lcopystr(msg, "", msg_size); - } - else lcopystr(msg, "", msg_size); - } - else // if (pi.szMsg != NULL) - { - lcopystr(msg, pi.szMsg, msg_size); - mir_free(pi.szMsg); - } - } - else lcopystr(msg, "", msg_size); - - if (ServiceExists(MS_VARS_FORMATSTRING)) - { - char *tmp = variables_parse(msg, NULL, NULL); - lcopystr(msg, tmp, msg_size); - variables_free(tmp); - } - } - // TODO: Remove when removing old NAS services support - else if (ServiceExists("NewAwaySystem/GetState")) - { - NAS_PROTOINFO pi, *pii; - - ZeroMemory(&pi, sizeof(pi)); - pi.cbSize = sizeof(NAS_PROTOINFO); - pi.szProto = name; - pi.status = aStatus == status ? 0 : aStatus; - pi.szMsg = NULL; - pii = π - - if (CallService("NewAwaySystem/GetState", (WPARAM) &pii, 1) == 0) - { - if (pi.szMsg == NULL) - { - pi.szProto = NULL; - - if (CallService("NewAwaySystem/GetState", (WPARAM) &pii, 1) == 0) - { - if (pi.szMsg != NULL) - { - lcopystr(msg, pi.szMsg, msg_size); - mir_free(pi.szMsg); - } - else lcopystr(msg, "", msg_size); - } - else lcopystr(msg, "", msg_size); - } - else // if (pi.szMsg != NULL) - { - lcopystr(msg, pi.szMsg, msg_size); - mir_free(pi.szMsg); - } - } - else lcopystr(msg, "", msg_size); - - if (ServiceExists(MS_VARS_FORMATSTRING)) - { - char *tmp = variables_parse(msg, NULL, NULL); - lcopystr(msg, tmp, msg_size); - variables_free(tmp); - } - } else if (ServiceExists(MS_AWAYMSG_GETSTATUSMSG)) { - char *tmp = (char *) CallService(MS_AWAYMSG_GETSTATUSMSG, (WPARAM)aStatus, 0); - + TCHAR *tmp = (TCHAR*) CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)aStatus, 0); if (tmp != NULL) { lcopystr(msg, tmp, msg_size); mir_free(tmp); } - else lcopystr(msg, "", msg_size); + else lcopystr(msg, _T(""), msg_size); } } -char * Protocol::GetStatusMsg() +TCHAR* Protocol::GetStatusMsg() { - GetStatusMsg(status, status_message, sizeof(status_message)); + GetStatusMsg(status, status_message, SIZEOF(status_message)); return status_message; } -void Protocol::SetStatusMsg(const char *message) +void Protocol::SetStatusMsg(const TCHAR *message) { SetStatusMsg(GetStatus(), message); } -void Protocol::SetStatusMsg(int aStatus, const char *message) +void Protocol::SetStatusMsg(int aStatus, const TCHAR *message) { - if (!CanSetStatusMsg(aStatus)) + if ( !CanSetStatusMsg(aStatus)) return; - if (ServiceExists(MS_NAS_SETSTATE)) - { - NAS_PROTOINFO pi = {0}, *pii; - - pi.cbSize = sizeof(pi); - pi.szProto = name; - pi.szMsg = mir_strdup(message); - pi.status = aStatus; - - pii = π - - CallService(MS_NAS_SETSTATE, (WPARAM) &pii, 1); - } - else - { - CallProtoService(name, PS_SETAWAYMSG, (WPARAM)aStatus, (LPARAM)message); - } + CallProtoService(name, PS_SETAWAYMSG, (WPARAM)aStatus, (LPARAM)message); } bool Protocol::HasAvatar() @@ -443,10 +337,10 @@ bool Protocol::HasAvatar() bool Protocol::CanGetAvatar() { - if (!can_have_avatar) + if ( !can_have_avatar) return false; - if (!ServiceExists(MS_AV_GETMYAVATAR)) + if ( !ServiceExists(MS_AV_GETMYAVATAR)) return false; return true; @@ -455,7 +349,7 @@ bool Protocol::CanGetAvatar() void Protocol::GetAvatar() { // See if can get one - if (!CanGetAvatar()) + if ( !CanGetAvatar()) return; avatar_file[0] = '\0'; @@ -489,32 +383,30 @@ int Protocol::GetNickMaxLength() return MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE; } -char * Protocol::GetNick() +TCHAR* Protocol::GetNick() { // See if can get one - if (!CanGetNick()) + if ( !CanGetNick()) return NULL; // Get it - CONTACTINFO ci; - ZeroMemory(&ci, sizeof(ci)); - ci.cbSize = sizeof(ci); - ci.hContact = NULL; - ci.szProto = name; - ci.dwFlag = CNF_DISPLAY; + CONTACTINFO ci = { 0 }; + ci.cbSize = sizeof(ci); + ci.hContact = NULL; + ci.szProto = name; + ci.dwFlag = CNF_DISPLAY; #ifdef UNICODE ci.dwFlag |= CNF_UNICODE; #endif - if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) + if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) { - // CNF_DISPLAY always returns a string type - lcopystr(nickname, ci.pszVal, MAX_REGS(nickname)); + // CNF_DISPLAY always returns a string type + lcopystr(nickname, ci.pszVal, SIZEOF(nickname)); mir_free(ci.pszVal); - } - else - lcopystr(nickname, "", MAX_REGS(nickname)); + } + else lcopystr(nickname, _T(""), SIZEOF(nickname)); return nickname; } @@ -526,10 +418,10 @@ bool Protocol::CanSetNick() } -void Protocol::SetNick(const char *nick) +void Protocol::SetNick(const TCHAR *nick) { // See if can get one - if (!CanSetNick()) + if ( !CanSetNick()) return; if (nick == NULL) @@ -546,12 +438,12 @@ bool Protocol::CanSetAvatar() CallService(MS_AV_CANSETMYAVATAR, (WPARAM) name, 0); } -void Protocol::SetAvatar(const char *file_name) +void Protocol::SetAvatar(const TCHAR *file_name) { - if (!CanSetAvatar()) + if ( !CanSetAvatar()) return; - CallService(MS_AV_SETMYAVATAR, (WPARAM) name, (LPARAM) file_name); + CallService(MS_AV_SETMYAVATART, (WPARAM) name, (LPARAM) file_name); } bool Protocol::CanGetListeningTo() @@ -571,31 +463,26 @@ bool Protocol::ListeningToEnabled() TCHAR * Protocol::GetListeningTo() { - if (!CanGetListeningTo()) + if ( !CanGetListeningTo()) { - lcopystr(listening_to, "", MAX_REGS(listening_to)); + lcopystr(listening_to, _T(""), SIZEOF(listening_to)); return listening_to; } DBVARIANT dbv = {0}; if (DBGetContactSettingTString(NULL, name, "ListeningTo", &dbv)) { - lcopystr(listening_to, "", MAX_REGS(listening_to)); + lcopystr(listening_to, _T(""), SIZEOF(listening_to)); return listening_to; } - lcopystr(listening_to, dbv.pszVal, MAX_REGS(listening_to)); - + lcopystr(listening_to, dbv.ptszVal, SIZEOF(listening_to)); DBFreeVariant(&dbv); - return listening_to; } - - // ProtocolDataArray Class ///////////////////////////////////////////////////////////////////////////// - ProtocolArray::ProtocolArray(int max_size) { buffer = (Protocol **) malloc(max_size * sizeof(Protocol*)); @@ -659,7 +546,7 @@ Protocol * ProtocolArray::Get(const char *name) bool ProtocolArray::CanSetStatusMsgPerProtocol() { - return ServiceExists(MS_NAS_INVOKESTATUSWINDOW) || ServiceExists(MS_SA_CHANGESTATUSMSG); + return ServiceExists(MS_SA_CHANGESTATUSMSG) != 0; } @@ -674,57 +561,48 @@ void ProtocolArray::GetAvatars() void ProtocolArray::GetStatusMsgs() { for ( int i = 0 ; i < buffer_len ; i++ ) - { buffer[i]->GetStatusMsg(); - } } void ProtocolArray::GetStatuses() { for ( int i = 0 ; i < buffer_len ; i++ ) - { buffer[i]->GetStatus(); - } } int ProtocolArray::GetGlobalStatus() { int status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0); if (status == ID_STATUS_CONNECTING) - { status = ID_STATUS_OFFLINE; - } return status; } bool ProtocolArray::CanSetAvatars() { - return ServiceExists(MS_AV_SETMYAVATAR) != FALSE; + return ServiceExists(MS_AV_SETMYAVATART) != FALSE; } -void ProtocolArray::SetAvatars(const char *file_name) +void ProtocolArray::SetAvatars(const TCHAR *file_name) { - if (!CanSetAvatars()) + if ( !CanSetAvatars()) return; - CallService(MS_AV_SETMYAVATAR, NULL, (WPARAM) file_name); + CallService(MS_AV_SETMYAVATART, NULL, (WPARAM) file_name); } - -void ProtocolArray::SetNicks(const char *nick) +void ProtocolArray::SetNicks(const TCHAR *nick) { if (nick == NULL || nick[0] == '\0') return; - lstrcpyn(default_nick, nick, sizeof(default_nick)); + lstrcpyn(default_nick, nick, SIZEOF(default_nick)); - DBWriteContactSettingString(0, MODULE_NAME, SETTING_DEFAULT_NICK, nick); + DBWriteContactSettingTString(0, MODULE_NAME, SETTING_DEFAULT_NICK, nick); for ( int i = 0 ; i < buffer_len ; i++ ) - { buffer[i]->SetNick(default_nick); - } } @@ -733,82 +611,61 @@ void ProtocolArray::SetStatus(int aStatus) CallService(MS_CLIST_SETSTATUSMODE, aStatus, 0); } -void ProtocolArray::SetStatusMsgs(const char *message) +void ProtocolArray::SetStatusMsgs(const TCHAR *message) { for (int i = ID_STATUS_OFFLINE ; i <= ID_STATUS_IDLE; i++) - { SetStatusMsgs(i, message); - } } -void ProtocolArray::SetStatusMsgs(int status, const char *message) +void ProtocolArray::SetStatusMsgs(int status, const TCHAR *message) { - DBWriteContactSettingString(NULL,"SRAway",StatusModeToDbSetting(status,"Msg"),message); - if (!DBGetContactSettingByte(NULL,"SRAway",StatusModeToDbSetting(status,"UsePrev"),0)) - { - // Save default also - DBWriteContactSettingString(NULL,"SRAway",StatusModeToDbSetting(status,"Default"),message); - } + DBWriteContactSettingTString(NULL,"SRAway",StatusModeToDbSetting(status,"Msg"),message); + + // Save default also + if ( !DBGetContactSettingByte(NULL,"SRAway",StatusModeToDbSetting(status,"UsePrev"),0)) + DBWriteContactSettingTString(NULL,"SRAway",StatusModeToDbSetting(status,"Default"),message); for ( int i = 0 ; i < buffer_len ; i++ ) - { if (buffer[i]->status == status) buffer[i]->SetStatusMsg(status, message); - } } - void ProtocolArray::GetDefaultNick() { DBVARIANT dbv; - - if (!DBGetContactSettingTString(0, MODULE_NAME, SETTING_DEFAULT_NICK, &dbv)) - { - lstrcpyn(default_nick, dbv.pszVal, sizeof(default_nick)); + if ( !DBGetContactSettingTString(0, MODULE_NAME, SETTING_DEFAULT_NICK, &dbv)) { + lstrcpyn(default_nick, dbv.ptszVal, SIZEOF(default_nick)); DBFreeVariant(&dbv); } - else - { - default_nick[0] = '\0'; - } + else default_nick[0] = '\0'; } void ProtocolArray::GetDefaultAvatar() { DBVARIANT dbv; - - if (!DBGetContactSettingTString(0, "ContactPhoto", "File", &dbv)) - { - lstrcpyn(default_avatar_file, dbv.pszVal, sizeof(default_avatar_file)); + if ( !DBGetContactSettingTString(0, "ContactPhoto", "File", &dbv)) { + lstrcpyn(default_avatar_file, dbv.ptszVal, SIZEOF(default_avatar_file)); DBFreeVariant(&dbv); } - else - { - default_avatar_file[0] = '\0'; - } + else default_avatar_file[0] = '\0'; } -char * ProtocolArray::GetDefaultStatusMsg() +TCHAR* ProtocolArray::GetDefaultStatusMsg() { return GetDefaultStatusMsg(CallService(MS_CLIST_GETSTATUSMODE, 0, 0)); } -char * ProtocolArray::GetDefaultStatusMsg(int status) +TCHAR* ProtocolArray::GetDefaultStatusMsg(int status) { default_status_message[0] = '\0'; - if (ServiceExists(MS_AWAYMSG_GETSTATUSMSG)) - { + if (ServiceExists(MS_AWAYMSG_GETSTATUSMSG)) { if (status == ID_STATUS_CONNECTING) - { status = ID_STATUS_OFFLINE; - } - - char *tmp = (char *) CallService(MS_AWAYMSG_GETSTATUSMSG, (WPARAM)status, 0); - if (tmp != NULL) - { - lstrcpyn(default_status_message, tmp, sizeof(default_status_message)); + TCHAR *tmp = (TCHAR*) CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)status, 0); + if (tmp != NULL) { + lstrcpyn(default_status_message, tmp, SIZEOF(default_status_message)); mir_free(tmp); } } @@ -832,7 +689,7 @@ bool ProtocolArray::ListeningToEnabled() static char *StatusModeToDbSetting(int status,const char *suffix) { - char *prefix; + char *prefix; static char str[64]; switch(status) { diff --git a/plugins/MyDetails/data.h b/plugins/MyDetails/data.h index 4ae35dbce7..3ae7b024e5 100644 --- a/plugins/MyDetails/data.h +++ b/plugins/MyDetails/data.h @@ -39,7 +39,7 @@ protected: public: // Name of protocol char name[256]; - char description[256]; + TCHAR description[256]; TCHAR nickname[256]; TCHAR status_name[256]; TCHAR *custom_status_name; @@ -119,8 +119,8 @@ public: int GetSize(); void Add(Protocol *p); - Protocol * Get(int i); - Protocol * Get(const char *name); + Protocol* Get(int i); + Protocol* Get(const char *name); void GetAvatars(); bool CanSetAvatars(); @@ -135,14 +135,14 @@ public: void GetStatusMsgs(); void GetStatuses(); - int GetGlobalStatus(); + int GetGlobalStatus(); bool CanSetStatusMsgPerProtocol(); void GetDefaultNick(); // Copy to cache void GetDefaultAvatar(); // Copy to cache - TCHAR * GetDefaultStatusMsg(); // Copy to cache - TCHAR * GetDefaultStatusMsg(int status); + TCHAR* GetDefaultStatusMsg(); // Copy to cache + TCHAR* GetDefaultStatusMsg(int status); bool CanSetListeningTo(); bool ListeningToEnabled(); diff --git a/plugins/MyDetails/frame.cpp b/plugins/MyDetails/frame.cpp index 7610da8f32..2afae69561 100644 --- a/plugins/MyDetails/frame.cpp +++ b/plugins/MyDetails/frame.cpp @@ -28,8 +28,8 @@ Boston, MA 02111-1307, USA. #define WINDOW_NAME_PREFIX "mydetails_window" -#define WINDOW_CLASS_NAME "MyDetailsFrame" -#define CONTAINER_CLASS_NAME "MyDetailsFrameContainer" +#define WINDOW_CLASS_NAME _T("MyDetailsFrame") +#define CONTAINER_CLASS_NAME _T("MyDetailsFrameContainer") #define ID_FRAME_TIMER 1011 #define ID_RECALC_TIMER 1012 @@ -39,9 +39,9 @@ Boston, MA 02111-1307, USA. #define IDC_HAND MAKEINTRESOURCE(32649) -#define DEFAULT_NICKNAME "" -#define DEFAULT_STATUS_MESSAGE "" -#define DEFAULT_LISTENING_TO "" +#define DEFAULT_NICKNAME _T("") +#define DEFAULT_STATUS_MESSAGE _T("") +#define DEFAULT_LISTENING_TO _T("") // Messages @@ -229,19 +229,19 @@ int CreateFrame() ZeroMemory(&font_id[i], sizeof(font_id[i])); font_id[i].cbSize = sizeof(FontID); - strncpy(font_id[i].group, Translate("My Details"), sizeof(font_id[i].group)); - strncpy(font_id[i].name, Translate(font_names[i]), sizeof(font_id[i].name)); - strncpy(font_id[i].dbSettingsGroup, MODULE_NAME, sizeof(font_id[i].dbSettingsGroup)); + strncpy(font_id[i].group, Translate("My Details"), SIZEOF(font_id[i].group)); + strncpy(font_id[i].name, Translate(font_names[i]), SIZEOF(font_id[i].name)); + strncpy(font_id[i].dbSettingsGroup, MODULE_NAME, SIZEOF(font_id[i].dbSettingsGroup)); char tmp[128]; mir_snprintf(tmp, sizeof(tmp), "%sFont", font_names[i]); - strncpy(font_id[i].prefix, tmp, sizeof(font_id[i].prefix)); + strncpy(font_id[i].prefix, tmp, SIZEOF(font_id[i].prefix)); font_id[i].deffontsettings.colour = font_colors[i]; font_id[i].deffontsettings.size = -MulDiv(font_sizes[i], GetDeviceCaps(hdc, LOGPIXELSY), 72); font_id[i].deffontsettings.style = font_styles[i]; font_id[i].deffontsettings.charset = DEFAULT_CHARSET; - strncpy(font_id[i].deffontsettings.szFace, "Tahoma", sizeof(font_id[i].deffontsettings.szFace)); + strncpy(font_id[i].deffontsettings.szFace, "Tahoma", SIZEOF(font_id[i].deffontsettings.szFace)); font_id[i].order = i; font_id[i].flags = FIDF_DEFAULTVALID; FontRegister(&font_id[i]); @@ -267,7 +267,7 @@ int CreateFrame() if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) { - hwnd_frame = CreateWindow(WINDOW_CLASS_NAME, Translate("My Details"), + hwnd_frame = CreateWindow(WINDOW_CLASS_NAME, TranslateT("My Details"), WS_CHILD | WS_VISIBLE, 0,0,10,10, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL, hInst, NULL); @@ -316,11 +316,11 @@ int CreateFrame() wndclass.lpszClassName = CONTAINER_CLASS_NAME; RegisterClass(&wndclass); - hwnd_container = CreateWindowEx(WS_EX_TOOLWINDOW, CONTAINER_CLASS_NAME, Translate("My Details"), + hwnd_container = CreateWindowEx(WS_EX_TOOLWINDOW, CONTAINER_CLASS_NAME, TranslateT("My Details"), (WS_THICKFRAME | WS_CAPTION | WS_SYSMENU) & ~WS_VISIBLE, 0,0,200,130, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL, hInst, NULL); - hwnd_frame = CreateWindow(WINDOW_CLASS_NAME, Translate("My Details"), + hwnd_frame = CreateWindow(WINDOW_CLASS_NAME, TranslateT("My Details"), WS_CHILD | WS_VISIBLE, 0,0,10,10, hwnd_container, NULL, hInst, NULL); @@ -424,7 +424,7 @@ BOOL ScreenToClient(HWND hWnd, LPRECT lpRect) ret = ScreenToClient(hWnd, &pt); - if (!ret) return ret; + if ( !ret) return ret; lpRect->left = pt.x; lpRect->top = pt.y; @@ -472,7 +472,7 @@ RECT GetRect(HDC hdc, RECT rc, SIZE s, UINT uFormat, int next_top, int text_left uFormat &= ~DT_END_ELLIPSIS; RECT rc_tmp = rc; - DrawText(hdc, " ...", 4, &rc_tmp, DT_CALCRECT | uFormat); + DrawText(hdc, _T(" ..."), 4, &rc_tmp, DT_CALCRECT | uFormat); s.cx += rc_tmp.right - rc_tmp.left; } @@ -509,13 +509,13 @@ RECT GetRect(HDC hdc, RECT rc, SIZE s, UINT uFormat, int next_top, int text_left return r; } -RECT GetRect(HDC hdc, RECT rc, const char *text, const char *def_text, Protocol *proto, UINT uFormat, +RECT GetRect(HDC hdc, RECT rc, const TCHAR *text, const TCHAR *def_text, Protocol *proto, UINT uFormat, int next_top, int text_left, bool smileys = true, bool frame = true, bool end_elipsis_on_frame = true) { - const char *tmp; + const TCHAR *tmp; if (text[0] == '\0') - tmp = Translate(def_text); + tmp = TranslateTS(def_text); else tmp = text; @@ -525,16 +525,16 @@ RECT GetRect(HDC hdc, RECT rc, const char *text, const char *def_text, Protocol RECT r_tmp = rc; // Only first line - char *tmp2 = _strdup(tmp); - char *pos = strchr(tmp2, '\r'); + TCHAR *tmp2 = _tcsdup(tmp); + TCHAR *pos = _tcschr(tmp2, '\r'); if (pos != NULL) pos[0] = '\0'; - pos = strchr(tmp2, '\n'); + pos = _tcschr(tmp2, '\n'); if (pos != NULL) pos[0] = '\0'; if (smileys) - DRAW_TEXT(hdc, tmp2, strlen(tmp2), &r_tmp, uFormat | DT_CALCRECT, proto->name, NULL); + DRAW_TEXT(hdc, tmp2, _tcslen(tmp2), &r_tmp, uFormat | DT_CALCRECT, proto->name, NULL); else - DrawText(hdc, tmp2, strlen(tmp2), &r_tmp, uFormat | DT_CALCRECT); + DrawText(hdc, tmp2, _tcslen(tmp2), &r_tmp, uFormat | DT_CALCRECT); free(tmp2); @@ -771,7 +771,7 @@ void CalcRectangles(HWND hwnd) } // Fit to image proportions - if (!opts.draw_avatar_allow_to_grow) + if ( !opts.draw_avatar_allow_to_grow) { if (width > bmp.bmWidth) width = bmp.bmWidth; @@ -780,7 +780,7 @@ void CalcRectangles(HWND hwnd) height = bmp.bmHeight; } - if (!opts.resize_frame && height * bmp.bmWidth / bmp.bmHeight <= width) + if ( !opts.resize_frame && height * bmp.bmWidth / bmp.bmHeight <= width) { width = height * bmp.bmWidth / bmp.bmHeight; } @@ -838,7 +838,7 @@ void CalcRectangles(HWND hwnd) tmp_r.right -= 2 * ICON_SIZE; } - data->proto_rect = GetRect(hdc, tmp_r, proto->description, "", proto, uFormat, + data->proto_rect = GetRect(hdc, tmp_r, proto->description, _T(""), proto, uFormat, next_top, tmp_text_left, false, true, false); @@ -906,7 +906,7 @@ void CalcRectangles(HWND hwnd) // Text size RECT r_tmp = r; - DrawText(hdc, proto->status_name, strlen(proto->status_name), &r_tmp, + DrawText(hdc, proto->status_name, _tcslen(proto->status_name), &r_tmp, DT_CALCRECT | (uFormat & ~DT_END_ELLIPSIS)); SIZE s; @@ -1009,7 +1009,7 @@ void CalcRectangles(HWND hwnd) // Text size RECT r_tmp = r; - DrawText(hdc, proto->listening_to, strlen(proto->listening_to), &r_tmp, + DrawText(hdc, proto->listening_to, _tcslen(proto->listening_to), &r_tmp, DT_CALCRECT | (uFormat & ~DT_END_ELLIPSIS)); SIZE s; @@ -1108,23 +1108,23 @@ finish: HBITMAP CreateBitmap32(int cx, int cy) { - BITMAPINFO RGB32BitsBITMAPINFO; - UINT * ptPixels; - HBITMAP DirectBitmap; - - ZeroMemory(&RGB32BitsBITMAPINFO,sizeof(BITMAPINFO)); - RGB32BitsBITMAPINFO.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); - RGB32BitsBITMAPINFO.bmiHeader.biWidth=cx;//bm.bmWidth; - RGB32BitsBITMAPINFO.bmiHeader.biHeight=cy;//bm.bmHeight; - RGB32BitsBITMAPINFO.bmiHeader.biPlanes=1; - RGB32BitsBITMAPINFO.bmiHeader.biBitCount=32; - - DirectBitmap = CreateDIBSection(NULL, - (BITMAPINFO *)&RGB32BitsBITMAPINFO, - DIB_RGB_COLORS, - (void **)&ptPixels, - NULL, 0); - return DirectBitmap; + BITMAPINFO RGB32BitsBITMAPINFO; + UINT * ptPixels; + HBITMAP DirectBitmap; + + ZeroMemory(&RGB32BitsBITMAPINFO,sizeof(BITMAPINFO)); + RGB32BitsBITMAPINFO.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); + RGB32BitsBITMAPINFO.bmiHeader.biWidth=cx;//bm.bmWidth; + RGB32BitsBITMAPINFO.bmiHeader.biHeight=cy;//bm.bmHeight; + RGB32BitsBITMAPINFO.bmiHeader.biPlanes=1; + RGB32BitsBITMAPINFO.bmiHeader.biBitCount=32; + + DirectBitmap = CreateDIBSection(NULL, + (BITMAPINFO *)&RGB32BitsBITMAPINFO, + DIB_RGB_COLORS, + (void **)&ptPixels, + NULL, 0); + return DirectBitmap; } void EraseBackground(HWND hwnd, HDC hdc) @@ -1137,21 +1137,20 @@ HBITMAP CreateBitmap32(int cx, int cy) DeleteObject(hB); } -void DrawTextWithRect(HDC hdc, const char *text, const char *def_text, RECT rc, UINT uFormat, +void DrawTextWithRect(HDC hdc, const TCHAR *text, const TCHAR *def_text, RECT rc, UINT uFormat, bool mouse_over, Protocol *proto, bool replace_smileys = true) { - const char *tmp; - + const TCHAR *tmp; if (text[0] == '\0') - tmp = Translate(def_text); + tmp = TranslateTS(def_text); else tmp = text; // Only first line - char *tmp2 = _strdup(tmp); - char *pos = strchr(tmp2, '\r'); + TCHAR *tmp2 = _tcsdup(tmp); + TCHAR *pos = _tcsrchr(tmp2, '\r'); if (pos != NULL) pos[0] = '\0'; - pos = strchr(tmp2, '\n'); + pos = _tcschr(tmp2, '\n'); if (pos != NULL) pos[0] = '\0'; @@ -1172,7 +1171,7 @@ void DrawTextWithRect(HDC hdc, const char *text, const char *def_text, RECT rc, uFormat &= ~DT_END_ELLIPSIS; rc_tmp = r; - text_height = DrawText(hdc, " ...", 4, &rc_tmp, DT_CALCRECT | uFormat); + text_height = DrawText(hdc, _T(" ..."), 4, &rc_tmp, DT_CALCRECT | uFormat); rc_tmp.top += (r.bottom - r.top - text_height) >> 1; rc_tmp.bottom = rc_tmp.top + text_height; @@ -1193,13 +1192,13 @@ void DrawTextWithRect(HDC hdc, const char *text, const char *def_text, RECT rc, } if (replace_smileys) - DRAW_TEXT(hdc, tmp2, strlen(tmp2), &r, uFormat, proto->name, NULL); + DRAW_TEXT(hdc, tmp2, _tcslen(tmp2), &r, uFormat, proto->name, NULL); else - DrawText(hdc, tmp2, strlen(tmp2), &r, uFormat); + DrawText(hdc, tmp2, _tcslen(tmp2), &r, uFormat); if (mouse_over) { - DrawText(hdc, " ...", 4, &rc_tmp, uFormat); + DrawText(hdc, _T(" ..."), 4, &rc_tmp, uFormat); } SelectClipRgn(hdc, NULL); @@ -1277,7 +1276,6 @@ void Draw(HWND hwnd, HDC hdc_orig) AVATARDRAWREQUEST adr = {0}; - adr.cbSize = sizeof(AVATARDRAWREQUEST); adr.hTargetDC = hdc; adr.rcDraw = data->img_rect; @@ -1361,7 +1359,7 @@ void Draw(HWND hwnd, HDC hdc_orig) SelectObject(hdc, hFont[FONT_PROTO]); SetTextColor(hdc, font_colour[FONT_PROTO]); - DrawText(hdc, proto->description, strlen(proto->description), &rr, uFormat); + DrawText(hdc, proto->description, _tcslen(proto->description), &rr, uFormat); // Clipping rgn SelectClipRgn(hdc, NULL); @@ -1411,7 +1409,7 @@ void Draw(HWND hwnd, HDC hdc_orig) SelectObject(hdc, hFont[FONT_STATUS]); SetTextColor(hdc, font_colour[FONT_STATUS]); - DrawText(hdc, proto->status_name, strlen(proto->status_name), &rc, uFormat); + DrawText(hdc, proto->status_name, _tcslen(proto->status_name), &rc, uFormat); SelectClipRgn(hdc, NULL); DeleteObject(rgn); @@ -1486,7 +1484,7 @@ void Draw(HWND hwnd, HDC hdc_orig) SelectObject(hdc, hFont[FONT_LISTENING_TO]); SetTextColor(hdc, font_colour[FONT_LISTENING_TO]); - DrawText(hdc, proto->listening_to, strlen(proto->listening_to), &rc, uFormat); + DrawText(hdc, proto->listening_to, _tcslen(proto->listening_to), &rc, uFormat); SelectClipRgn(hdc, NULL); DeleteObject(rgn); @@ -1515,7 +1513,7 @@ void MakeHover(HWND hwnd, bool draw, bool *hover, POINT *p, RECT *r) { if (draw && p != NULL && r != NULL && InsideRect(p, r)) { - if (!*hover) + if ( !*hover) { *hover = true; @@ -1574,26 +1572,19 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto mii.cbSize = sizeof(mii); if(!IsWinVer98Plus()) - { mii.fMask = MIIM_TYPE; - } else - { mii.fMask = MIIM_STRING; - } GetMenuItemInfo(menu, i, TRUE, &mii); - if (mii.cch != 0) - { + if (mii.cch != 0) { mii.cch++; - mii.dwTypeData = (char *)malloc(sizeof(char) * mii.cch); + mii.dwTypeData = (TCHAR*)malloc(sizeof(TCHAR) * mii.cch); GetMenuItemInfo(menu, i, TRUE, &mii); - if (strcmp(mii.dwTypeData, proto->description) == 0) - { + if ( _tcscmp(mii.dwTypeData, proto->description) == 0) submenu = GetSubMenu(menu, i); - } free(mii.dwTypeData); } @@ -1607,29 +1598,6 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto if (submenu != NULL) { - /* - // Remove the first itens (protocol name and separator) - int to_remove = 0; - for(; to_remove < 5; to_remove++) - { - MENUITEMINFO mii = {0}; - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_TYPE; - GetMenuItemInfo(submenu, to_remove, TRUE, &mii); - - if (mii.fType == MFT_SEPARATOR) - break; - } - - if (to_remove < 5) - { - submenu = CopyMenu(submenu); - - for(int i = 0; i <= to_remove; i++) - RemoveMenu(submenu, i, MF_BYPOSITION); - } - */ - if (opts.draw_text_align_right) p.x = data->status_rect.right; else @@ -1662,7 +1630,7 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto DWORD flags = CallProtoService(proto->name, PS_GETCAPS, PFLAGNUM_2,0); for ( int i = GetMenuItemCount(submenu) -1 ; i >= 0 ; i-- ) { - if (!(flags & statusModePf2List[i])) + if ( !(flags & statusModePf2List[i])) { // Hide menu RemoveMenu(submenu, i, MF_BYPOSITION); @@ -1693,8 +1661,8 @@ void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, P CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)submenu,0); // Add this proto to menu - char tmp[128]; - mir_snprintf(tmp, sizeof(tmp), Translate("Enable Listening To for %s"), proto->description); + TCHAR tmp[128]; + mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Enable Listening To for %s"), proto->description); MENUITEMINFO mii = {0}; mii.cbSize = sizeof(mii); @@ -1702,10 +1670,10 @@ void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, P mii.fType = MFT_STRING; mii.fState = proto->ListeningToEnabled() ? MFS_CHECKED : 0; mii.dwTypeData = tmp; - mii.cch = strlen(tmp); + mii.cch = _tcslen(tmp); mii.wID = 1; - if (!proto->CanSetListeningTo()) + if ( !proto->CanSetListeningTo()) { mii.fState |= MFS_DISABLED; } @@ -1717,7 +1685,7 @@ void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, P mii.fMask = MIIM_STATE; mii.fState = protocols->ListeningToEnabled() ? MFS_CHECKED : 0; - if (!protocols->CanSetListeningTo()) + if ( !protocols->CanSetListeningTo()) { mii.fState |= MFS_DISABLED; } @@ -1831,7 +1799,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (wParam == ID_FRAME_TIMER) { - if (!data->showing_menu) + if ( !data->showing_menu) CallService(MS_MYDETAILS_SHOWNEXTPROTOCOL, 0, 0); } else if (wParam == ID_RECALC_TIMER) @@ -1936,7 +1904,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = protocols->Get(i)->description; - mii.cch = strlen(protocols->Get(i)->description); + mii.cch = _tcslen(protocols->Get(i)->description); mii.wID = i + 1; if (i == data->protocol_number) @@ -2001,18 +1969,18 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)submenu,0); // Add this proto to menu - char tmp[128]; - mir_snprintf(tmp, sizeof(tmp), Translate("Set My Avatar for %s..."), proto->description); + TCHAR tmp[128]; + mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Avatar for %s..."), proto->description); MENUITEMINFO mii = {0}; mii.cbSize = sizeof(mii); mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = tmp; - mii.cch = strlen(tmp); + mii.cch = _tcslen(tmp); mii.wID = 1; - if (!proto->CanSetAvatar()) + if ( !proto->CanSetAvatar()) { mii.fMask |= MIIM_STATE; mii.fState = MFS_DISABLED; @@ -2047,18 +2015,18 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)submenu,0); // Add this proto to menu - char tmp[128]; - mir_snprintf(tmp, sizeof(tmp), Translate("Set My Nickname for %s..."), proto->description); + TCHAR tmp[128]; + mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Nickname for %s..."), proto->description); MENUITEMINFO mii = {0}; mii.cbSize = sizeof(mii); mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = tmp; - mii.cch = strlen(tmp); + mii.cch = _tcslen(tmp); mii.wID = 1; - if (!proto->CanSetNick()) + if ( !proto->CanSetNick()) { mii.fMask |= MIIM_STATE; mii.fState = MFS_DISABLED; @@ -2097,7 +2065,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar // In status message? else if (data->draw_away_msg && InsideRect(&p, &data->away_msg_rect)) { - char tmp[128]; + TCHAR tmp[128]; HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1)); HMENU submenu = GetSubMenu(menu, 3); @@ -2106,18 +2074,17 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (protocols->CanSetStatusMsgPerProtocol()) { // Add this proto to menu - mir_snprintf(tmp, sizeof(tmp), Translate("Set My Status Message for %s..."), - proto->description); + mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Status Message for %s..."), proto->description); MENUITEMINFO mii = {0}; mii.cbSize = sizeof(mii); mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = tmp; - mii.cch = strlen(tmp); + mii.cch = _tcslen(tmp); mii.wID = 1; - if (!proto->CanSetStatusMsg()) + if ( !proto->CanSetStatusMsg()) { mii.fMask |= MIIM_STATE; mii.fState = MFS_DISABLED; @@ -2128,7 +2095,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar { // Add this to menu - mir_snprintf(tmp, sizeof(tmp), Translate("Set My Status Message for %s..."), + mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Status Message for %s..."), CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, proto->status, 0)); MENUITEMINFO mii = {0}; @@ -2136,7 +2103,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = tmp; - mii.cch = strlen(tmp); + mii.cch = _tcslen(tmp); mii.wID = 2; if (proto->status == ID_STATUS_OFFLINE) @@ -2202,10 +2169,10 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar RemoveMenu(submenu, ID_DONT_CYCLE_THROUGH_PROTOS, MF_BYCOMMAND); // Add this proto to menu - char tmp[128]; + TCHAR tmp[128]; MENUITEMINFO mii = {0}; - mir_snprintf(tmp, sizeof(tmp), Translate("Enable Listening To for %s"), proto->description); + mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Enable Listening To for %s"), proto->description); ZeroMemory(&mii, sizeof(mii)); mii.cbSize = sizeof(mii); @@ -2213,10 +2180,10 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fType = MFT_STRING; mii.fState = proto->ListeningToEnabled() ? MFS_CHECKED : 0; mii.dwTypeData = tmp; - mii.cch = strlen(tmp); + mii.cch = _tcslen(tmp); mii.wID = 5; - if (!proto->CanSetListeningTo()) + if ( !proto->CanSetListeningTo()) { mii.fState |= MFS_DISABLED; } @@ -2224,7 +2191,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar InsertMenuItem(submenu, 0, TRUE, &mii); // Add this to menu - mir_snprintf(tmp, sizeof(tmp), Translate("Set My Status Message for %s..."), + mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Status Message for %s..."), CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, proto->status, 0)); ZeroMemory(&mii, sizeof(mii)); @@ -2232,11 +2199,10 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = tmp; - mii.cch = strlen(tmp); + mii.cch = _tcslen(tmp); mii.wID = 4; - if (proto->status == ID_STATUS_OFFLINE) - { + if (proto->status == ID_STATUS_OFFLINE) { mii.fMask |= MIIM_STATE; mii.fState = MFS_DISABLED; } @@ -2246,17 +2212,17 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (protocols->CanSetStatusMsgPerProtocol()) { // Add this proto to menu - mir_snprintf(tmp, sizeof(tmp), Translate("Set My Status Message for %s..."), proto->description); + mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Status Message for %s..."), proto->description); ZeroMemory(&mii, sizeof(mii)); mii.cbSize = sizeof(mii); mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = tmp; - mii.cch = strlen(tmp); + mii.cch = _tcslen(tmp); mii.wID = 3; - if (!proto->CanSetStatusMsg()) + if ( !proto->CanSetStatusMsg()) { mii.fMask |= MIIM_STATE; mii.fState = MFS_DISABLED; @@ -2265,17 +2231,17 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar InsertMenuItem(submenu, 0, TRUE, &mii); } - mir_snprintf(tmp, sizeof(tmp), Translate("Set My Nickname for %s..."), proto->description); + mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Nickname for %s..."), proto->description); ZeroMemory(&mii, sizeof(mii)); mii.cbSize = sizeof(mii); mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = tmp; - mii.cch = strlen(tmp); + mii.cch = _tcslen(tmp); mii.wID = 2; - if (!proto->CanSetNick()) + if ( !proto->CanSetNick()) { mii.fMask |= MIIM_STATE; mii.fState = MFS_DISABLED; @@ -2283,17 +2249,17 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar InsertMenuItem(submenu, 0, TRUE, &mii); - mir_snprintf(tmp, sizeof(tmp), Translate("Set My Avatar for %s..."), proto->description); + mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Avatar for %s..."), proto->description); ZeroMemory(&mii, sizeof(mii)); mii.cbSize = sizeof(mii); mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = tmp; - mii.cch = strlen(tmp); + mii.cch = _tcslen(tmp); mii.wID = 1; - if (!proto->CanSetAvatar()) + if ( !proto->CanSetAvatar()) { mii.fMask |= MIIM_STATE; mii.fState = MFS_DISABLED; @@ -2306,7 +2272,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fMask = MIIM_STATE; mii.fState = protocols->ListeningToEnabled() ? MFS_CHECKED : 0; - if (!protocols->CanSetListeningTo()) + if ( !protocols->CanSetListeningTo()) { mii.fState |= MFS_DISABLED; } @@ -2608,7 +2574,7 @@ int ShowFrameFunc(WPARAM wParam, LPARAM lParam) } else { - if (!MyDetailsFrameVisible()) + if ( !MyDetailsFrameVisible()) { ShowWindow(hwnd_container, SW_SHOW); DBWriteContactSettingByte(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 1); @@ -2794,7 +2760,7 @@ int PluginCommand_ShowProtocol(WPARAM wParam,LPARAM lParam) if (proto == NULL) return -1; - for(int i = 0 ; i < protocols->GetSize() ; i++) + for (int i = 0 ; i < protocols->GetSize() ; i++) { if (_stricmp(protocols->Get(i)->name, proto) == 0) { @@ -2834,13 +2800,13 @@ int SettingsChangedHook(WPARAM wParam, LPARAM lParam) { Protocol *proto = protocols->Get((const char *) cws->szModule); - if (!strcmp(cws->szSetting,"Status") + if ( !strcmp(cws->szSetting,"Status") || ( proto != NULL && proto->custom_status != 0 && proto->custom_status_name != NULL - && !strcmp(cws->szSetting, proto->custom_status_name) ) + && !strcmp(cws->szSetting, _T2A(proto->custom_status_name))) || ( proto != NULL && proto->custom_status != 0 && proto->custom_status_message != NULL - && !strcmp(cws->szSetting, proto->custom_status_message) )) + && !strcmp(cws->szSetting, _T2A(proto->custom_status_message)))) { // Status changed if (proto != NULL) diff --git a/plugins/MyDetails/mydetails.cpp b/plugins/MyDetails/mydetails.cpp index f990f6e129..83007d10dc 100644 --- a/plugins/MyDetails/mydetails.cpp +++ b/plugins/MyDetails/mydetails.cpp @@ -19,7 +19,6 @@ Boston, MA 02111-1307, USA. #include "commons.h" -#include "mydetails.h" // Prototypes ///////////////////////////////////////////////////////////////////////////////////// @@ -39,9 +38,6 @@ PLUGININFOEX pluginInfo={ { 0xa82baeb3, 0xa33c, 0x4036, { 0xb8, 0x37, 0x78, 0x3, 0xa5, 0xb6, 0xc2, 0xab } } // {A82BAEB3-A33C-4036-B837-7803A5B6C2AB} }; - -HANDLE hTTB = NULL; - // Hooks HANDLE hModulesLoadedHook = NULL; HANDLE hPreShutdownHook = NULL; @@ -52,12 +48,10 @@ HWND hwndSetNickname; long status_msg_dialog_open; HWND hwndSetStatusMsg; - // Hook called after init static int MainInit(WPARAM wparam,LPARAM lparam); static int MainUninit(WPARAM wParam, LPARAM lParam); - // Services static int PluginCommand_SetMyNicknameUI(WPARAM wParam,LPARAM lParam); static int PluginCommand_SetMyNickname(WPARAM wParam,LPARAM lParam); @@ -69,8 +63,6 @@ static int PluginCommand_SetMyStatusMessageUI(WPARAM wParam,LPARAM lParam); static int PluginCommand_CicleThroughtProtocols(WPARAM wParam,LPARAM lParam); - - // Functions ////////////////////////////////////////////////////////////////////////////////////// @@ -165,9 +157,9 @@ static int MainInit(WPARAM wparam,LPARAM lparam) mi.cbSize = sizeof(mi); mi.flags = 0; mi.popupPosition = 500050000; - mi.pszPopupName = Translate("My Details"); + mi.pszPopupName = LPGEN("My Details"); mi.position = 100001; - mi.pszName = Translate("Set My Avatar..."); + mi.pszName = LPGEN("Set My Avatar..."); CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYAVATARUI, Menu_SetMyAvatarUI); mi.pszService = "MENU_" MS_MYDETAILS_SETMYAVATARUI; Menu_AddMainMenuItem(&mi); @@ -177,9 +169,9 @@ static int MainInit(WPARAM wparam,LPARAM lparam) mi.cbSize = sizeof(mi); mi.flags = 0; mi.popupPosition = 500050000; - mi.pszPopupName = Translate("My Details"); + mi.pszPopupName = LPGEN("My Details"); mi.position = 100002; - mi.pszName = Translate("Set My Nickname..."); + mi.pszName = LPGEN("Set My Nickname..."); CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYNICKNAMEUI, Menu_SetMyNicknameUI); mi.pszService = "MENU_" MS_MYDETAILS_SETMYNICKNAMEUI; Menu_AddMainMenuItem(&mi); @@ -188,9 +180,9 @@ static int MainInit(WPARAM wparam,LPARAM lparam) mi.cbSize = sizeof(mi); mi.flags = 0; mi.popupPosition = 500050000; - mi.pszPopupName = Translate("My Details"); + mi.pszPopupName = LPGEN("My Details"); mi.position = 100003; - mi.pszName = Translate("Set My Status Message..."); + mi.pszName = LPGEN("Set My Status Message..."); CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYSTATUSMESSAGEUI, Menu_SetMyStatusMessageUI); mi.pszService = "MENU_" MS_MYDETAILS_SETMYSTATUSMESSAGEUI; Menu_AddMainMenuItem(&mi); @@ -200,9 +192,9 @@ static int MainInit(WPARAM wparam,LPARAM lparam) mi.cbSize = sizeof(mi); mi.flags = 0; mi.popupPosition = 500050000; - mi.pszPopupName = Translate("My Details"); + mi.pszPopupName = LPGEN("My Details"); mi.position = 200001; - mi.pszName = Translate("Show next protocol"); + mi.pszName = LPGEN("Show next protocol"); mi.pszService = MS_MYDETAILS_SHOWNEXTPROTOCOL; Menu_AddMainMenuItem(&mi); @@ -268,30 +260,24 @@ static BOOL CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam, L SetWindowLong(hwndDlg, GWL_USERDATA, proto_num); - if (proto_num == -1) - { + if (proto_num == -1) { SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_MIRANDA)); // All protos have the same nick? - if (protocols->GetSize() > 0) - { - char *nick = protocols->Get(0)->nickname; + if (protocols->GetSize() > 0) { + TCHAR *nick = protocols->Get(0)->nickname; bool foundDefNick = true; - for(int i = 1 ; foundDefNick && i < protocols->GetSize() ; i++) - { - if (_stricmp(protocols->Get(i)->nickname, nick) != 0) - { + for (int i=1 ; foundDefNick && i < protocols->GetSize() ; i++) { + if (_tcsicmp(protocols->Get(i)->nickname, nick) != 0) { foundDefNick = false; break; } } if (foundDefNick) - { - if (_stricmp(protocols->default_nick, nick) != 0) + if ( _tcsicmp(protocols->default_nick, nick) != 0) lstrcpy(protocols->default_nick, nick); - } } SetDlgItemText(hwndDlg, IDC_NICKNAME, protocols->default_nick); @@ -322,31 +308,24 @@ static BOOL CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam, L } case WM_COMMAND: - switch(wParam) + switch(wParam) { + case IDOK: { - case IDOK: - { - char tmp[MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE]; - GetDlgItemText(hwndDlg, IDC_NICKNAME, tmp, sizeof(tmp)); + TCHAR tmp[MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE]; + GetDlgItemText(hwndDlg, IDC_NICKNAME, tmp, SIZEOF(tmp)); - int proto_num = (int)GetWindowLong(hwndDlg, GWL_USERDATA); - if (proto_num == -1) - { - protocols->SetNicks(tmp); - } - else - { - protocols->Get(proto_num)->SetNick(tmp); - } + int proto_num = (int)GetWindowLong(hwndDlg, GWL_USERDATA); + if (proto_num == -1) + protocols->SetNicks(tmp); + else + protocols->Get(proto_num)->SetNick(tmp); - DestroyWindow(hwndDlg); - break; - } - case IDCANCEL: - { - DestroyWindow(hwndDlg); - break; - } + DestroyWindow(hwndDlg); + break; + } + case IDCANCEL: + DestroyWindow(hwndDlg); + break; } break; @@ -370,7 +349,7 @@ static int PluginCommand_SetMyNicknameUI(WPARAM wParam,LPARAM lParam) if (proto != NULL) { int i; - for(i = 0 ; i < protocols->GetSize() ; i++) + for (i = 0 ; i < protocols->GetSize() ; i++) { if (_stricmp(protocols->Get(i)->name, proto) == 0) { @@ -382,12 +361,12 @@ static int PluginCommand_SetMyNicknameUI(WPARAM wParam,LPARAM lParam) if (proto_num == -1) return -1; - if (!protocols->Get(i)->CanSetNick()) + if ( !protocols->Get(i)->CanSetNick()) return -2; } - if (!nickname_dialog_open) + if ( !nickname_dialog_open) { InterlockedExchange(&nickname_dialog_open, 1); @@ -403,50 +382,36 @@ static int PluginCommand_SetMyNicknameUI(WPARAM wParam,LPARAM lParam) return 0; } - static int PluginCommand_SetMyNickname(WPARAM wParam,LPARAM lParam) { char * proto = (char *)wParam; - - if (proto != NULL) - { - for(int i = 0 ; i < protocols->GetSize() ; i++) - { - if (_stricmp(protocols->Get(i)->name, proto) == 0) - { - if (!protocols->Get(i)->CanSetNick()) - { + if (proto != NULL) { + for (int i = 0 ; i < protocols->GetSize() ; i++) { + if (_stricmp(protocols->Get(i)->name, proto) == 0) { + if ( !protocols->Get(i)->CanSetNick()) return -2; - } - else - { - protocols->Get(i)->SetNick((char *)lParam); - return 0; - } + + protocols->Get(i)->SetNick((TCHAR*)lParam); + return 0; } } return -1; } - else - { - protocols->SetNicks((char *)lParam); - return 0; - } + protocols->SetNicks((TCHAR*)lParam); + return 0; } - static int PluginCommand_GetMyNickname(WPARAM wParam,LPARAM lParam) { - char * ret = (char *)lParam; + TCHAR* ret = (TCHAR*)lParam; char * proto = (char *)wParam; if (ret == NULL) return -1; - if (proto == NULL) - { + if (proto == NULL) { if (protocols->default_nick != NULL) lstrcpyn(ret, protocols->default_nick, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE); else @@ -479,7 +444,7 @@ static int PluginCommand_SetMyAvatarUI(WPARAM wParam,LPARAM lParam) if (proto != NULL) { int i; - for(i = 0 ; i < protocols->GetSize() ; i++) + for (i = 0 ; i < protocols->GetSize() ; i++) { if (_stricmp(protocols->Get(i)->name, proto) == 0) { @@ -491,7 +456,7 @@ static int PluginCommand_SetMyAvatarUI(WPARAM wParam,LPARAM lParam) if (proto_num == -1) return -1; - if (!protocols->Get(i)->CanSetAvatar()) + if ( !protocols->Get(i)->CanSetAvatar()) { return -2; } @@ -509,42 +474,27 @@ static int PluginCommand_SetMyAvatarUI(WPARAM wParam,LPARAM lParam) return 0; } - static int PluginCommand_SetMyAvatar(WPARAM wParam,LPARAM lParam) { char * proto = (char *)wParam; - - if (proto != NULL) - { - for(int i = 0 ; i < protocols->GetSize() ; i++) - { - if (_stricmp(protocols->Get(i)->name, proto) == 0) - { - if (!protocols->Get(i)->CanSetAvatar()) - { + if (proto != NULL) { + for (int i = 0 ; i < protocols->GetSize() ; i++) { + if (_stricmp(protocols->Get(i)->name, proto) == 0) { + if ( !protocols->Get(i)->CanSetAvatar()) return -2; - } - else - { - protocols->Get(i)->SetAvatar((char *)lParam); - return 0; - } + + protocols->Get(i)->SetAvatar((TCHAR*)lParam); + return 0; } } return -1; } - else - { - protocols->SetAvatars((char *)lParam); - - return 0; - } + protocols->SetAvatars((TCHAR*)lParam); return 0; } - int Status2SkinIcon(int status) { switch(status) { @@ -567,14 +517,13 @@ int Status2SkinIcon(int status) static int PluginCommand_GetMyAvatar(WPARAM wParam,LPARAM lParam) { - char * ret = (char *)lParam; + TCHAR* ret = (TCHAR*)lParam; char * proto = (char *)wParam; if (ret == NULL) return -1; - if (proto == NULL) - { + if (proto == NULL) { if (protocols->default_avatar_file != NULL) lstrcpyn(ret, protocols->default_avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE); else @@ -582,28 +531,20 @@ static int PluginCommand_GetMyAvatar(WPARAM wParam,LPARAM lParam) return 0; } - else - { - for(int i = 0 ; i < protocols->GetSize() ; i++) - { - if (_stricmp(protocols->Get(i)->name, proto) == 0) - { - if (!protocols->Get(i)->CanGetAvatar()) - { - return -2; - } - else - { - protocols->Get(i)->GetAvatar(); + + for (int i = 0 ; i < protocols->GetSize() ; i++) { + if (_stricmp(protocols->Get(i)->name, proto) == 0) { + if ( !protocols->Get(i)->CanGetAvatar()) + return -2; - if (protocols->Get(i)->avatar_file != NULL) - lstrcpyn(ret, protocols->Get(i)->avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE); - else - ret[0] = '\0'; + protocols->Get(i)->GetAvatar(); - return 0; - } - } + if (protocols->Get(i)->avatar_file != NULL) + lstrcpyn(ret, protocols->Get(i)->avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE); + else + ret[0] = '\0'; + + return 0; } } @@ -701,7 +642,7 @@ static BOOL CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM wPar { case IDOK: { - char tmp[MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE]; + TCHAR tmp[MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE]; GetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, tmp, sizeof(tmp)); SetStatusMessageData *data = (SetStatusMessageData *) GetWindowLong(hwndDlg, GWL_USERDATA); @@ -745,14 +686,13 @@ static int PluginCommand_SetMyStatusMessageUI(WPARAM wParam,LPARAM lParam) char * proto_name = (char *)lParam; int proto_num = -1; Protocol *proto = NULL; - TCHAR status_message[256]; if (status != 0 && (status < ID_STATUS_OFFLINE || status > ID_STATUS_OUTTOLUNCH)) return -10; if (proto_name != NULL) { - for(int i = 0 ; i < protocols->GetSize() ; i++) + for (int i = 0 ; i < protocols->GetSize() ; i++) { proto = protocols->Get(i); @@ -771,93 +711,6 @@ static int PluginCommand_SetMyStatusMessageUI(WPARAM wParam,LPARAM lParam) return -2; } } - - if (ServiceExists(MS_NAS_INVOKESTATUSWINDOW)) - { - NAS_ISWINFO iswi; - - ZeroMemory(&iswi, sizeof(iswi)); - - iswi.cbSize = sizeof(NAS_ISWINFO); - - if (proto != NULL) - { - // Has to get the unparsed message - NAS_PROTOINFO pi; - - ZeroMemory(&pi, sizeof(pi)); - pi.cbSize = sizeof(NAS_PROTOINFO); - pi.szProto = proto->name; - pi.status = status; - pi.szMsg = NULL; - - if (ServiceExists(MS_NAS_GETSTATE)) - { - if (CallService(MS_NAS_GETSTATE, (WPARAM) &pi, 1) == 0) - { - if (pi.szMsg == NULL) - { - pi.szProto = NULL; - - if (CallService(MS_NAS_GETSTATE, (WPARAM) &pi, 1) == 0) - { - if (pi.szMsg != NULL) - { - lstrcpyn(status_message, pi.szMsg, MAX_REGS(status_message)); - mir_free(pi.szMsg); - } - } - } - else // if (pi.szMsg != NULL) - { - lstrcpyn(status_message, pi.szMsg, MAX_REGS(status_message)); - mir_free(pi.szMsg); - } - } - } - // TODO: Remove when removing old NAS services support - else - { - NAS_PROTOINFO *pii = π - - // Old services - if (CallService("NewAwaySystem/GetState", (WPARAM) &pii, 1) == 0) - { - if (pi.szMsg == NULL) - { - pi.szProto = NULL; - - if (CallService("NewAwaySystem/GetState", (WPARAM) &pii, 1) == 0) - { - if (pi.szMsg != NULL) - { - lstrcpyn(status_message, pi.szMsg, MAX_REGS(status_message)); - mir_free(pi.szMsg); - } - } - } - else // if (pi.szMsg != NULL) - { - lstrcpyn(status_message, pi.szMsg, MAX_REGS(status_message)); - mir_free(pi.szMsg); - } - } - } - - iswi.szProto = proto->name; - iswi.szMsg = status_message; - } - else - { - iswi.szMsg = protocols->GetDefaultStatusMsg(); - } - - iswi.Flags = ISWF_NOCOUNTDOWN; - - CallService(MS_NAS_INVOKESTATUSWINDOW, (WPARAM) &iswi, 0); - - return 0; - } else if (ServiceExists(MS_SA_CHANGESTATUSMSG)) { if (proto == NULL && status == 0) @@ -877,7 +730,7 @@ static int PluginCommand_SetMyStatusMessageUI(WPARAM wParam,LPARAM lParam) } else if (proto == NULL || proto->status != ID_STATUS_OFFLINE) { - if (!status_msg_dialog_open) + if ( !status_msg_dialog_open) { InterlockedExchange(&status_msg_dialog_open, 1); diff --git a/plugins/MyDetails/mydetails.h b/plugins/MyDetails/mydetails.h deleted file mode 100644 index dd2d8050d3..0000000000 --- a/plugins/MyDetails/mydetails.h +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright (C) 2005 Ricardo Pescuma Domenecci - -This is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -This is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with this file; see the file license.txt. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. -*/ - - -#ifndef __MYDETAILS_H__ -#define __MYDETAILS_H__ - - -#endif // __MYDETAILS_H__ \ No newline at end of file diff --git a/plugins/MyDetails/mydetails.vcxproj b/plugins/MyDetails/mydetails.vcxproj index 2377f6d5d8..0a2a0696a2 100644 --- a/plugins/MyDetails/mydetails.vcxproj +++ b/plugins/MyDetails/mydetails.vcxproj @@ -134,7 +134,7 @@ OnlyExplicitInline Size ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;MYDETAILS_EXPORTS;%(PreprocessorDefinitions) + WIN64;NDEBUG;_WINDOWS;_USRDLL;MYDETAILS_EXPORTS;%(PreprocessorDefinitions) true MultiThreadedDLL true @@ -211,7 +211,7 @@ Disabled ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;MYDETAILS_EXPORTS;%(PreprocessorDefinitions) + WIN64;_DEBUG;_WINDOWS;_USRDLL;MYDETAILS_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL true @@ -258,8 +258,6 @@ Disabled %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS - WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS EnableFastChecks EnableFastChecks true @@ -268,16 +266,12 @@ MaxSpeed %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS - WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS Disabled Disabled %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS - WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS EnableFastChecks EnableFastChecks true @@ -286,16 +280,12 @@ MaxSpeed %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS - WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS Disabled Disabled %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS - WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS EnableFastChecks EnableFastChecks NotUsing @@ -306,8 +296,6 @@ MaxSpeed %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS - WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS NotUsing NotUsing @@ -316,8 +304,6 @@ Disabled %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS - WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS EnableFastChecks EnableFastChecks NotUsing @@ -328,8 +314,6 @@ MaxSpeed %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS - WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS NotUsing NotUsing @@ -338,8 +322,6 @@ Disabled %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS - WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS EnableFastChecks EnableFastChecks Create @@ -350,8 +332,6 @@ MaxSpeed %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS - WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS Create Create @@ -360,8 +340,6 @@ Disabled %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS - WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS EnableFastChecks EnableFastChecks true @@ -370,8 +348,6 @@ MaxSpeed %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS - WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;MYDETAILS_EXPORTS @@ -385,7 +361,6 @@ - diff --git a/plugins/MyDetails/mydetails.vcxproj.filters b/plugins/MyDetails/mydetails.vcxproj.filters index 70834e293a..1b4ed68251 100644 --- a/plugins/MyDetails/mydetails.vcxproj.filters +++ b/plugins/MyDetails/mydetails.vcxproj.filters @@ -64,9 +64,6 @@ Header Files - - Header Files - Header Files diff --git a/plugins/MyDetails/options.cpp b/plugins/MyDetails/options.cpp index 05d38aa6cc..e879e078b7 100644 --- a/plugins/MyDetails/options.cpp +++ b/plugins/MyDetails/options.cpp @@ -70,7 +70,7 @@ static OptPageControl pageControls[] = { // Initializations needed by options void LoadOptions() { - LoadOpts(pageControls, MAX_REGS(pageControls), MODULE_NAME); + LoadOpts(pageControls, SIZEOF(pageControls), MODULE_NAME); // This is created here to assert that this key always exists opts.refresh_status_message_timer = DBGetContactSettingWord(NULL,"MyDetails","RefreshStatusMessageTimer",12); @@ -88,7 +88,7 @@ int InitOptionsCallback(WPARAM wParam,LPARAM lParam) odp.position = -200000000; odp.hInstance = hInst; odp.pfnDlgProc = DlgProcOpts; - odp.pszTemplate = MAKEINTRESOURCE(IDD_OPTS); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTS); odp.pszGroup = LPGEN("Customize"); odp.pszTitle = LPGEN("My Details"); odp.flags = ODPF_BOLDGROUPS; @@ -112,7 +112,7 @@ void DeInitOptions() static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - BOOL ret = SaveOptsDlgProc(pageControls, MAX_REGS(pageControls), MODULE_NAME, hwndDlg, msg, wParam, lParam); + BOOL ret = SaveOptsDlgProc(pageControls, SIZEOF(pageControls), MODULE_NAME, hwndDlg, msg, wParam, lParam); switch (msg) { @@ -133,13 +133,13 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l { EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_CYCLE_PROTO_BUTTON),FALSE); } - if (!ServiceExists(MS_SMILEYADD_BATCHPARSE)) + if ( !ServiceExists(MS_SMILEYADD_BATCHPARSE)) { EnableWindow(GetDlgItem(hwndDlg,IDC_REPLACE_SMILEYS),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_USE_CONTACT_LIST_SMILEYS),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_RESIZE_SMILEYS),FALSE); } - if (!ServiceExists(MS_CLIST_FRAMES_SETFRAMEOPTIONS)) + if ( !ServiceExists(MS_CLIST_FRAMES_SETFRAMEOPTIONS)) { EnableWindow(GetDlgItem(hwndDlg,IDC_RESIZE_FRAME),FALSE); } -- cgit v1.2.3