summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Clist_modern/modern_clc.cpp24
-rw-r--r--plugins/Clist_mw/clistmod.cpp8
-rw-r--r--plugins/NewAwaySysMod/ReadAwayMsg.cpp2
-rw-r--r--plugins/NewXstatusNotify/popup.cpp95
-rw-r--r--plugins/SimpleStatusMsg/awaymsg.cpp61
-rw-r--r--plugins/TipperYM/message_pump.cpp136
6 files changed, 127 insertions, 199 deletions
diff --git a/plugins/Clist_modern/modern_clc.cpp b/plugins/Clist_modern/modern_clc.cpp
index bc7a5a4f66..aeb301a8d5 100644
--- a/plugins/Clist_modern/modern_clc.cpp
+++ b/plugins/Clist_modern/modern_clc.cpp
@@ -2055,28 +2055,8 @@ int ClcDoProtoAck(HANDLE wParam,ACKDATA * ack)
if(ModernGetSettingByte(ack->hContact, ack->szModule, "ChatRoom", 0) != 0) return 0;
}
- {
- DBVARIANT dbv={0};
- BOOL bUnicode = (!ModernGetSetting(ack->hContact, "CList", "StatusMsg", &dbv) && (dbv.type !=DBVT_ASCIIZ) );
- ModernDBFreeVariant(&dbv);
- if (!bUnicode)
- {
- char * val= ModernGetStringA(ack->hContact,"CList","StatusMsg");
- if (val)
- {
- if (!mir_bool_strcmpi(val,(const char *)ack->lParam))
- ModernWriteSettingString(ack->hContact,"CList","StatusMsg",(const char *)ack->lParam);
- else
- gtaRenewText(ack->hContact);
- mir_free_and_nill(val);
- }
- else
- ModernWriteSettingString(ack->hContact,"CList","StatusMsg",(const char *)ack->lParam);
-
- //pcli->pfnClcBroadcast( INTM_STATUSMSGCHANGED,(WPARAM)ack->hContact,(LPARAM)ack->lParam);
- }
- gtaRenewText(ack->hContact);
- }
+ ModernWriteSettingTString(ack->hContact,"CList","StatusMsg",(const TCHAR *)ack->lParam);
+ gtaRenewText(ack->hContact);
}
else
{
diff --git a/plugins/Clist_mw/clistmod.cpp b/plugins/Clist_mw/clistmod.cpp
index 6551c8d03e..5f769427f8 100644
--- a/plugins/Clist_mw/clistmod.cpp
+++ b/plugins/Clist_mw/clistmod.cpp
@@ -66,7 +66,7 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact)
if (ServiceExists(AdvancedService))
result = CallService(AdvancedService,(WPARAM)hActContact, (LPARAM)0);
- if (result == -1 || !(LOWORD(result)))
+ if (result == -1 || !(LOWORD(result)))
// result == -1 means no Advanced icon. LOWORD(result) == 0 happens when Advanced icon returned by ICQ (i.e. no transpot)
result = saveIconFromStatusMode(szActProto,nActStatus,NULL);
}
@@ -101,15 +101,15 @@ static int ProtocolAck(WPARAM wParam,LPARAM lParam)
ACKDATA *ack = (ACKDATA*)lParam;
if (ack->type == ACKTYPE_AWAYMSG && ack->lParam) {
DBVARIANT dbv;
- if (!DBGetContactSettingString(ack->hContact, "CList", "StatusMsg", &dbv)) {
- if (!strcmp(dbv.pszVal, (char *)ack->lParam)) {
+ if (!DBGetContactSettingTString(ack->hContact, "CList", "StatusMsg", &dbv)) {
+ if ( !_tcscmp(dbv.ptszVal, (TCHAR *)ack->lParam)) {
DBFreeVariant(&dbv);
return 0;
}
DBFreeVariant(&dbv);
}
if ( DBGetContactSettingByte(NULL,"CList","ShowStatusMsg",0) || DBGetContactSettingByte(ack->hContact,"CList","StatusMsgAuto",0))
- DBWriteContactSettingString(ack->hContact, "CList", "StatusMsg", (char *)ack->lParam);
+ DBWriteContactSettingTString(ack->hContact, "CList", "StatusMsg", (TCHAR *)ack->lParam);
}
return 0;
diff --git a/plugins/NewAwaySysMod/ReadAwayMsg.cpp b/plugins/NewAwaySysMod/ReadAwayMsg.cpp
index f0b6c46706..6d197b7614 100644
--- a/plugins/NewAwaySysMod/ReadAwayMsg.cpp
+++ b/plugins/NewAwaySysMod/ReadAwayMsg.cpp
@@ -93,7 +93,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
UnhookEvent(awayData->hAwayMsgEvent);
awayData->hAwayMsgEvent = NULL;
}
- SetDlgItemTextA(hwndDlg, IDC_READAWAYMSG_MSG, (const char*)ack->lParam);
+ SetDlgItemText(hwndDlg, IDC_READAWAYMSG_MSG, (const TCHAR*)ack->lParam);
ShowWindow(GetDlgItem(hwndDlg, IDC_READAWAYMSG_RETRIEVE), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_READAWAYMSG_MSG), SW_SHOW);
SetDlgItemText(hwndDlg, IDOK, TranslateT("&Close"));
diff --git a/plugins/NewXstatusNotify/popup.cpp b/plugins/NewXstatusNotify/popup.cpp
index 761ec3578f..c62b061b94 100644
--- a/plugins/NewXstatusNotify/popup.cpp
+++ b/plugins/NewXstatusNotify/popup.cpp
@@ -26,14 +26,14 @@
extern OPTIONS opt;
-void QueryAwayMessage(HWND hWnd, PLUGINDATA *pdp)
+void QueryAwayMessage(HWND hWnd, PLUGINDATA *pdp)
{
HANDLE hContact = PUGetContact(hWnd);
char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if (szProto)
+ if (szProto)
{
if ((CallProtoService(szProto, PS_GETCAPS,PFLAGNUM_1, 0) & PF1_MODEMSGRECV) &&
- (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(pdp->newStatus)))
+ (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(pdp->newStatus)))
{
//The following HookEventMessage will hook the ME_PROTO_ACK event and send a WM_AWAYMSG to hWnd when the hooks get notified.
pdp->hAwayMsgHook = HookEventMessage(ME_PROTO_ACK, hWnd, WM_AWAYMSG);
@@ -43,46 +43,38 @@ void QueryAwayMessage(HWND hWnd, PLUGINDATA *pdp)
}
}
-void ReceivedAwayMessage(HWND hWnd, LPARAM lParam, PLUGINDATA * pdp)
+void ReceivedAwayMessage(HWND hWnd, LPARAM lParam, PLUGINDATA * pdp)
{
- HANDLE hContact = PUGetContact(hWnd);
ACKDATA *ack = (ACKDATA *)lParam;
-
- if (ack->type != ACKTYPE_AWAYMSG)
+ if (ack->type != ACKTYPE_AWAYMSG || ack->hProcess != pdp->hAwayMsgProcess)
return;
- if (ack->hProcess == pdp->hAwayMsgProcess) //It's my hProcess, so it's ok to continue.
- {
- //The first thing we go is removing the hook from the chain to avoid useless calls.
- UnhookEvent(pdp->hAwayMsgHook);
- pdp->hAwayMsgHook = NULL;
+ //The first thing we go is removing the hook from the chain to avoid useless calls.
+ UnhookEvent(pdp->hAwayMsgHook);
+ pdp->hAwayMsgHook = NULL;
- if (ack->result != ACKRESULT_SUCCESS)
- return;
+ if (ack->result != ACKRESULT_SUCCESS)
+ return;
- DBVARIANT dbv;
- TCHAR stzText[MAX_SECONDLINE];
+ DBVARIANT dbv;
+ HANDLE hContact = PUGetContact(hWnd);
- if (!DBGetContactSettingTString(hContact, MODULE, "LastPopupText", &dbv))
- {
- _tcscpy(stzText, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ if ( DBGetContactSettingTString(hContact, MODULE, "LastPopupText", &dbv))
+ return;
- if (!DBGetContactSettingTString(ack->hContact, "CList", "StatusMsg", &dbv))
- {
- if (dbv.ptszVal && dbv.ptszVal[0])
- {
- if (stzText[0]) _tcscat(stzText, _T("\n"));
- _tcscat(stzText, dbv.ptszVal);
- SendMessage(hWnd, WM_SETREDRAW, FALSE, 0);
- PUChangeTextT(hWnd, stzText);
- SendMessage(hWnd, WM_SETREDRAW, TRUE, 0);
- }
- DBFreeVariant(&dbv);
- }
+ TCHAR stzText[MAX_SECONDLINE], *tszStatus = (TCHAR*)ack->lParam;
+ _tcscpy(stzText, dbv.ptszVal);
+ DBFreeVariant(&dbv);
- }
- }
+ if (tszStatus == NULL || *tszStatus == 0)
+ return;
+
+ if (stzText[0])
+ _tcscat(stzText, _T("\n"));
+ _tcscat(stzText, tszStatus);
+ SendMessage(hWnd, WM_SETREDRAW, FALSE, 0);
+ PUChangeTextT(hWnd, stzText);
+ SendMessage(hWnd, WM_SETREDRAW, TRUE, 0);
}
void PopupAction(HWND hWnd, BYTE action)
@@ -98,7 +90,7 @@ void PopupAction(HWND hWnd, BYTE action)
break;
}
case PCA_OPENMENU:
- {
+ {
POINT pt = {0};
HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)hContact, 0);
GetCursorPos(&pt);
@@ -107,7 +99,7 @@ void PopupAction(HWND hWnd, BYTE action)
return;
}
case PCA_OPENDETAILS:
- {
+ {
CallServiceSync(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0);
break;
}
@@ -116,7 +108,7 @@ void PopupAction(HWND hWnd, BYTE action)
CallServiceSync(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)hContact, 0);
break;
}
- case PCA_CLOSEPOPUP:
+ case PCA_CLOSEPOPUP:
break;
case PCA_DONOTHING:
return;
@@ -126,36 +118,36 @@ void PopupAction(HWND hWnd, BYTE action)
}
}
-INT_PTR CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PLUGINDATA *pdp = NULL;
- switch(message)
+ switch(message)
{
case WM_MEASUREITEM: //Needed by the contact's context menu
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
case WM_DRAWITEM: //Needed by the contact's context menu
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
- case WM_COMMAND:
+ case WM_COMMAND:
{
//This one returns TRUE if it processed the menu command, and FALSE if it did not process it.
- if (CallServiceSync(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)PUGetContact(hwnd)))
+ if (CallServiceSync(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)PUGetContact(hwnd)))
break;
PopupAction(hwnd, opt.LeftClickAction);
- break;
+ break;
}
- case WM_CONTEXTMENU:
+ case WM_CONTEXTMENU:
{
PopupAction(hwnd, opt.RightClickAction);
break;
}
- case UM_FREEPLUGINDATA:
+ case UM_FREEPLUGINDATA:
{
PLUGINDATA *pdp = (PLUGINDATA *)PUGetPluginData(hwnd);
- if (pdp != NULL)
+ if (pdp != NULL)
{
- if (pdp->hAwayMsgHook != NULL)
+ if (pdp->hAwayMsgHook != NULL)
{
UnhookEvent(pdp->hAwayMsgHook);
pdp->hAwayMsgHook = NULL;
@@ -165,15 +157,15 @@ INT_PTR CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
}
return FALSE;
}
- case UM_INITPOPUP:
+ case UM_INITPOPUP:
{
pdp = (PLUGINDATA *)PUGetPluginData(hwnd);
if (pdp != NULL)
{
char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)PUGetContact(hwnd), 0);
- if (szProto && opt.ReadAwayMsg && StatusHasAwayMessage(szProto, pdp->newStatus))
+ if (szProto && opt.ReadAwayMsg && StatusHasAwayMessage(szProto, pdp->newStatus))
{
- WORD myStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
+ WORD myStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
if (myStatus != ID_STATUS_INVISIBLE)
QueryAwayMessage(hwnd, pdp);
}
@@ -182,13 +174,12 @@ INT_PTR CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return FALSE;
}
case WM_AWAYMSG: //We're here because ME_PROTO_ACK has been hooked to this window (too!).
- {
+ {
pdp = (PLUGINDATA *)PUGetPluginData(hwnd);
if (pdp != NULL) ReceivedAwayMessage(hwnd, lParam, pdp);
return FALSE;
- }
+ }
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
-
diff --git a/plugins/SimpleStatusMsg/awaymsg.cpp b/plugins/SimpleStatusMsg/awaymsg.cpp
index 5aebe1edb1..705b860cc5 100644
--- a/plugins/SimpleStatusMsg/awaymsg.cpp
+++ b/plugins/SimpleStatusMsg/awaymsg.cpp
@@ -137,28 +137,12 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
if (ack->result != ACKRESULT_SUCCESS) break;
if (dat->hAwayMsgEvent && ack->hProcess == dat->hSeq) { UnhookEvent(dat->hAwayMsgEvent); dat->hAwayMsgEvent = NULL; }
+ TCHAR *tszMsg = StrNormNewline((TCHAR*)ack->lParam);
+ SetDlgItemText(hwndDlg, IDC_MSG, tszMsg);
+ mir_free(tszMsg);
- DBVARIANT dbv;
- bool unicode = !DBGetContactSetting(dat->hContact, "CList", "StatusMsg", &dbv) &&
- (dbv.type == DBVT_UTF8 || dbv.type == DBVT_WCHAR);
- DBFreeVariant(&dbv);
- if (unicode)
- {
- DBGetContactSettingWString(dat->hContact, "CList", "StatusMsg", &dbv);
- TCHAR *tszMsg = StrNormNewline(dbv.pwszVal);
- SetDlgItemText(hwndDlg, IDC_MSG, tszMsg);
- mir_free(tszMsg);
- DBFreeVariant(&dbv);
- }
- else
-
- {
- char *szMsg = StrNormNewlineA((char *)ack->lParam);
- SetDlgItemTextA(hwndDlg, IDC_MSG, szMsg);
- mir_free(szMsg);
- }
-
- if (ack->lParam && *((char*)ack->lParam) != '\0') EnableWindow(GetDlgItem(hwndDlg, IDC_COPY), TRUE);
+ if (ack->lParam && *((char*)ack->lParam) != '\0')
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPY), TRUE);
ShowWindow(GetDlgItem(hwndDlg, IDC_RETRIEVING), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_MSG), SW_SHOW);
SetDlgItemText(hwndDlg, IDOK, TranslateT("&Close"));
@@ -257,7 +241,7 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
}
case HM_AWAYMSG:
- {
+ {
ACKDATA *ack = (ACKDATA*)lParam;
if (ack->hContact != dat->hContact || ack->type != ACKTYPE_AWAYMSG) { DestroyWindow(hwndDlg); break; }
if (ack->result != ACKRESULT_SUCCESS) { DestroyWindow(hwndDlg); break; }
@@ -267,35 +251,15 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
if (EmptyClipboard())
{
TCHAR msg[1024];
- int len;
-
- DBVARIANT dbv;
- bool unicode = !DBGetContactSetting(dat->hContact, "CList", "StatusMsg", &dbv) &&
- (dbv.type == DBVT_UTF8 || dbv.type == DBVT_WCHAR);
- DBFreeVariant(&dbv);
- if (unicode)
- {
- DBGetContactSettingWString(dat->hContact, "CList", "StatusMsg", &dbv);
- TCHAR *tszMsg = StrNormNewline(dbv.pwszVal);
- mir_sntprintf(msg, SIZEOF(msg), _T("%s"), tszMsg);
- mir_free(tszMsg);
- DBFreeVariant(&dbv);
- }
- else
-
- {
- char *szMsg = StrNormNewlineA((char *)ack->lParam);
- mir_sntprintf(msg, SIZEOF(msg), _T("%hs"), szMsg);
- mir_free(szMsg);
- }
- len = lstrlen(msg);
-
+ TCHAR *tszMsg = StrNormNewline((TCHAR*)ack->lParam);
+ mir_sntprintf(msg, SIZEOF(msg), _T("%s"), tszMsg);
+ mir_free(tszMsg);
+ size_t len = lstrlen(msg);
if (len)
{
LPTSTR lptstrCopy;
HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(TCHAR));
- if (hglbCopy == NULL)
- {
+ if (hglbCopy == NULL) {
CloseClipboard();
DestroyWindow(hwndDlg);
break;
@@ -306,7 +270,6 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
GlobalUnlock(hglbCopy);
SetClipboardData(CF_UNICODETEXT, hglbCopy);
-
}
}
CloseClipboard();
@@ -362,7 +325,7 @@ static char *StrFindURL(char *pszStr)
if (pszURL == NULL)
pszURL = strstr(pszStr, "ftp://");
}
-
+
return pszURL;
}
diff --git a/plugins/TipperYM/message_pump.cpp b/plugins/TipperYM/message_pump.cpp
index 4aab0f10b3..ed29d48234 100644
--- a/plugins/TipperYM/message_pump.cpp
+++ b/plugins/TipperYM/message_pump.cpp
@@ -15,7 +15,7 @@ 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.
+Boston, MA 02111-1307, USA.
*/
#include "common.h"
@@ -30,7 +30,7 @@ BOOL (WINAPI *MyUpdateLayeredWindow)(HWND hwnd, HDC hdcDST, POINT *pptDst, SIZE
BOOL (WINAPI *MyAnimateWindow)(HWND hWnd,DWORD dwTime,DWORD dwFlags) = 0;
HMONITOR (WINAPI *MyMonitorFromPoint)(POINT, DWORD);
BOOL (WINAPI *MyGetMonitorInfo)(HMONITOR, LPMONITORINFO);
-HRESULT (WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind) = 0;
+HRESULT (WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind) = 0;
unsigned int uintMessagePumpThreadId = 0;
POINT pt = {-1};
@@ -43,11 +43,11 @@ __inline bool IsContactTooltip(CLCINFOTIPEX *clc)
return (clc->szProto || clc->swzText) == false;
}
-void CALLBACK TimerProcWaitForContent(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
+void CALLBACK TimerProcWaitForContent(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
KillTimer(0, WaitForContentTimerID);
WaitForContentTimerID = 0;
- bStatusMsgReady = true;
+ bStatusMsgReady = true;
bAvatarReady = true;
PostMPMessage(MUM_CREATEPOPUP, 0, 0);
}
@@ -61,13 +61,13 @@ bool NeedWaitForContent(CLCINFOTIPEX *clcitex)
char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)clcitex->hItem, 0);
if (!szProto) return false;
- if (opt.bWaitForStatusMsg && !bStatusMsgReady)
+ if (opt.bWaitForStatusMsg && !bStatusMsgReady)
{
DBDeleteContactSetting(clcitex->hItem, MODULE, "TempStatusMsg");
if (CanRetrieveStatusMsg(clcitex->hItem, szProto) &&
- CallContactService(clcitex->hItem, PSS_GETAWAYMSG, 0, 0))
+ CallContactService(clcitex->hItem, PSS_GETAWAYMSG, 0, 0))
{
- if (WaitForContentTimerID)
+ if (WaitForContentTimerID)
KillTimer(0, WaitForContentTimerID);
WaitForContentTimerID = SetTimer(NULL, 0, WAIT_TIMER_INTERVAL, TimerProcWaitForContent);
@@ -75,41 +75,41 @@ bool NeedWaitForContent(CLCINFOTIPEX *clcitex)
}
}
- if (opt.bWaitForAvatar && !bAvatarReady &&
- CallProtoService(szProto, PS_GETAVATARCAPS, AF_ENABLED, 0))
+ if (opt.bWaitForAvatar && !bAvatarReady &&
+ CallProtoService(szProto, PS_GETAVATARCAPS, AF_ENABLED, 0))
{
DBVARIANT dbv;
if (!DBGetContactSettingString(clcitex->hItem, "ContactPhoto", "File", &dbv))
- {
- if (!strstr(dbv.pszVal, ".xml"))
+ {
+ if (!strstr(dbv.pszVal, ".xml"))
{
AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)clcitex->hItem, 0);
- if (!ace)
+ if (!ace)
{
- if (WaitForContentTimerID)
+ if (WaitForContentTimerID)
KillTimer(0, WaitForContentTimerID);
WaitForContentTimerID = SetTimer(NULL, 0, WAIT_TIMER_INTERVAL, TimerProcWaitForContent);
bNeedWait = true;
- }
+ }
else
bAvatarReady = true;
- }
+ }
else
bAvatarReady = true;
DBFreeVariant(&dbv);
- }
+ }
else
bAvatarReady = true;
}
-
- }
+
+ }
return bNeedWait;
}
-unsigned int CALLBACK MessagePumpThread(void *param)
+unsigned int CALLBACK MessagePumpThread(void *param)
{
HWND hwndTip = 0;
CLCINFOTIPEX *clcitex = 0;
@@ -117,23 +117,23 @@ unsigned int CALLBACK MessagePumpThread(void *param)
MSG hwndMsg = {0};
while (GetMessage(&hwndMsg, 0, 0, 0) > 0 && !Miranda_Terminated())
{
- if (!IsDialogMessage(hwndMsg.hwnd, &hwndMsg))
+ if (!IsDialogMessage(hwndMsg.hwnd, &hwndMsg))
{
- switch (hwndMsg.message)
+ switch (hwndMsg.message)
{
case MUM_CREATEPOPUP:
{
- if (!clcitex)
+ if (!clcitex)
{
if (hwndMsg.lParam) clcitex = (CLCINFOTIPEX *)hwndMsg.lParam;
else break;
}
- if (!NeedWaitForContent(clcitex))
+ if (!NeedWaitForContent(clcitex))
{
if (hwndTip) MyDestroyWindow(hwndTip);
hwndTip = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, hInst, (LPVOID)clcitex);
-
+
if (clcitex)
{
mir_free(clcitex);
@@ -144,10 +144,10 @@ unsigned int CALLBACK MessagePumpThread(void *param)
bAvatarReady = false;
}
break;
- }
+ }
case MUM_DELETEPOPUP:
{
- if (hwndTip)
+ if (hwndTip)
{
MyDestroyWindow(hwndTip);
hwndTip = 0;
@@ -168,12 +168,12 @@ unsigned int CALLBACK MessagePumpThread(void *param)
HANDLE hContact = (HANDLE)hwndMsg.wParam;
TCHAR *swzMsg = (TCHAR *)hwndMsg.lParam;
- if (opt.bWaitForContent &&
- bStatusMsgReady == false &&
- clcitex &&
+ if (opt.bWaitForContent &&
+ bStatusMsgReady == false &&
+ clcitex &&
clcitex->hItem == hContact)
{
- if (WaitForContentTimerID)
+ if (WaitForContentTimerID)
{
KillTimer(0, WaitForContentTimerID);
WaitForContentTimerID = 0;
@@ -181,23 +181,23 @@ unsigned int CALLBACK MessagePumpThread(void *param)
if (swzMsg)
{
- DBWriteContactSettingTString(clcitex->hItem, MODULE, "TempStatusMsg", swzMsg);
+ DBWriteContactSettingTString(clcitex->hItem, MODULE, "TempStatusMsg", swzMsg);
mir_free(swzMsg);
}
bStatusMsgReady = true;
PostMPMessage(MUM_CREATEPOPUP, 0, 0);
- }
- else if (!opt.bWaitForContent && hwndTip)
+ }
+ else if (!opt.bWaitForContent && hwndTip)
SendMessage(hwndTip, PUM_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)swzMsg);
- else if (swzMsg)
+ else if (swzMsg)
mir_free(swzMsg);
break;
- }
+ }
case MUM_GOTXSTATUS:
{
- if (hwndTip && !opt.bWaitForContent)
+ if (hwndTip && !opt.bWaitForContent)
SendMessage(hwndTip, PUM_SHOWXSTATUS, hwndMsg.wParam, 0);
break;
}
@@ -205,10 +205,10 @@ unsigned int CALLBACK MessagePumpThread(void *param)
{
HANDLE hContact = (HANDLE)hwndMsg.wParam;
- if (opt.bWaitForContent &&
- bAvatarReady == false &&
- clcitex &&
- clcitex->hItem == hContact)
+ if (opt.bWaitForContent &&
+ bAvatarReady == false &&
+ clcitex &&
+ clcitex->hItem == hContact)
{
if (WaitForContentTimerID)
{
@@ -216,10 +216,10 @@ unsigned int CALLBACK MessagePumpThread(void *param)
WaitForContentTimerID = 0;
}
- bAvatarReady = true;
+ bAvatarReady = true;
PostMPMessage(MUM_CREATEPOPUP, 0, 0);
- }
- else if (!opt.bWaitForContent && hwndTip)
+ }
+ else if (!opt.bWaitForContent && hwndTip)
SendMessage(hwndTip, PUM_SETAVATAR, hwndMsg.wParam, 0);
break;
@@ -237,12 +237,12 @@ unsigned int CALLBACK MessagePumpThread(void *param)
return 0;
}
-void PostMPMessage(UINT msg, WPARAM wParam, LPARAM lParam)
+void PostMPMessage(UINT msg, WPARAM wParam, LPARAM lParam)
{
PostThreadMessage(uintMessagePumpThreadId, msg, wParam, lParam);
}
-void InitMessagePump()
+void InitMessagePump()
{
WNDCLASSEX wcl = {0};
wcl.cbSize = sizeof(wcl);
@@ -254,7 +254,7 @@ void InitMessagePump()
RegisterClassEx(&wcl);
HMODULE hUserDll = LoadLibrary(_T("user32.dll"));
- if (hUserDll)
+ if (hUserDll)
{
MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes");
MyUpdateLayeredWindow = (BOOL (WINAPI *)(HWND hwnd, HDC hdcDST, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags))GetProcAddress(hUserDll, "UpdateLayeredWindow");
@@ -271,13 +271,13 @@ void InitMessagePump()
CloseHandle(mir_forkthreadex(MessagePumpThread, NULL, 0, &uintMessagePumpThreadId));
}
-void DeinitMessagePump()
+void DeinitMessagePump()
{
PostMPMessage(WM_QUIT, 0, 0);
UnregisterClass(POP_WIN_CLASS, hInst);
}
-INT_PTR ShowTip(WPARAM wParam, LPARAM lParam)
+INT_PTR ShowTip(WPARAM wParam, LPARAM lParam)
{
CLCINFOTIP *clcit = (CLCINFOTIP *)lParam;
HWND clist = (HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0);
@@ -294,7 +294,7 @@ INT_PTR ShowTip(WPARAM wParam, LPARAM lParam)
clcit2->swzText = NULL;
if (wParam) // wParam is char pointer containing text - e.g. status bar tooltip
- {
+ {
clcit2->swzText = a2t((char *)wParam);
GetCursorPos(&clcit2->ptCursor);
}
@@ -303,13 +303,13 @@ INT_PTR ShowTip(WPARAM wParam, LPARAM lParam)
return 1;
}
-int ShowTipHook(WPARAM wParam, LPARAM lParam)
+int ShowTipHook(WPARAM wParam, LPARAM lParam)
{
ShowTip(wParam, lParam);
return 0;
}
-INT_PTR ShowTipW(WPARAM wParam, LPARAM lParam)
+INT_PTR ShowTipW(WPARAM wParam, LPARAM lParam)
{
CLCINFOTIP *clcit = (CLCINFOTIP *)lParam;
HWND clist = (HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0);
@@ -326,7 +326,7 @@ INT_PTR ShowTipW(WPARAM wParam, LPARAM lParam)
clcit2->swzText = NULL;
if (wParam) // wParam is char pointer containing text - e.g. status bar tooltip
- {
+ {
clcit2->swzText = mir_tstrdup((TCHAR *)wParam);
GetCursorPos(&clcit2->ptCursor);
}
@@ -335,7 +335,7 @@ INT_PTR ShowTipW(WPARAM wParam, LPARAM lParam)
return 1;
}
-INT_PTR HideTip(WPARAM wParam, LPARAM lParam)
+INT_PTR HideTip(WPARAM wParam, LPARAM lParam)
{
//CLCINFOTIP *clcit = (CLCINFOTIP *)lParam;
if (GetAsyncKeyState(VK_CONTROL) & 0x8000)
@@ -346,29 +346,23 @@ INT_PTR HideTip(WPARAM wParam, LPARAM lParam)
return 1;
}
-int HideTipHook(WPARAM wParam, LPARAM lParam)
+int HideTipHook(WPARAM wParam, LPARAM lParam)
{
HideTip(wParam, lParam);
return 0;
}
-int ProtoAck(WPARAM wParam, LPARAM lParam)
+int ProtoAck(WPARAM wParam, LPARAM lParam)
{
- DBVARIANT dbv;
ACKDATA *ack = (ACKDATA *)lParam;
if (ack->result != ACKRESULT_SUCCESS)
return 0;
- if (ack->type == ACKTYPE_AWAYMSG)
- {
- if (!DBGetContactSettingTString(ack->hContact, "CList", "StatusMsg", &dbv))
- {
- if (dbv.ptszVal[0])
- PostMPMessage(MUM_GOTSTATUS, (WPARAM)ack->hContact, (LPARAM)mir_tstrdup(dbv.ptszVal));
-
- DBFreeVariant(&dbv);
- }
- }
+ if (ack->type == ACKTYPE_AWAYMSG) {
+ TCHAR* tszMsg = ( TCHAR* )ack->lParam;
+ if ( lstrlen(tszMsg))
+ PostMPMessage(MUM_GOTSTATUS, (WPARAM)ack->hContact, (LPARAM)mir_tstrdup(tszMsg));
+ }
else if (ack->type == ICQACKTYPE_XSTATUS_RESPONSE)
{
PostMPMessage(MUM_GOTXSTATUS, (WPARAM)ack->hContact, 0);
@@ -377,14 +371,14 @@ int ProtoAck(WPARAM wParam, LPARAM lParam)
return 0;
}
-int AvatarChanged(WPARAM wParam, LPARAM lParam)
+int AvatarChanged(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
PostMPMessage(MUM_GOTAVATAR, (WPARAM)hContact, 0);
return 0;
}
-int FramesShowSBTip(WPARAM wParam, LPARAM lParam)
+int FramesShowSBTip(WPARAM wParam, LPARAM lParam)
{
if (opt.bStatusBarTips)
{
@@ -402,9 +396,9 @@ int FramesShowSBTip(WPARAM wParam, LPARAM lParam)
return 0;
}
-int FramesHideSBTip(WPARAM wParam, LPARAM lParam)
+int FramesHideSBTip(WPARAM wParam, LPARAM lParam)
{
- if (opt.bStatusBarTips)
+ if (opt.bStatusBarTips)
{
PostMPMessage(MUM_DELETEPOPUP, 0, 0);
return 1;
@@ -412,7 +406,7 @@ int FramesHideSBTip(WPARAM wParam, LPARAM lParam)
return 0;
}
-BOOL MyDestroyWindow(HWND hwnd)
+BOOL MyDestroyWindow(HWND hwnd)
{
SendMessage(hwnd, PUM_FADEOUTWINDOW, 0, 0);
return DestroyWindow(hwnd);