summaryrefslogtreecommitdiff
path: root/plugins/QuickMessages/src/main.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-08-11 15:39:23 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-08-11 15:39:23 +0000
commit2548065ebc5da2a8778cd4f49343b847773ee174 (patch)
tree642d6b05a1ada0df9803ddf55faa3e709920afef /plugins/QuickMessages/src/main.cpp
parenteb031473db62a4fac910f7cb2d13765a753df92d (diff)
'unreferenced formal parameter' warnings fixed
git-svn-id: http://svn.miranda-ng.org/main/trunk@14913 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/QuickMessages/src/main.cpp')
-rw-r--r--plugins/QuickMessages/src/main.cpp268
1 files changed, 125 insertions, 143 deletions
diff --git a/plugins/QuickMessages/src/main.cpp b/plugins/QuickMessages/src/main.cpp
index 4939789cc0..78574ebcd0 100644
--- a/plugins/QuickMessages/src/main.cpp
+++ b/plugins/QuickMessages/src/main.cpp
@@ -43,92 +43,86 @@ PLUGININFOEX pluginInfo = {
__AUTHORWEB,
UNICODE_AWARE,
// {37ED754B-6CF9-40ED-9EB6-0FEF8E822475}
- {0x37ed754b, 0x6cf9, 0x40ed, {0x9e, 0xb6, 0xf, 0xef, 0x8e, 0x82, 0x24, 0x75}}
+ { 0x37ed754b, 0x6cf9, 0x40ed, { 0x9e, 0xb6, 0xf, 0xef, 0x8e, 0x82, 0x24, 0x75 } }
};
-int PreShutdown(WPARAM wparam,LPARAM lparam)
+int PreShutdown(WPARAM, LPARAM)
{
g_bShutDown = 1;
DestructButtonsList();
return 0;
}
-static int InputMenuPopup(WPARAM wParam,LPARAM lParam)
+static int InputMenuPopup(WPARAM, LPARAM lParam)
{
- HMENU hSubMenu=NULL;
- int i=0;
+ HMENU hSubMenu = NULL;
+ int i = 0;
MessageWindowPopupData * mwpd = (MessageWindowPopupData *)lParam;
- if(mwpd->uFlags==MSG_WINDOWPOPUP_LOG||!g_bQuickMenu||!QuickList->realCount) return 0;
+ if (mwpd->uFlags == MSG_WINDOWPOPUP_LOG || !g_bQuickMenu || !QuickList->realCount) return 0;
- if(mwpd->uType==MSG_WINDOWPOPUP_SHOWING)
- {
+ if (mwpd->uType == MSG_WINDOWPOPUP_SHOWING) {
hSubMenu = CreatePopupMenu();
- InsertMenu((HMENU)mwpd->hMenu,6,MF_STRING|MF_POPUP|MF_BYPOSITION,(UINT_PTR)hSubMenu,TranslateT("Quick Messages"));
- InsertMenu((HMENU)mwpd->hMenu,7,MF_SEPARATOR|MF_BYPOSITION,0,0);
- qsort(QuickList->items,QuickList->realCount,sizeof(QuickData *),sstQuickSortButtons);
- for(i=0;i<QuickList->realCount;i++)
- {
- QuickData* qd= (QuickData *)QuickList->items[i];
- if(qd->fEntryType&QMF_EX_SEPARATOR)
- AppendMenu(hSubMenu,MF_SEPARATOR,0,NULL);
+ InsertMenu((HMENU)mwpd->hMenu, 6, MF_STRING | MF_POPUP | MF_BYPOSITION, (UINT_PTR)hSubMenu, TranslateT("Quick Messages"));
+ InsertMenu((HMENU)mwpd->hMenu, 7, MF_SEPARATOR | MF_BYPOSITION, 0, 0);
+ qsort(QuickList->items, QuickList->realCount, sizeof(QuickData *), sstQuickSortButtons);
+ for (i = 0; i < QuickList->realCount; i++) {
+ QuickData* qd = (QuickData *)QuickList->items[i];
+ if (qd->fEntryType&QMF_EX_SEPARATOR)
+ AppendMenu(hSubMenu, MF_SEPARATOR, 0, NULL);
else
- AppendMenu(hSubMenu,MF_STRING,qd->dwPos+254,qd->ptszValueName);
+ AppendMenu(hSubMenu, MF_STRING, qd->dwPos + 254, qd->ptszValueName);
}
}
- else if(mwpd->uType==MSG_WINDOWPOPUP_SELECTED&&mwpd->selection>=254)
- {
- for(i=0;i<QuickList->realCount;i++)
- {
- QuickData* qd= (QuickData *)QuickList->items[i];
- if ((qd->dwPos+254)==mwpd->selection)
- {
+ else if (mwpd->uType == MSG_WINDOWPOPUP_SELECTED&&mwpd->selection >= 254) {
+ for (i = 0; i < QuickList->realCount; i++) {
+ QuickData* qd = (QuickData *)QuickList->items[i];
+ if ((qd->dwPos + 254) == mwpd->selection) {
CHARRANGE cr;
- UINT textlenght=0;
- TCHAR* pszText=NULL;
- TCHAR* ptszQValue=NULL;
- TCHAR* pszCBText=NULL;
- BOOL bIsService=0;
+ UINT textlenght = 0;
+ TCHAR* pszText = NULL;
+ TCHAR* ptszQValue = NULL;
+ TCHAR* pszCBText = NULL;
+ BOOL bIsService = 0;
- if(IsClipboardFormatAvailable(CF_TEXT)) {
+ if (IsClipboardFormatAvailable(CF_TEXT)) {
if (OpenClipboard(mwpd->hwnd)) {
- HANDLE hData=NULL;
- TCHAR* chBuffer=NULL;
- int textLength=0;
+ HANDLE hData = NULL;
+ TCHAR* chBuffer = NULL;
+ int textLength = 0;
- hData= GetClipboardData(CF_UNICODETEXT);
+ hData = GetClipboardData(CF_UNICODETEXT);
- chBuffer= (TCHAR*)GlobalLock(hData);
- textLength=(int)mir_tstrlen(chBuffer);
- pszCBText=mir_tstrdup(chBuffer);
+ chBuffer = (TCHAR*)GlobalLock(hData);
+ textLength = (int)mir_tstrlen(chBuffer);
+ pszCBText = mir_tstrdup(chBuffer);
GlobalUnlock(hData);
CloseClipboard();
}
}
SendMessage(mwpd->hwnd, EM_EXGETSEL, 0, (LPARAM)&cr);
- textlenght=cr.cpMax-cr.cpMin;
+ textlenght = cr.cpMax - cr.cpMin;
- if(textlenght)
- {
- pszText = (TCHAR *)mir_alloc((textlenght+10)*sizeof(TCHAR));
+ if (textlenght) {
+ pszText = (TCHAR *)mir_alloc((textlenght + 10)*sizeof(TCHAR));
memset(pszText, 0, ((textlenght + 10) * sizeof(TCHAR)));
- SendMessage(mwpd->hwnd,EM_GETSELTEXT, 0, (LPARAM)pszText);
+ SendMessage(mwpd->hwnd, EM_GETSELTEXT, 0, (LPARAM)pszText);
}
- if(qd->ptszValue){
- ptszQValue=ParseString(mwpd->hContact,qd->ptszValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)mir_tstrlen(qd->ptszValue),textlenght,pszCBText?(int)mir_tstrlen(pszCBText):0);
- if ((bIsService=qd->bIsService)&&ptszQValue)
+ if (qd->ptszValue) {
+ ptszQValue = ParseString(mwpd->hContact, qd->ptszValue, pszText ? pszText : _T(""), pszCBText ? pszCBText : _T(""), (int)mir_tstrlen(qd->ptszValue), textlenght, pszCBText ? (int)mir_tstrlen(pszCBText) : 0);
+ if ((bIsService = qd->bIsService) && ptszQValue)
- CallService(mir_u2a(ptszQValue),(WPARAM)mwpd->hContact,0);
+ CallService(mir_u2a(ptszQValue), (WPARAM)mwpd->hContact, 0);
}
- if(ptszQValue)
+ if (ptszQValue)
SendMessage(mwpd->hwnd, EM_REPLACESEL, TRUE, (LPARAM)ptszQValue);
- if(pszText) mir_free(pszText);
- if(ptszQValue) free(ptszQValue);
- if(pszCBText) mir_free(pszCBText);
+ if (pszText) mir_free(pszText);
+ if (ptszQValue) free(ptszQValue);
+ if (pszCBText) mir_free(pszCBText);
break;
}
}
@@ -137,146 +131,134 @@ static int InputMenuPopup(WPARAM wParam,LPARAM lParam)
return 0;
}
-static int CustomButtonPressed(WPARAM wParam,LPARAM lParam)
+static int CustomButtonPressed(WPARAM, LPARAM lParam)
{
- CustomButtonClickData *cbcd=(CustomButtonClickData *)lParam;
+ CustomButtonClickData *cbcd = (CustomButtonClickData *)lParam;
CHARRANGE cr;
- HWND hEdit=NULL;
- int i=0;
- BOOL bCTRL=0;
- BOOL bIsService=0;
- TCHAR* pszText=NULL;
- TCHAR* pszCBText=NULL;
- TCHAR* pszFormatedText=NULL;
- TCHAR* ptszQValue=NULL;
- int cblenght=0,qvlenght=0;
- int count=0,mode=0;
- UINT textlenght=0;
- BBButton bbd={0};
- SortedList* sl=NULL;
- int state=0;
-
- if(mir_strcmp(cbcd->pszModule,PLGNAME)) return 0;
+ HWND hEdit = NULL;
+ BOOL bCTRL = 0;
+ BOOL bIsService = 0;
+ TCHAR* pszText = NULL;
+ TCHAR* pszCBText = NULL;
+ TCHAR* ptszQValue = NULL;
+ UINT textlenght = 0;
+ SortedList* sl = NULL;
+ int state = 0;
+
+ if (mir_strcmp(cbcd->pszModule, PLGNAME)) return 0;
if (!ButtonsList[cbcd->dwButtonId]) return 1;
- sl=ButtonsList[cbcd->dwButtonId]->sl;
+ sl = ButtonsList[cbcd->dwButtonId]->sl;
if (!sl) return 1;
- if(IsClipboardFormatAvailable(CF_TEXT)) {
+ if (IsClipboardFormatAvailable(CF_TEXT)) {
if (OpenClipboard(cbcd->hwndFrom)) {
- HANDLE hData=NULL;
- TCHAR* chBuffer=NULL;
- int textLength=0;
+ HANDLE hData = NULL;
+ TCHAR* chBuffer = NULL;
+ int textLength = 0;
- hData= GetClipboardData(CF_UNICODETEXT);
+ hData = GetClipboardData(CF_UNICODETEXT);
- chBuffer= (TCHAR*)GlobalLock(hData);
- textLength=(int)mir_tstrlen(chBuffer);
- pszCBText=mir_tstrdup(chBuffer);
+ chBuffer = (TCHAR*)GlobalLock(hData);
+ textLength = (int)mir_tstrlen(chBuffer);
+ pszCBText = mir_tstrdup(chBuffer);
GlobalUnlock(hData);
CloseClipboard();
}
}
- qsort(sl->items,sl->realCount,sizeof(ButtonData *),sstSortButtons);
+ qsort(sl->items, sl->realCount, sizeof(ButtonData *), sstSortButtons);
- hEdit=GetDlgItem(cbcd->hwndFrom,IDC_MESSAGE);
- if (!hEdit) hEdit=GetDlgItem(cbcd->hwndFrom,IDC_CHATMESSAGE);
+ hEdit = GetDlgItem(cbcd->hwndFrom, IDC_MESSAGE);
+ if (!hEdit) hEdit = GetDlgItem(cbcd->hwndFrom, IDC_CHATMESSAGE);
cr.cpMin = cr.cpMax = 0;
SendMessage(hEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
- textlenght=cr.cpMax-cr.cpMin;
- if(textlenght)
- {
- pszText = (TCHAR *)mir_alloc((textlenght+10)*sizeof(TCHAR));
+ textlenght = cr.cpMax - cr.cpMin;
+ if (textlenght) {
+ pszText = (TCHAR *)mir_alloc((textlenght + 10)*sizeof(TCHAR));
memset(pszText, 0, ((textlenght + 10) * sizeof(TCHAR)));
- SendMessage(hEdit,EM_GETSELTEXT, 0, (LPARAM)pszText);
+ SendMessage(hEdit, EM_GETSELTEXT, 0, (LPARAM)pszText);
}
- if(cbcd->flags&BBCF_RIGHTBUTTON)
- state=1;
- else if(sl->realCount==1)
- state=2;
+ if (cbcd->flags&BBCF_RIGHTBUTTON)
+ state = 1;
+ else if (sl->realCount == 1)
+ state = 2;
else
- state=3;
+ state = 3;
- switch(state) {
+ switch (state) {
case 1:
- if(ButtonsList[cbcd->dwButtonId]->ptszQValue)
- ptszQValue = ParseString(cbcd->hContact,ButtonsList[cbcd->dwButtonId]->ptszQValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)mir_tstrlen(ButtonsList[cbcd->dwButtonId]->ptszQValue),textlenght,pszCBText?(int)mir_tstrlen(pszCBText):0);
+ if (ButtonsList[cbcd->dwButtonId]->ptszQValue)
+ ptszQValue = ParseString(cbcd->hContact, ButtonsList[cbcd->dwButtonId]->ptszQValue, pszText ? pszText : _T(""), pszCBText ? pszCBText : _T(""), (int)mir_tstrlen(ButtonsList[cbcd->dwButtonId]->ptszQValue), textlenght, pszCBText ? (int)mir_tstrlen(pszCBText) : 0);
if ((bIsService = ButtonsList[cbcd->dwButtonId]->bIsServName) && ptszQValue)
- CallService(mir_u2a(ptszQValue),(WPARAM)cbcd->hContact,0);
+ CallService(mir_u2a(ptszQValue), (WPARAM)cbcd->hContact, 0);
break;
case 2:
{
ButtonData *bd = (ButtonData *)sl->items[0];
- if(bd && bd->pszValue){
- ptszQValue = ParseString(cbcd->hContact,bd->pszValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)mir_tstrlen(bd->pszValue),textlenght,pszCBText?(int)mir_tstrlen(pszCBText):0);
- if ((bIsService = bd->bIsServName)&&ptszQValue)
- CallService(mir_u2a(ptszQValue),(WPARAM)cbcd->hContact,0);
+ if (bd && bd->pszValue) {
+ ptszQValue = ParseString(cbcd->hContact, bd->pszValue, pszText ? pszText : _T(""), pszCBText ? pszCBText : _T(""), (int)mir_tstrlen(bd->pszValue), textlenght, pszCBText ? (int)mir_tstrlen(pszCBText) : 0);
+ if ((bIsService = bd->bIsServName) && ptszQValue)
+ CallService(mir_u2a(ptszQValue), (WPARAM)cbcd->hContact, 0);
}
}
break;
case 3:
- int res=0;
- int menunum;
- ButtonData * bd=NULL;
- HMENU hMenu=NULL,hSubMenu=NULL;
- BOOL bSetPopupMark=FALSE;
-
- if(g_iButtonsCount){
- hMenu = CreatePopupMenu();
- }
- else break;
- for(menunum=0;menunum<sl->realCount;menunum++)
- {
- bd=(ButtonData *)sl->items[menunum];
- if(bd->dwOPFlags&QMF_NEW)
+ if (!g_iButtonsCount)
+ break;
+
+ HMENU hMenu = CreatePopupMenu(), hSubMenu = NULL;
+
+ for (int menunum = 0; menunum < sl->realCount; menunum++) {
+ ButtonData *bd = (ButtonData *)sl->items[menunum];
+ if (bd->dwOPFlags&QMF_NEW)
continue;
- bSetPopupMark=FALSE;
- if(bd->pszValue==0&&bd->fEntryType==0)
- {
+ BOOL bSetPopupMark = FALSE;
+ if (bd->pszValue == 0 && bd->fEntryType == 0) {
hSubMenu = CreatePopupMenu();
- bSetPopupMark=TRUE;
+ bSetPopupMark = TRUE;
}
- if(bd->pszValue&&bd->fEntryType==0)
- hSubMenu=NULL;
+ if (bd->pszValue && bd->fEntryType == 0)
+ hSubMenu = NULL;
- if(bd->fEntryType&QMF_EX_SEPARATOR)
- AppendMenu((HMENU)((hSubMenu&&!bSetPopupMark)?hSubMenu:hMenu),MF_SEPARATOR,0,NULL);
+ if (bd->fEntryType&QMF_EX_SEPARATOR)
+ AppendMenu((HMENU)((hSubMenu && !bSetPopupMark) ? hSubMenu : hMenu), MF_SEPARATOR, 0, NULL);
else
- AppendMenu((HMENU)((hSubMenu&&!bSetPopupMark)?hSubMenu:hMenu),
- MF_STRING|(bSetPopupMark?MF_POPUP:0),
- (bSetPopupMark?(UINT_PTR)hSubMenu:(menunum+1)), bd->pszName);
+ AppendMenu((HMENU)((hSubMenu && !bSetPopupMark) ? hSubMenu : hMenu),
+ MF_STRING | (bSetPopupMark ? MF_POPUP : 0),
+ (bSetPopupMark ? (UINT_PTR)hSubMenu : (menunum + 1)), bd->pszName);
}
- res = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbcd->pt.x, cbcd->pt.y, 0, cbcd->hwndFrom, NULL);
- if(res==0) break;
+ int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbcd->pt.x, cbcd->pt.y, 0, cbcd->hwndFrom, NULL);
+ if (res == 0)
+ break;
- bd= (ButtonData *)sl->items[res-1];
- bCTRL=(GetKeyState(VK_CONTROL)&0x8000)?1:0;
- if(bd->pszValue){
- ptszQValue=ParseString(cbcd->hContact,bd->pszValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)mir_tstrlen(bd->pszValue),textlenght,pszCBText?(int)mir_tstrlen(pszCBText):0);
- if ((bIsService=bd->bIsServName)&&ptszQValue)
- CallService(mir_u2a(ptszQValue),(WPARAM)cbcd->hContact,0);
+ ButtonData *bd = (ButtonData *)sl->items[res - 1];
+ bCTRL = (GetKeyState(VK_CONTROL) & 0x8000) ? 1 : 0;
+ if (bd->pszValue) {
+ ptszQValue = ParseString(cbcd->hContact, bd->pszValue, pszText ? pszText : _T(""), pszCBText ? pszCBText : _T(""), (int)mir_tstrlen(bd->pszValue), textlenght, pszCBText ? (int)mir_tstrlen(pszCBText) : 0);
+ if ((bIsService = bd->bIsServName) && ptszQValue)
+ CallService(mir_u2a(ptszQValue), (WPARAM)cbcd->hContact, 0);
}
break;
}
- if(ptszQValue) {
+ if (ptszQValue) {
if (!bIsService) {
SendMessage(hEdit, EM_REPLACESEL, TRUE, (LPARAM)ptszQValue);
- if ((g_bLClickAuto&&state!=1)||(g_bRClickAuto&&state==1)||cbcd->flags&BBCF_CONTROLPRESSED||bCTRL)
- SendMessage(cbcd->hwndFrom, WM_COMMAND,IDOK,0);
+ if ((g_bLClickAuto&&state != 1) || (g_bRClickAuto&&state == 1) || cbcd->flags&BBCF_CONTROLPRESSED || bCTRL)
+ SendMessage(cbcd->hwndFrom, WM_COMMAND, IDOK, 0);
}
free(ptszQValue);
}
@@ -287,7 +269,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam)
return 1;
}
-static int PluginInit(WPARAM wparam,LPARAM lparam)
+static int PluginInit(WPARAM, LPARAM)
{
g_bStartup = 1;
HookEvent(ME_OPT_INITIALISE, OptionsInit);
@@ -295,10 +277,10 @@ static int PluginInit(WPARAM wparam,LPARAM lparam)
HookEvent(ME_MSG_TOOLBARLOADED, RegisterCustomButton);
HookEvent(ME_MSG_WINDOWPOPUP, InputMenuPopup);
- g_bRClickAuto = db_get_b(NULL,PLGNAME,"RClickAuto",0);
- g_bLClickAuto = db_get_b(NULL,PLGNAME,"LClickAuto",0);
- g_iButtonsCount = db_get_b(NULL, PLGNAME,"ButtonsCount", 0);
- g_bQuickMenu = db_get_b(NULL, PLGNAME,"QuickMenu", 1);
+ g_bRClickAuto = db_get_b(NULL, PLGNAME, "RClickAuto", 0);
+ g_bLClickAuto = db_get_b(NULL, PLGNAME, "LClickAuto", 0);
+ g_iButtonsCount = db_get_b(NULL, PLGNAME, "ButtonsCount", 0);
+ g_bQuickMenu = db_get_b(NULL, PLGNAME, "QuickMenu", 1);
InitButtonsList();
@@ -306,7 +288,7 @@ static int PluginInit(WPARAM wparam,LPARAM lparam)
return 0;
}
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
@@ -316,7 +298,7 @@ extern "C" __declspec(dllexport) int Unload(void)
return 0;
}
-BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinst, DWORD, LPVOID)
{
hinstance = hinst;
return 1;
@@ -327,7 +309,7 @@ extern "C" __declspec(dllexport) int Load(void)
mir_getLP(&pluginInfo);
mir_getCLI();
- HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit);
- HookEvent(ME_SYSTEM_PRESHUTDOWN,PreShutdown);
+ HookEvent(ME_SYSTEM_MODULESLOADED, PluginInit);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
return 0;
}