diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2014-03-09 17:45:14 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2014-03-09 17:45:14 +0000 |
commit | 535b7733c38c9e4c75a8ff73f231c8b807194124 (patch) | |
tree | 95fe152f1c608768d7ae3d800f2c9f7ee21a2269 | |
parent | 79ef51422c7fa9cc9867355b1518ec6ce7be52c2 (diff) |
minor cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@8514 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/TabSRMM/src/eventpopups.cpp | 19 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 16 | ||||
-rw-r--r-- | plugins/TabSRMM/src/infopanel.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/infopanel.h | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.cpp | 10 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msglog.cpp | 20 | ||||
-rw-r--r-- | plugins/TabSRMM/src/typingnotify.cpp | 6 |
7 files changed, 29 insertions, 48 deletions
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 58acd08e64..c9b9f902a5 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -70,7 +70,7 @@ static void PU_CleanUp() static void CheckForRemoveMask()
{
if (!M.GetByte(MODULE, "firsttime", 0) && (nen_options.maskActL & MASK_REMOVE || nen_options.maskActR & MASK_REMOVE || nen_options.maskActTE & MASK_REMOVE)) {
- MessageBoxA(0, Translate("One of your popup actions is set to DISMISS EVENT.\nNote that this options may have unwanted side effects as it REMOVES the event from the unread queue.\nThis may lead to events not showing up as \"new\". If you don't want this behavior, please review the Event Notifications settings page."), "tabSRMM Warning Message", MB_OK | MB_ICONSTOP);
+ MessageBox(0, TranslateT("One of your popup actions is set to DISMISS EVENT.\nNote that this options may have unwanted side effects as it REMOVES the event from the unread queue.\nThis may lead to events not showing up as \"new\". If you don't want this behavior, please review the Event Notifications settings page."), TranslateT("tabSRMM Warning Message"), MB_OK | MB_ICONSTOP);
db_set_b(0, MODULE, "firsttime", 1);
}
}
@@ -152,7 +152,6 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa case WM_INITDIALOG:
TranslateDialogDefault(hWnd);
{
- int i;
SetWindowLongPtr(GetDlgItem(hWnd, IDC_EVENTOPTIONS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hWnd, IDC_EVENTOPTIONS), GWL_STYLE) | (TVS_NOHSCROLL | TVS_CHECKBOXES));
HIMAGELIST himl = (HIMAGELIST)SendDlgItemMessage(hWnd, IDC_EVENTOPTIONS, TVM_SETIMAGELIST, TVSIL_STATE, (LPARAM)CreateStateImageList());
ImageList_Destroy(himl);
@@ -172,7 +171,7 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa */
TOptionListGroup *lGroups = CTranslator::getGroupTree(CTranslator::TREE_NEN);
- for (i=0; lGroups[i].szName != NULL; i++) {
+ for (int i=0; lGroups[i].szName != NULL; i++) {
TVINSERTSTRUCT tvi = { 0 };
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_STATE;
@@ -183,7 +182,7 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa }
TOptionListItem *defaultItems = CTranslator::getTree(CTranslator::TREE_NEN);
- for (i=0; defaultItems[i].szName != 0; i++) {
+ for (int i=0; defaultItems[i].szName != 0; i++) {
TVINSERTSTRUCT tvi = { 0 };
tvi.hParent = (HTREEITEM)lGroups[defaultItems[i].uGroup].handle;
tvi.hInsertAfter = TVI_LAST;
@@ -428,7 +427,7 @@ static int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATAT* pdata) return 0;
}
-static BOOL CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PLUGIN_DATAT *pdata = (PLUGIN_DATAT*)PUGetPluginData(hWnd);
if (pdata == NULL)
@@ -626,7 +625,7 @@ static int PopupUpdateT(MCONTACT hContact, HANDLE hEvent) if (dbe.pBlob)
mir_free(dbe.pBlob);
- CallService(MS_POPUP_CHANGETEXTT, (WPARAM)pdata->hWnd, (LPARAM)lpzText);
+ PUChangeTextT(pdata->hWnd, lpzText);
return 0;
}
@@ -679,20 +678,20 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, MCONTACT hContact, HANDLE hEve //finally create the popup
pud.lchContact = hContact;
- pud.PluginWindowProc = (WNDPROC)PopupDlgProc;
+ pud.PluginWindowProc = PopupDlgProc;
pud.PluginData = pdata;
if (hContact)
mir_sntprintf(pud.lptzContactName, MAX_CONTACTNAME, _T("%s"), pcli->pfnGetContactDisplayName(hContact, 0));
else
- _tcsncpy_s(pud.lptzContactName, SIZEOF(pud.lptzContactName), _A2T(dbe.szModule), _TRUNCATE);
+ _tcsncpy_s(pud.lptzContactName, MAX_CONTACTNAME, _A2T(dbe.szModule), _TRUNCATE);
TCHAR *szPreview = GetPreviewT((WORD)eventType, &dbe);
if (szPreview) {
mir_sntprintf(pud.lptzText, MAX_SECONDLINE, _T("%s"), szPreview);
mir_free(szPreview);
}
- else _tcscpy(pud.lptzText, _T(" "));
+ else _tcsncpy(pud.lptzText, _T(" "), MAX_SECONDLINE);
pdata->eventData = (EVENT_DATAT *)mir_alloc(NR_MERGED * sizeof(EVENT_DATAT));
pdata->eventData[0].hEvent = hEvent;
@@ -764,7 +763,7 @@ int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szPro if (!PluginConfig.g_hMenuTrayUnread || hContact == 0 || szProto == NULL)
return 0;
- PROTOACCOUNT *acc = (PROTOACCOUNT *)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)szProto);
+ PROTOACCOUNT *acc = ProtoGetAccount(szProto);
TCHAR *tszFinalProto = (acc && acc->tszAccountName ? acc->tszAccountName : 0);
if (tszFinalProto == 0)
return 0;
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index decc0c712d..3c5fa197b0 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1316,17 +1316,13 @@ LRESULT TSAPI DM_ThemeChanged(TWindowData *dat) */
void TSAPI DM_NotifyTyping(TWindowData *dat, int mode)
{
- DWORD protoStatus;
- DWORD protoCaps;
- DWORD typeCaps;
- const char *szProto = 0;
- MCONTACT hContact = 0;
-
if (!dat || !dat->hContact)
return;
DeletePopupsForContact(dat->hContact, PU_REMOVE_ON_TYPE);
+ const char *szProto = 0;
+ MCONTACT hContact = 0;
if (dat->bIsMeta){
szProto = dat->cache->getActiveProto();
hContact = dat->cache->getActiveContact();
@@ -1354,12 +1350,11 @@ void TSAPI DM_NotifyTyping(TWindowData *dat, int mode) /*
* check status and capabilities of the protocol
*/
- protoStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
- protoCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
- typeCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0);
-
+ DWORD typeCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0);
if (!(typeCaps & PF4_SUPPORTTYPING))
return;
+
+ DWORD protoStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
if (protoStatus < ID_STATUS_ONLINE)
return;
@@ -1367,6 +1362,7 @@ void TSAPI DM_NotifyTyping(TWindowData *dat, int mode) * check visibility/invisibility lists to not "accidentially" send MTN to contacts who
* should not see them (privacy issue)
*/
+ DWORD protoCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
if (protoCaps & PF1_VISLIST && db_get_w(hContact, szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE)
return;
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 464f870051..4ed22119c0 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -1476,7 +1476,7 @@ void CTip::registerClass() WNDCLASSEX wc = { 0 };
wc.cbSize = sizeof(wc);
wc.lpszClassName = _T("RichEditTipClass");
- wc.lpfnWndProc = (WNDPROC)CTip::WndProcStub;
+ wc.lpfnWndProc = CTip::WndProcStub;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.cbWndExtra = sizeof(CTip *);
wc.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_PARENTDC;
@@ -1515,7 +1515,7 @@ LRESULT CALLBACK CTip::RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l * this pointer.
*/
-INT_PTR CALLBACK CTip::WndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK CTip::WndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
CTip *tip = reinterpret_cast<CTip *>(::GetWindowLongPtr(hwnd, GWLP_USERDATA));
if (tip)
diff --git a/plugins/TabSRMM/src/infopanel.h b/plugins/TabSRMM/src/infopanel.h index 3bb8835d38..6e41b88fbc 100644 --- a/plugins/TabSRMM/src/infopanel.h +++ b/plugins/TabSRMM/src/infopanel.h @@ -86,7 +86,7 @@ public: private:
INT_PTR CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK WndProcStub(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static LRESULT CALLBACK WndProcStub(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
HWND m_hwnd; // our window handle
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 842648bd23..ee8378c24c 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -53,12 +53,10 @@ static int g_status_events_size = 0; BOOL TSAPI IsStatusEvent(int eventType)
{
- int i;
-
if (g_status_events_size == 0)
g_status_events_size = MAX_REGS(g_status_events);
- for (i=0; i < g_status_events_size; i++) {
+ for (int i=0; i < g_status_events_size; i++) {
if (eventType == g_status_events[i])
return TRUE;
}
@@ -1492,7 +1490,6 @@ void TSAPI PlayIncomingSound(const TWindowData *dat) void TSAPI GetSendFormat(TWindowData *dat, int mode)
{
UINT controls[5] = {IDC_FONTBOLD, IDC_FONTITALIC, IDC_FONTUNDERLINE,IDC_FONTSTRIKEOUT, IDC_FONTFACE};
- int i;
if (mode) {
dat->SendFormat = M.GetDword(dat->hContact, "sendformat", PluginConfig.m_SendFormat);
@@ -1501,7 +1498,7 @@ void TSAPI GetSendFormat(TWindowData *dat, int mode) else if (dat->SendFormat == 0)
dat->SendFormat = PluginConfig.m_SendFormat ? 1 : 0;
}
- for (i=0; i < 5; i++)
+ for (int i=0; i < 5; i++)
Utils::enableDlgControl(dat->hwnd, controls[i], dat->SendFormat != 0 ? TRUE : FALSE);
return;
}
@@ -2147,11 +2144,10 @@ LRESULT TSAPI GetSendButtonState(HWND hwnd) void TSAPI EnableSendButton(const TWindowData *dat, int iMode)
{
- HWND hwndOK;
SendMessage(GetDlgItem(dat->hwnd, IDOK), BUTTONSETASNORMAL, iMode, 0);
SendMessage(GetDlgItem(dat->hwnd, IDC_PIC), BUTTONSETASNORMAL, dat->fEditNotesActive ? TRUE : (!iMode && dat->iOpenJobs == 0) ? TRUE : FALSE, 0);
- hwndOK = GetDlgItem(GetParent(GetParent(dat->hwnd)), IDOK);
+ HWND hwndOK = GetDlgItem(GetParent(GetParent(dat->hwnd)), IDOK);
if (IsWindow(hwndOK))
SendMessage(hwndOK, BUTTONSETASNORMAL, iMode, 0);
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 29605d0d7c..a0960614c7 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -502,12 +502,9 @@ static void Build_RTF_Header(char **buffer, int *bufferEnd, int *bufferAlloced, //mir_free() the return value
static char *CreateRTFHeader(TWindowData *dat)
{
- char *buffer;
- int bufferAlloced, bufferEnd;
-
- bufferEnd = 0;
- bufferAlloced = 1024;
- buffer = (char *) mir_alloc(bufferAlloced);
+ int bufferEnd = 0;
+ int bufferAlloced = 1024;
+ char *buffer = (char *) mir_alloc(bufferAlloced);
buffer[0] = '\0';
Build_RTF_Header(&buffer, &bufferEnd, &bufferAlloced, dat);
@@ -541,10 +538,7 @@ static char *CreateRTFTail(TWindowData *dat) int TSAPI DbEventIsShown(TWindowData *dat, DBEVENTINFO *dbei)
{
- if (!IsCustomEvent(dbei->eventType))
- return 1;
-
- if (DbEventIsForMsgWindow(dbei))
+ if (!IsCustomEvent(dbei->eventType) || DbEventIsForMsgWindow(dbei))
return 1;
return IsStatusEvent(dbei->eventType);
@@ -552,7 +546,7 @@ int TSAPI DbEventIsShown(TWindowData *dat, DBEVENTINFO *dbei) int DbEventIsForMsgWindow(DBEVENTINFO *dbei)
{
- DBEVENTTYPEDESCR* et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ DBEVENTTYPEDESCR *et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
return et && (et->flags & DETF_MSGWINDOW);
}
@@ -973,13 +967,9 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact, AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, (wchar_t *)dbei.szModule, MAKELONG(isSent, dat->isHistory));
break;
case 'M': // message
- if (bIsStatusChangeEvent)
- dbei.eventType = EVENTTYPE_STATUSCHANGE;
-
switch (dbei.eventType) {
case EVENTTYPE_MESSAGE:
case EVENTTYPE_ERRMSG:
- case EVENTTYPE_STATUSCHANGE:
if (bIsStatusChangeEvent || dbei.eventType == EVENTTYPE_ERRMSG) {
if (dbei.eventType == EVENTTYPE_ERRMSG && dbei.cbBlob == 0)
break;
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 6652ece4ad..b8bc21d693 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -63,12 +63,12 @@ static INT_PTR EnableDisableMenuCommand(WPARAM wParam,LPARAM lParam) return 0;
}
-static int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_COMMAND:
if (HIWORD(wParam) == STN_CLICKED) {
- CallService(MS_MSG_SENDMESSAGE "W", (WPARAM)PUGetContact(hWnd), 0);
+ CallService(MS_MSG_SENDMESSAGET, (WPARAM)PUGetContact(hWnd), 0);
PUDeletePopup(hWnd);
return 1;
}
@@ -176,7 +176,7 @@ void TN_TypingMessage(MCONTACT hContact, int iMode) ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
ppd.lchContact = hContact;
- ppd.PluginWindowProc = (WNDPROC) PopupDlgProc;
+ ppd.PluginWindowProc = PopupDlgProc;
CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, APF_NEWDATA);
}
|