summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp47
-rw-r--r--plugins/TabSRMM/src/msglog.cpp13
-rw-r--r--plugins/TabSRMM/src/msgs.cpp53
3 files changed, 48 insertions, 65 deletions
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 067213082b..b8f0265d73 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -1277,13 +1277,9 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *
INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct TWindowData *dat = 0;
- HWND hwndTab, hwndContainer;
- struct TContainerData *m_pContainer = 0;
-
- dat = (struct TWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- hwndTab = GetParent(hwndDlg);
+ TContainerData *m_pContainer = 0;
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ HWND hwndTab = GetParent(hwndDlg), hwndContainer;
if (dat == 0) {
if (msg == WM_ACTIVATE || msg == WM_SETFOCUS)
@@ -1404,10 +1400,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
* consider per-contact message setting overrides
*/
- if (M->GetDword(dat->hContact, "mwmask", 0)) {
+ if (M->GetDword(dat->hContact, "mwmask", 0))
if (dat->hContact)
LoadLocalFlags(hwndDlg, dat);
- }
/*
* allow disabling emoticons per contact (note: currently unused feature)
@@ -1451,9 +1446,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SendMessage(hwndDlg, DM_LOADBUTTONBARICONS, 0, 0);
if (CSkin::m_skinEnabled && !SkinItems[ID_EXTBKBUTTONSNPRESSED].IGNORED &&
- !SkinItems[ID_EXTBKBUTTONSPRESSED].IGNORED && !SkinItems[ID_EXTBKBUTTONSMOUSEOVER].IGNORED) {
- isThemed = FALSE;
- }
+ !SkinItems[ID_EXTBKBUTTONSPRESSED].IGNORED && !SkinItems[ID_EXTBKBUTTONSMOUSEOVER].IGNORED)
+ isThemed = FALSE;
SendMessage(GetDlgItem(hwndDlg, IDC_ADD), BUTTONSETASFLATBTN, TRUE, 0);
SendMessage(GetDlgItem(hwndDlg, IDC_CANCELADD), BUTTONSETASFLATBTN, TRUE, 0);
@@ -1476,13 +1470,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SetWindowText(GetDlgItem(hwndDlg, IDC_RETRY), TranslateT("Retry"));
- {
- UINT _ctrls[] = {IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER};
- for (i=0; i < 3; i++) {
- SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASFLATBTN, FALSE, 0);
- SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASTHEMEDBTN, TRUE, 0);
- }
+ UINT _ctrls[] = {IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER};
+ for (i=0; i < 3; i++) {
+ SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASPUSHBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASFLATBTN, FALSE, 0);
+ SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASTHEMEDBTN, TRUE, 0);
}
SetWindowText(GetDlgItem(hwndDlg, IDC_CANCELSEND), TranslateT("Cancel"));
@@ -1563,24 +1555,19 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
//dat->dwFlags &= ~MWF_INITMODE;
{
- DBEVENTINFO dbei = { 0};
- HANDLE hdbEvent;
-
- dbei.cbSize = sizeof(dbei);
- hdbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDLAST, (WPARAM) dat->hContact, 0);
+ HANDLE hdbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDLAST, (WPARAM) dat->hContact, 0);
if (hdbEvent) {
do {
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
CallService(MS_DB_EVENT_GET, (WPARAM) hdbEvent, (LPARAM) & dbei);
if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) {
dat->lastMessage = dbei.timestamp;
DM_UpdateLastMessage(dat);
break;
}
- } while (hdbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDPREV, (WPARAM) hdbEvent, 0));
+ }
+ while (hdbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDPREV, (WPARAM) hdbEvent, 0));
}
-
}
SendMessage(hwndContainer, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc);
@@ -3670,9 +3657,11 @@ quote_from_last:
break;
case WM_DESTROY:
+ if (!dat)
+ break;
+
if (PluginConfig.g_FlashAvatarAvail) {
FLASHAVATAR fa = {0};
-
fa.hContact = dat->hContact;
fa.id = 25367;
fa.cProto = dat->szProto;
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp
index d79de1318d..86760e8bc9 100644
--- a/plugins/TabSRMM/src/msglog.cpp
+++ b/plugins/TabSRMM/src/msglog.cpp
@@ -555,18 +555,17 @@ static char *CreateRTFTail(struct TWindowData *dat)
int TSAPI DbEventIsShown(struct TWindowData *dat, DBEVENTINFO * dbei)
{
- int heFlags;
-
switch (dbei->eventType) {
- case EVENTTYPE_MESSAGE:
- return 1;
- case EVENTTYPE_FILE:
- return(dat->dwFlagsEx & MWF_SHOW_FILEEVENTS);
+ case EVENTTYPE_MESSAGE:
+ return 1;
+ case EVENTTYPE_FILE:
+ return(dat->dwFlagsEx & MWF_SHOW_FILEEVENTS);
}
+
if (IsStatusEvent(dbei->eventType))
return 1;
- heFlags = HistoryEvents_GetFlags(dbei->eventType);
+ int heFlags = HistoryEvents_GetFlags(dbei->eventType);
if (heFlags != -1)
return (heFlags & HISTORYEVENTS_FLAG_SHOW_IM_SRMM) == HISTORYEVENTS_FLAG_SHOW_IM_SRMM;
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 8fe693fcd8..7f2379e228 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -222,30 +222,27 @@ INT_PTR MessageWindowOpened(WPARAM wParam, LPARAM lParam)
else
hwnd = NULL;
- if (hwnd) {
- SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
- if (pContainer) {
- if (pContainer->dwFlags & CNT_DONTREPORT) {
- if (IsIconic(pContainer->hwnd))
- return 0;
- }
- if (pContainer->dwFlags & CNT_DONTREPORTUNFOCUSED) {
- if (!IsIconic(pContainer->hwnd) && GetForegroundWindow() != pContainer->hwnd && GetActiveWindow() != pContainer->hwnd)
- return 0;
- }
- if (pContainer->dwFlags & CNT_ALWAYSREPORTINACTIVE) {
- if (pContainer->dwFlags & CNT_DONTREPORTFOCUSED)
- return 0;
-
- if (pContainer->hwndActive == hwnd)
- return 1;
- else
- return 0;
- }
- }
- return 1;
- } else
+ if (!hwnd)
return 0;
+
+ SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
+ if (pContainer) {
+ if (pContainer->dwFlags & CNT_DONTREPORT) {
+ if (IsIconic(pContainer->hwnd))
+ return 0;
+ }
+ if (pContainer->dwFlags & CNT_DONTREPORTUNFOCUSED) {
+ if (!IsIconic(pContainer->hwnd) && GetForegroundWindow() != pContainer->hwnd && GetActiveWindow() != pContainer->hwnd)
+ return 0;
+ }
+ if (pContainer->dwFlags & CNT_ALWAYSREPORTINACTIVE) {
+ if (pContainer->dwFlags & CNT_DONTREPORTFOCUSED)
+ return 0;
+
+ return pContainer->hwndActive == hwnd;
+ }
+ }
+ return 1;
}
/*
@@ -256,12 +253,10 @@ INT_PTR MessageWindowOpened(WPARAM wParam, LPARAM lParam)
static INT_PTR ReadMessageCommand(WPARAM wParam, LPARAM lParam)
{
- HWND hwndExisting;
HANDLE hContact = ((CLISTEVENT *) lParam)->hContact;
struct TContainerData *pContainer = 0;
- hwndExisting = M->FindWindow(hContact);
-
+ HWND hwndExisting = M->FindWindow(hContact);
if (hwndExisting != 0)
SendMessage(hwndExisting, DM_ACTIVATEME, 0, 0);
else {
@@ -546,11 +541,9 @@ static struct _svcdef {
static void TSAPI InitAPI()
{
- int i;
-
ZeroMemory(PluginConfig.hSvc, sizeof(HANDLE) * CGlobals::SERVICE_LAST);
- for (i=0; i < safe_sizeof(SERVICES); i++)
+ for (int i=0; i < safe_sizeof(SERVICES); i++)
*(SERVICES[i].h) = CreateServiceFunction(SERVICES[i].szName, SERVICES[i].pfnService);
*(SERVICES[CGlobals::H_MS_MSG_SENDMESSAGEW].h) = CreateServiceFunction(MS_MSG_SENDMESSAGE "W", SendMessageCommand_W);
@@ -577,6 +570,8 @@ int LoadSendRecvMessageModule(void)
icex.dwICC = ICC_COOL_CLASSES | ICC_BAR_CLASSES | ICC_LISTVIEW_CLASSES;;
InitCommonControlsEx(&icex);
+ Utils::loadSystemLibrary(L"\\riched20.dll");
+
OleInitialize(NULL);
mREOLECallback = new REOLECallback;
Win7Taskbar = new CTaskbarInteract;