diff options
53 files changed, 881 insertions, 1030 deletions
diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp index 4a65c58406..0057cad393 100644 --- a/plugins/Alarms/src/alarmlist.cpp +++ b/plugins/Alarms/src/alarmlist.cpp @@ -532,16 +532,11 @@ void ShowPopup(ALARM *alarm) { memset(data, 0, sizeof(ALARM));
copy_alarm_data(data, alarm);
- POPUPDATAT ppd;
-
- ZeroMemory(&ppd, sizeof(ppd));
- ppd.lchContact = 0;
+ POPUPDATAT ppd = { 0 };
ppd.lchIcon = hIconMenuSet;
lstrcpy(ppd.lptzContactName, data->szTitle);
lstrcpy(ppd.lptzText, data->szDesc);
- ppd.colorBack = 0;
- ppd.colorText = 0;
ppd.PluginWindowProc = (WNDPROC)PopupAlarmDlgProc;
ppd.PluginData = data;
ppd.iSeconds = -1;
@@ -614,9 +609,7 @@ void DoAlarm(ALARM *alarm) { if (alarm->action & AAF_SYSTRAY)
{
- CLISTEVENT cle = {0};
- cle.cbSize = sizeof(cle);
- cle.hContact = 0;
+ CLISTEVENT cle = { sizeof(cle) };
cle.hIcon = hIconSystray;
cle.ptszTooltip = alarm->szTitle;
cle.flags = CLEF_ONLYAFEW | CLEF_TCHAR;
diff --git a/plugins/Alarms/src/icons.cpp b/plugins/Alarms/src/icons.cpp index d1f1fc7e93..d02534df31 100644 --- a/plugins/Alarms/src/icons.cpp +++ b/plugins/Alarms/src/icons.cpp @@ -1,8 +1,6 @@ #include "common.h"
#include "icons.h"
-HANDLE hIcoLibIconsChanged;
-
HICON hIconMenuSet, hIconList1, hIconList2, hIconMenuShowHide, hIconSystray;
int ReloadIcons(WPARAM wParam, LPARAM lParam)
@@ -10,7 +8,7 @@ int ReloadIcons(WPARAM wParam, LPARAM lParam) hIconMenuSet = Skin_GetIcon("alarms_menu_set");
hIconList1 = Skin_GetIcon("alarms_list1");
hIconList2 = Skin_GetIcon("alarms_list2");
- if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
+ if ( !ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
hIconMenuShowHide = Skin_GetIcon("alarms_menu_showhide");
RefreshReminderFrame();
@@ -19,44 +17,42 @@ int ReloadIcons(WPARAM wParam, LPARAM lParam) void InitIcons()
{
- SKINICONDESC sid = {0};
+ TCHAR path[MAX_PATH]; + GetModuleFileName(hInst, path, MAX_PATH); - sid.cbSize = sizeof(SKINICONDESC);
+ SKINICONDESC sid = { sizeof(sid) };
sid.pszSection = "Alarms";
+ sid.ptszDefaultFile = path;
+ sid.flags = SIDF_PATH_TCHAR;
- sid.pszDescription = "Menu: Set Alarm";
+ sid.pszDescription = LPGEN("Menu: Set Alarm");
sid.pszName = "alarms_menu_set";
sid.pszDefaultFile = "alarms.dll";
- sid.iDefaultIndex = 0;
- sid.hDefaultIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MAINMENU), IMAGE_ICON, 16, 16, 0);
+ sid.iDefaultIndex = -IDI_MAINMENU;
Skin_AddIcon(&sid);
- sid.pszDescription = "Reminder: Soon";
+ sid.pszDescription = LPGEN("Reminder: Soon");
sid.pszName = "alarms_list1";
sid.pszDefaultFile = "alarms.dll";
- sid.iDefaultIndex = 1;
- sid.hDefaultIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_LIST1), IMAGE_ICON, 16, 16, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS ); Skin_AddIcon(&sid);
+ sid.iDefaultIndex = -IDI_LIST1;
- sid.pszDescription = "Reminder: Very Soon";
+ sid.pszDescription = LPGEN("Reminder: Very Soon");
sid.pszName = "alarms_list2";
sid.pszDefaultFile = "alarms.dll";
- sid.iDefaultIndex = 2;
- sid.hDefaultIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_LIST2), IMAGE_ICON, 16, 16, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS );
+ sid.iDefaultIndex = -IDI_LIST2;
Skin_AddIcon(&sid);
- sid.pszDescription = "Alarm: System Tray";
+ sid.pszDescription = LPGEN("Alarm: System Tray");
sid.pszName = "alarms_systray";
sid.pszDefaultFile = "alarms.dll";
- sid.iDefaultIndex = 3;
- sid.hDefaultIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MAINMENU), IMAGE_ICON, 16, 16, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS );
+ sid.iDefaultIndex = -IDI_MAINMENU;
Skin_AddIcon(&sid);
- if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
- sid.pszDescription = "Menu: Show/Hide Reminders";
+ if ( !ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
+ sid.pszDescription = LPGEN("Menu: Show/Hide Reminders");
sid.pszName = "alarms_menu_showhide";
sid.pszDefaultFile = "alarms.dll";
- sid.iDefaultIndex = 4;
- sid.hDefaultIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MAINMENU), IMAGE_ICON, 16, 16, 0);
+ sid.iDefaultIndex = -IDI_MAINMENU;
Skin_AddIcon(&sid);
hIconMenuShowHide = Skin_GetIcon("alarms_menu_showhide");
@@ -67,5 +63,5 @@ void InitIcons() hIconList2 = Skin_GetIcon("alarms_list2");
hIconSystray = Skin_GetIcon("alarms_systray");
- hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
+ HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
}
diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp index 9670795a4e..6c547a4d5c 100644 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -693,8 +693,8 @@ void AddMenuItem() if (hMainMenuItem) return;
CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_ALL;
- mi.hIcon = hIconMenuSet;
+ mi.flags = CMIM_ALL | CMIF_ICONFROMICOLIB;
+ mi.icolibItem = Skin_GetIconHandle("alarms_menu_set");;
mi.pszName = "Set Alarm";
mi.pszService = MODULE "/NewAlarm";
mi.position = 500010000;
diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp index c6dd625531..90e3356cfe 100644 --- a/plugins/AutoShutdown/src/utils.cpp +++ b/plugins/AutoShutdown/src/utils.cpp @@ -274,20 +274,18 @@ int FontService_GetColor(const TCHAR *pszSection,const TCHAR *pszDescription,COL HANDLE IcoLib_AddIconRes(const char *pszDbName,const TCHAR *pszSection,const TCHAR *pszDesc,HINSTANCE hInst,WORD idRes,BOOL fLarge)
{
- SKINICONDESC sid;
TCHAR szFileName[MAX_PATH];
- sid.cbSize=sizeof(SKINICONDESC);
- sid.pszName=(char*)pszDbName;
- sid.ptszSection=(TCHAR*)pszSection;
- sid.ptszDescription=(TCHAR*)pszDesc;
- sid.ptszDefaultFile=szFileName;
- sid.iDefaultIndex=-idRes;
- sid.cx=GetSystemMetrics(fLarge?SM_CXICON:SM_CXSMICON);
- sid.cy=GetSystemMetrics(fLarge?SM_CYICON:SM_CYSMICON);
- sid.hDefaultIcon=NULL;
- sid.flags=SIDF_SORTED|SIDF_ALL_TCHAR;
- if(!GetModuleFileName(hInst,szFileName,SIZEOF(szFileName)))
- return NULL;
+ GetModuleFileName(hInst,szFileName,SIZEOF(szFileName));
+
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.pszName = (char*)pszDbName;
+ sid.ptszSection = (TCHAR*)pszSection;
+ sid.ptszDescription = (TCHAR*)pszDesc;
+ sid.ptszDefaultFile = szFileName;
+ sid.iDefaultIndex = -idRes;
+ sid.cx = GetSystemMetrics(fLarge?SM_CXICON:SM_CXSMICON);
+ sid.cy = GetSystemMetrics(fLarge?SM_CYICON:SM_CYSMICON);
+ sid.flags = SIDF_SORTED | SIDF_ALL_TCHAR;
return Skin_AddIcon(&sid);
}
diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp index 0c6175e7cc..12de0bd957 100644 --- a/plugins/Clist_modern/src/modern_clistmenus.cpp +++ b/plugins/Clist_modern/src/modern_clistmenus.cpp @@ -143,7 +143,7 @@ static int FAV_OnContactMenuBuild(WPARAM wParam,LPARAM lParam) }
for (i=0; i < SIZEOF(rates); i++) {
- mi.hIcon = mi.hIcon = CLUI_LoadIconFromExternalFile("clisticons.dll",8+i,TRUE,TRUE,iconsName[i],"Contact List",Translate(iconsName[i]),-IDI_FAVORITE_0 - i, &NeedFree);
+ mi.hIcon = CLUI_LoadIconFromExternalFile("clisticons.dll",8+i,TRUE,TRUE,iconsName[i],"Contact List",Translate(iconsName[i]),-IDI_FAVORITE_0 - i, &NeedFree);
mi.ptszName = rates[i];
mi.flags = CMIF_CHILDPOPUP|CMIF_TCHAR|((bContactRate == i)?CMIF_CHECKED:0);
mi.pszService = CLUI_FAVSETRATE;
diff --git a/plugins/ExternalAPI/m_msg_buttonsbar.h b/plugins/ExternalAPI/m_msg_buttonsbar.h index 8a55627b40..f5bb94d173 100644 --- a/plugins/ExternalAPI/m_msg_buttonsbar.h +++ b/plugins/ExternalAPI/m_msg_buttonsbar.h @@ -99,22 +99,22 @@ typedef struct { #define BBBF_CREATEBYID (1<<11) //only for tabsrmm internal use
typedef struct _tagBBButton
- {
- int cbSize; // size of structure
+{
+ int cbSize; // size of structure
- DWORD dwButtonID; // your button ID, will be combined with pszModuleName for storing settings, etc...
+ DWORD dwButtonID; // your button ID, will be combined with pszModuleName for storing settings, etc...
- char* pszModuleName; //module name without spaces and underline symbols (e.g. "tabsrmm")
+ char* pszModuleName; //module name without spaces and underline symbols (e.g. "tabsrmm")
union{
- char* pszTooltip; //button's tooltip
- TCHAR* ptszTooltip;
- };
- DWORD dwDefPos; // default order pos of button, counted from window edge (left or right)
- // use value >100, because internal buttons using 10,20,30... 80, etc
- int iButtonWidth; // must be 0
- DWORD bbbFlags; // combine of BBBF_ flags above
- HANDLE hIcon; //Handle to icolib registered icon, it's better to register with pszSection = "TabSRMM/Toolbar"
- }BBButton;
-
+ char* pszTooltip; //button's tooltip
+ TCHAR* ptszTooltip;
+ };
+ DWORD dwDefPos; // default order pos of button, counted from window edge (left or right)
+ // use value >100, because internal buttons using 10,20,30... 80, etc
+ int iButtonWidth; // must be 0
+ DWORD bbbFlags; // combine of BBBF_ flags above
+ HANDLE hIcon; // Handle to icolib registered icon, it's better to register with pszSection = "TabSRMM/Toolbar"
+}
+ BBButton;
#endif //M_MSG_BUTTONSBAR_H__
\ No newline at end of file diff --git a/plugins/ListeningTo/listeningto.vcxproj b/plugins/ListeningTo/listeningto.vcxproj index a6dc936469..b51b23536b 100644 --- a/plugins/ListeningTo/listeningto.vcxproj +++ b/plugins/ListeningTo/listeningto.vcxproj @@ -171,7 +171,6 @@ <ItemGroup>
<ClInclude Include="src\commons.h" />
<ClInclude Include="..\utils\mir_buffer.h" />
- <ClInclude Include="..\utils\mir_icons.h" />
<ClInclude Include="..\utils\mir_memory.h" />
<ClInclude Include="..\utils\mir_options.h" />
<ClInclude Include="src\music.h" />
diff --git a/plugins/ListeningTo/listeningto.vcxproj.filters b/plugins/ListeningTo/listeningto.vcxproj.filters index 0f53e25820..10a77c6931 100644 --- a/plugins/ListeningTo/listeningto.vcxproj.filters +++ b/plugins/ListeningTo/listeningto.vcxproj.filters @@ -24,9 +24,6 @@ <ClInclude Include="..\utils\mir_buffer.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\utils\mir_icons.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="..\utils\mir_memory.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp index 52b8fb2666..5d8ab4836c 100644 --- a/plugins/MyDetails/src/mydetails.cpp +++ b/plugins/MyDetails/src/mydetails.cpp @@ -199,34 +199,33 @@ static int MainInit(WPARAM wparam,LPARAM lparam) InitFrames();
+ TCHAR tszPath[MAX_PATH];
+ GetModuleFileName(hInst, tszPath, SIZEOF(tszPath));
+
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.flags = SIDF_PATH_TCHAR;
+ sid.ptszDefaultFile = tszPath;
+
if ( Skin_GetIcon("LISTENING_TO_ICON") == NULL) {
- SKINICONDESC sid = { sizeof(SKINICONDESC) };
- sid.flags = SIDF_TCHAR;
- sid.ptszSection = LPGENT("Contact List");
- sid.ptszDescription = LPGENT("Listening to");
+ sid.pszSection = LPGEN("Contact List");
+ sid.pszDescription = LPGEN("Listening to");
sid.pszName = "LISTENING_TO_ICON";
- sid.hDefaultIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LISTENINGTO));
- Skin_AddIcon(&sid);
- }
- {
- SKINICONDESC sid = { sizeof(SKINICONDESC) };
- sid.flags = SIDF_TCHAR;
- sid.ptszSection = LPGENT("My Details");
- sid.ptszDescription = LPGENT("Previous protocol");
- sid.pszName = "MYDETAILS_PREV_PROTOCOL";
- sid.hDefaultIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LEFT_ARROW));
- Skin_AddIcon(&sid);
- }
- {
- SKINICONDESC sid = { sizeof(SKINICONDESC) };
- sid.flags = SIDF_TCHAR;
- sid.ptszSection = LPGENT("My Details");
- sid.ptszDescription = LPGENT("Next protocol");
- sid.pszName = "MYDETAILS_NEXT_PROTOCOL";
- sid.hDefaultIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_RIGHT_ARROW));
+ sid.iDefaultIndex = -IDI_LISTENINGTO;
Skin_AddIcon(&sid);
}
+ sid.pszSection = LPGEN("My Details");
+ sid.pszDescription = LPGEN("Previous protocol");
+ sid.pszName = "MYDETAILS_PREV_PROTOCOL";
+ sid.iDefaultIndex = -IDI_LEFT_ARROW;
+ Skin_AddIcon(&sid);
+
+ sid.pszSection = LPGEN("My Details");
+ sid.pszDescription = LPGEN("Next protocol");
+ sid.pszName = "MYDETAILS_NEXT_PROTOCOL";
+ sid.iDefaultIndex = -IDI_RIGHT_ARROW;
+ Skin_AddIcon(&sid);
+
return 0;
}
diff --git a/plugins/New_GPG/src/icons.cpp b/plugins/New_GPG/src/icons.cpp index 90ad051b75..890a7abbf5 100755 --- a/plugins/New_GPG/src/icons.cpp +++ b/plugins/New_GPG/src/icons.cpp @@ -16,41 +16,30 @@ #include "commonheaders.h"
-HANDLE IconLibDefine(TCHAR* desc, TCHAR* section, char* ident, HICON icon, char* def_file, int def_idx, int size)
-{
- SKINICONDESC sid = {0};
- HANDLE hIcon;
-
- if(!size)
- size = 16;
+extern HINSTANCE hInst;
- sid.cbSize = sizeof( SKINICONDESC );
- sid.ptszSection = section;
- sid.ptszDescription = desc;
- sid.flags = SIDF_TCHAR;
+HANDLE IconLibDefine(char* desc, char* ident, TCHAR* def_file, int def_idx)
+{
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.pszSection = szGPGModuleName;
+ sid.pszDescription = desc;
+ sid.flags = SIDF_PATH_TCHAR;
sid.pszName = ident;
- sid.pszDefaultFile = def_file;
- sid.iDefaultIndex = def_idx;
- sid.hDefaultIcon = icon;
- sid.cx = sid.cy = size;
-
- hIcon = Skin_AddIcon(&sid);
-
- return hIcon;
+ sid.ptszDefaultFile = def_file;
+ sid.iDefaultIndex = -def_idx;
+ sid.cx = sid.cy = 16;
+ return Skin_AddIcon(&sid);
}
void InitIconLib()
{
- extern HINSTANCE hInst;
- char lib[MAX_PATH];
- GetModuleFileNameA(hInst, lib, MAX_PATH);
- TCHAR *module = mir_a2t(szGPGModuleName);
+ TCHAR lib[MAX_PATH];
+ GetModuleFileName(hInst, lib, MAX_PATH);
- IconLibDefine(_T("Secured"), module, "secured", NULL, lib, -IDI_SECURED,0);
- IconLibDefine(_T("Unsecured"), module, "unsecured", NULL, lib, -IDI_UNSECURED,0);
- mir_free(module);
+ IconLibDefine( "Secured", "secured", lib, IDI_SECURED);
+ IconLibDefine( "Unsecured", "unsecured", lib, IDI_UNSECURED);
}
HICON IconLibGetIcon(const char* ident)
diff --git a/plugins/NoHistory/src/icons.cpp b/plugins/NoHistory/src/icons.cpp index 6bfff6a424..bb13603c41 100644 --- a/plugins/NoHistory/src/icons.cpp +++ b/plugins/NoHistory/src/icons.cpp @@ -13,34 +13,33 @@ int ReloadIcons(WPARAM wParam, LPARAM lParam) { return 0;
}
-void InitIcons() {
- SKINICONDESC sid = {0};
- sid.cbSize = sizeof(SKINICONDESC);
+void InitIcons()
+{
+ SKINICONDESC sid = { sizeof(sid) };
- sid.ptszSection = _T(MODULE);
- sid.flags = SIDF_ALL_TCHAR;
+ sid.pszSection = MODULE;
+ sid.flags = SIDF_PATH_TCHAR;
- TCHAR path[MAX_PATH];
- GetModuleFileName(hInst,path,MAX_PATH);
+ TCHAR path[MAX_PATH];
+ GetModuleFileName(hInst,path,MAX_PATH);
+ sid.ptszDefaultFile = path;
-#define AddIcon(x,y,z) \
- sid.ptszDescription = x; \
- sid.pszName = y; \
- sid.ptszDefaultFile = path; \
- sid.hDefaultIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(z), IMAGE_ICON, 0, 0, 0); \
- Skin_AddIcon(&sid); \
- sid.iDefaultIndex++;
+#define AddIcon(x,y,z) \
+ sid.pszDescription = x; \
+ sid.pszName = y; \
+ sid.iDefaultIndex = -z; \
+ Skin_AddIcon(&sid); \
+ sid.iDefaultIndex++;
- AddIcon(LPGENT("Disable"), MODULE "_remove", IDI_HREMOVE);
- AddIcon(LPGENT("Enable"), MODULE "_keep", IDI_HKEEP);
- AddIcon(LPGENT("Clear"), MODULE "_clear", IDI_HCLEAR);
+ AddIcon( LPGEN("Disable"), MODULE "_remove", IDI_HREMOVE);
+ AddIcon( LPGEN("Enable"), MODULE "_keep", IDI_HKEEP);
+ AddIcon( LPGEN("Clear"), MODULE "_clear", IDI_HCLEAR);
#undef AddIcon
- ReloadIcons(0, 0);
-
- hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
+ ReloadIcons(0, 0);
+ hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
}
void DeinitIcons() {
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index 580153ada9..7921fce8a9 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -366,19 +366,16 @@ void RegisterToDbeditorpp(void) void LoadIcons(void)
{
//Load icons
- SKINICONDESC sid = {0};
TCHAR szFilename[MAX_PATH];
GetModuleFileName(hInst,szFilename,MAX_PATH);
- sid.cbSize = sizeof(sid);
- sid.flags = SIDF_ALL_TCHAR;
- sid.ptszSection = LPGENT("Nudge");
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.flags = SIDF_PATH_TCHAR;
+ sid.pszSection = LPGEN("Nudge");
sid.ptszDefaultFile = szFilename;
-
sid.pszName = "Nudge_Default";
- sid.ptszDescription = LPGENT("Nudge as Default");
+ sid.pszDescription = LPGEN("Nudge as Default");
sid.iDefaultIndex = -IDI_NUDGE;
- sid.hDefaultIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_NUDGE));
g_hIcon = Skin_AddIcon(&sid);
}
@@ -750,15 +747,13 @@ void Nudge_AddAccount(PROTOACCOUNT *proto) GetModuleFileName(hInst,szFilename,MAX_PATH);
mir_sntprintf(iconDesc, SIZEOF(iconDesc), TranslateT("Nudge for %s"), proto->tszAccountName);
- SKINICONDESC sid = {0};
- sid.cbSize = sizeof(sid);
+ SKINICONDESC sid = { sizeof(sid) };
sid.flags = SIDF_ALL_TCHAR;
sid.ptszSection = LPGENT("Nudge");
sid.ptszDefaultFile = szFilename;
sid.pszName = iconName;
sid.ptszDescription = iconDesc;
sid.iDefaultIndex = -IDI_NUDGE;
- sid.hDefaultIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_NUDGE));
newNudge->item.hIcoLibItem = Skin_AddIcon(&sid);
//Add contact menu entry
diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index faf65423de..4350fe2e16 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -314,7 +314,8 @@ int ReloadIcons(WPARAM wParam, LPARAM lParam) { return 0;
}
-void InitUtils() {
+void InitUtils()
+{
TCHAR file[MAX_PATH];
GetModuleFileName(hInst,file,MAX_PATH);
{
@@ -322,40 +323,36 @@ void InitUtils() { sid.cbSize = sizeof(SKINICONDESC);
sid.ptszSection = LPGENT("Ping");
- sid.flags = SIDF_ALL_TCHAR;
+ sid.flags = SIDF_PATH_TCHAR;
- sid.pszDescription = LPGENT("Responding");
+ sid.pszDescription = LPGEN("Responding");
sid.pszName = "ping_responding";
sid.ptszDefaultFile = file;
- sid.iDefaultIndex = 0;
- sid.hDefaultIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON_RESPONDING), IMAGE_ICON, 16, 16, 0);
+ sid.iDefaultIndex = -IDI_ICON_RESPONDING;
Skin_AddIcon(&sid);
- sid.pszDescription = LPGENT("Not Responding");
+ sid.pszDescription = LPGEN("Not Responding");
sid.pszName = "ping_not_responding";
sid.ptszDefaultFile = file;
- sid.iDefaultIndex = 1;
- sid.hDefaultIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON_NOTRESPONDING), IMAGE_ICON, 16, 16, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS );
+ sid.iDefaultIndex = -IDI_ICON_NOTRESPONDING;
Skin_AddIcon(&sid);
- sid.pszDescription = LPGENT("Testing");
+ sid.pszDescription = LPGEN("Testing");
sid.pszName = "ping_testing";
sid.ptszDefaultFile = file;
- sid.iDefaultIndex = 2;
- sid.hDefaultIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON_TESTING), IMAGE_ICON, 16, 16, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS );
+ sid.iDefaultIndex = -IDI_ICON_TESTING;
Skin_AddIcon(&sid);
- sid.pszDescription = LPGENT("Disabled");
+ sid.pszDescription = LPGEN("Disabled");
sid.pszName = "ping_disabled";
sid.ptszDefaultFile = file;
- sid.iDefaultIndex = 3;
- sid.hDefaultIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON_DISABLED), IMAGE_ICON, 16, 16, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS );
+ sid.iDefaultIndex = -IDI_ICON_DISABLED;
Skin_AddIcon(&sid);
- hIconResponding = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"ping_responding");
- hIconNotResponding = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"ping_not_responding");
- hIconTesting = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"ping_testing");
- hIconDisabled = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"ping_disabled");
+ hIconResponding = Skin_GetIcon("ping_responding");
+ hIconNotResponding = Skin_GetIcon("ping_not_responding");
+ hIconTesting = Skin_GetIcon("ping_testing");
+ hIconDisabled = Skin_GetIcon("ping_disabled");
hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
}
diff --git a/plugins/Popup/src/icons.cpp b/plugins/Popup/src/icons.cpp index 32594dd464..b1ee0142c0 100644 --- a/plugins/Popup/src/icons.cpp +++ b/plugins/Popup/src/icons.cpp @@ -32,52 +32,49 @@ Last change by : $Author: Merlin_de $ #include "headers.h"
-typedef struct _ICODESC
+struct
{
LPSTR pszName;
- LPTSTR ptszDesc;
- LPTSTR ptszSection;
- BOOL bfromIconPack;
+ LPSTR ptszDesc;
+ LPSTR ptszSection;
WORD idResource;
LPSTR pszIcon;
int size;
-} ICODESC;
-
-static ICODESC icoDesc[] =
+}
+static icoDesc[] =
{
//toolbar
- { ICO_TB_POPUP_ON, _T("Popups are enabled"), _T(SECT_TOLBAR), 0, IDI_POPUP, NULL, 0 },
- { ICO_TB_POPUP_OFF, _T("Popups are disabled"), _T(SECT_TOLBAR), 0, IDI_NOPOPUP, NULL, 0 },
+ { ICO_TB_POPUP_ON, "Popups are enabled", SECT_TOLBAR, IDI_POPUP, NULL, 0 },
+ { ICO_TB_POPUP_OFF, "Popups are disabled", SECT_TOLBAR, IDI_NOPOPUP, NULL, 0 },
+
//common popup
- { ICO_POPUP_ON, _T("Popups are enabled"), _T(SECT_POPUP), 0, IDI_POPUP, NULL, 0 },
- { ICO_POPUP_OFF, _T("Popups are disabled"), _T(SECT_POPUP), 0, IDI_NOPOPUP, NULL, 0 },
- { ICO_FAV, _T("With \"favourite\" overlay"), _T(SECT_POPUP), 0, IDI_PU_FAVOURITE, NULL, 0 },
- { ICO_FULLSCREEN, _T("With \"fullscreen\" overlay"), _T(SECT_POPUP), 0, IDI_PU_FULLSCREEN, NULL, 0 },
- { ICO_HISTORY, _T("Popup History"), _T(SECT_POPUP), 0, IDI_HISTORY, NULL, -1 },
- //misc (register is done inside notification service)
- //{ ICO_MISC_NOTIFY, _T("Notification"), _T(SECT_POPUP) _T(SECT_POPUP_MISC), 0, IDI_MB_INFO, NULL, 0 },
- //{ ICO_MISC_WARNING, _T("Warning"), _T(SECT_POPUP) _T(SECT_POPUP_MISC), 0, IDI_MB_WARN, NULL, 0 },
- //{ ICO_MISC_ERROR, _T("Error"), _T(SECT_POPUP) _T(SECT_POPUP_MISC), 0, IDI_MB_STOP, NULL, 0 },
+ { ICO_POPUP_ON, "Popups are enabled", SECT_POPUP, IDI_POPUP, NULL, 0 },
+ { ICO_POPUP_OFF, "Popups are disabled", SECT_POPUP, IDI_NOPOPUP, NULL, 0 },
+ { ICO_FAV, "With \"favourite\" overlay", SECT_POPUP, IDI_PU_FAVOURITE, NULL, 0 },
+ { ICO_FULLSCREEN, "With \"fullscreen\" overlay", SECT_POPUP, IDI_PU_FULLSCREEN, NULL, 0 },
+ { ICO_HISTORY, "Popup History", SECT_POPUP, IDI_HISTORY, NULL, -1 },
+
//option
- { ICO_OPT_RELOAD, _T("Refresh skin list"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_RELOAD, NULL, 0 },
- { ICO_OPT_RESIZE, _T("Popup Placement"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_RESIZE, NULL, 0 },
- { ICO_OPT_OK, _T("OK"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_ACT_OK, NULL, 0 },
- { ICO_OPT_CANCEL, _T("Cancel"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_ACT_CLOSE, NULL, 0 },
- { ICO_OPT_GROUP, _T("Popup Group"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_OPT_GROUP, NULL, 0 },
- { ICO_OPT_DEF, _T("Show default"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_ACT_OK, NULL, 0 },
- { ICO_OPT_FAV, _T("Favorite Contact"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_OPT_FAVORITE, NULL, 0 },
- { ICO_OPT_FULLSCREEN, _T("Show in Fullscreen"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_OPT_FULLSCREEN, NULL, 0 },
- { ICO_OPT_BLOCK, _T("Blocked Contact"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_OPT_BLOCK, NULL, 0 },
+ { ICO_OPT_RELOAD, "Refresh skin list", SECT_POPUP SECT_POPUP_OPT, IDI_RELOAD, NULL, 0 },
+ { ICO_OPT_RESIZE, "Popup Placement", SECT_POPUP SECT_POPUP_OPT, IDI_RESIZE, NULL, 0 },
+ { ICO_OPT_OK, "OK", SECT_POPUP SECT_POPUP_OPT, IDI_ACT_OK, NULL, 0 },
+ { ICO_OPT_CANCEL, "Cancel", SECT_POPUP SECT_POPUP_OPT, IDI_ACT_CLOSE, NULL, 0 },
+ { ICO_OPT_GROUP, "Popup Group", SECT_POPUP SECT_POPUP_OPT, IDI_OPT_GROUP, NULL, 0 },
+ { ICO_OPT_DEF, "Show default", SECT_POPUP SECT_POPUP_OPT, IDI_ACT_OK, NULL, 0 },
+ { ICO_OPT_FAV, "Favorite Contact", SECT_POPUP SECT_POPUP_OPT, IDI_OPT_FAVORITE, NULL, 0 },
+ { ICO_OPT_FULLSCREEN, "Show in Fullscreen", SECT_POPUP SECT_POPUP_OPT, IDI_OPT_FULLSCREEN, NULL, 0 },
+ { ICO_OPT_BLOCK, "Blocked Contact", SECT_POPUP SECT_POPUP_OPT, IDI_OPT_BLOCK, NULL, 0 },
+
//action
- { ICO_ACT_REPLY, _T("Quick Reply"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_REPLY, NULL, -1 },
- { ICO_ACT_PIN, _T("Pin Popup"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_PIN, NULL, -1 },
- { ICO_ACT_PINNED, _T("Pinned Popup"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_PINNED, NULL, -1 },
- { ICO_ACT_MESS, _T("Send Message"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_MESSAGE, NULL, -1 },
- { ICO_ACT_INFO, _T("User Details"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_INFO, NULL, -1 },
- { ICO_ACT_MENU, _T("Contact Menu"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_MENU, NULL, -1 },
- { ICO_ACT_ADD, _T("Add Contact Permanently"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_ADD, NULL, -1 },
- { ICO_ACT_CLOSE, _T("Dismiss Popup"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_CLOSE, NULL, -1 },
- { ICO_ACT_COPY, _T("Copy to clipboard"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_COPY, NULL, -1 }
+ { ICO_ACT_REPLY, "Quick Reply", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_REPLY, NULL, -1 },
+ { ICO_ACT_PIN, "Pin Popup", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_PIN, NULL, -1 },
+ { ICO_ACT_PINNED, "Pinned Popup", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_PINNED, NULL, -1 },
+ { ICO_ACT_MESS, "Send Message", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_MESSAGE, NULL, -1 },
+ { ICO_ACT_INFO, "User Details", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_INFO, NULL, -1 },
+ { ICO_ACT_MENU, "Contact Menu", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_MENU, NULL, -1 },
+ { ICO_ACT_ADD, "Add Contact Permanently", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_ADD, NULL, -1 },
+ { ICO_ACT_CLOSE, "Dismiss Popup", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_CLOSE, NULL, -1 },
+ { ICO_ACT_COPY, "Copy to clipboard", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_COPY, NULL, -1 }
};
@@ -94,52 +91,40 @@ HICON IcoLib_GetIcon(LPCSTR pszIcon, bool big) void InitIcons()
{
- SKINICONDESC sid;
- ZeroMemory(&sid, sizeof(sid));
- sid.cbSize = sizeof(sid);
- sid.flags = SIDF_ALL_TCHAR;
- TCHAR selfDLL[1024];
- GetModuleFileName(hInst, selfDLL, 1024);
+ TCHAR selfDLL[MAX_PATH];
+ GetModuleFileName(hInst, selfDLL, SIZEOF(selfDLL));
+
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.flags = SIDF_PATH_TCHAR;
+ sid.ptszDefaultFile = selfDLL;
for(int i=0; i < SIZEOF(icoDesc); i++) {
sid.pszName = icoDesc[i].pszName;
- sid.ptszDescription = icoDesc[i].ptszDesc; // [TRANSLATED-BY-CORE]
- sid.ptszSection = icoDesc[i].ptszSection; //must be always untranslatet !!!!!
-
- if(icoDesc[i].idResource==0){
- //use icon from icon lib
- sid.hDefaultIcon = Skin_GetIcon(icoDesc[i].pszIcon);
- sid.ptszDefaultFile = NULL;
- sid.iDefaultIndex = 0;
- }else{
- //load and register from popup.dll
- sid.hDefaultIcon = 0;
- sid.ptszDefaultFile = selfDLL;
- sid.iDefaultIndex = -icoDesc[i].idResource;
- }
+ sid.pszDescription = icoDesc[i].ptszDesc; // [TRANSLATED-BY-CORE]
+ sid.pszSection = icoDesc[i].ptszSection; //must be always untranslatet !!!!!
+ sid.iDefaultIndex = -icoDesc[i].idResource;
switch (icoDesc[i].size){
// small and big icons
- case -1:{
- sid.cx = sid.cy = 0;
- break;
- }
+ case -1:
+ sid.cx = sid.cy = 0;
+ break;
+
// small icons (16x16)
- case 0:{
- sid.cx = sid.cy = 16;
- break;
- }
+ case 0:
+ sid.cx = sid.cy = 16;
+ break;
+
// normal icons (32x32)
- case 1:{
- sid.cx = sid.cy = 32;
- break;
- }
+ case 1:
+ sid.cx = sid.cy = 32;
+ break;
+
// custom icon size
- default:{
- sid.cx = sid.cy = icoDesc[i].size;
- break;
- }
+ default:
+ sid.cx = sid.cy = icoDesc[i].size;
+ break;
}
Skin_AddIcon(&sid);
}
-}
\ No newline at end of file +}
diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index 9b5b953315..ccfc1a51cc 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -188,11 +188,11 @@ void LoadNotificationSettings(POPUPTREEDATA *ptd, char* szModul) HANDLE RegisterNotification(POPUPNOTIFICATION *notification)
{
POPUPTREEDATA *ptd = (POPUPTREEDATA *)mir_alloc(sizeof(POPUPTREEDATA));
- ptd->signature = PopupNotificationData_SIGNATURE;
- ptd->typ = 1;
- ptd->pszTreeRoot = mir_a2t(notification->lpzGroup);
- ptd->pszDescription = mir_a2t(notification->lpzName);
- ptd->notification = *notification;
+ ptd->signature = PopupNotificationData_SIGNATURE;
+ ptd->typ = 1;
+ ptd->pszTreeRoot = mir_a2t(notification->lpzGroup);
+ ptd->pszDescription = mir_a2t(notification->lpzName);
+ ptd->notification = *notification;
if (!ptd->notification.lpzLAction) ptd->notification.lpzLAction = POPUP_ACTION_NOTHING;
if (!ptd->notification.lpzRAction) ptd->notification.lpzRAction = POPUP_ACTION_DISMISS;
LoadNotificationSettings(ptd, "PopUpNotifications");
@@ -228,8 +228,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) mir_snprintf(section, sizeof(section), "PopUps/%s", notification->lpzGroup);
mir_snprintf(setting, sizeof(setting), "%s_%s_%s", MODULNAME, notification->lpzGroup, notification->lpzName);
- SKINICONDESC sid = {0};
- sid.cbSize = sizeof(sid);
+ SKINICONDESC sid = { sizeof(sid) };
sid.pszSection = section;
sid.cx = sid.cy = 16;
sid.pszName = setting;
diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index af038bce55..2129b3de41 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -376,17 +376,17 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l //we work with a copy for preview
ptdPrev = (POPUPTREEDATA *)mir_alloc(sizeof(POPUPTREEDATA));
memcpy(ptdPrev, ptd, sizeof(POPUPTREEDATA));
- ptdPrev->enabled = ptd->enabled;
- ptdPrev->timeoutValue = ptd->timeoutValue;
- strcpy(ptdPrev->leftAction , ptd->leftAction); //geht noch nicht??
- strcpy(ptdPrev->rightAction , ptd->rightAction); //geht noch nicht??
- ptdPrev->disableWhen = ptd->disableWhen;
+ ptdPrev->enabled = ptd->enabled;
+ ptdPrev->timeoutValue = ptd->timeoutValue;
+ strcpy(ptdPrev->leftAction, ptd->leftAction); //geht noch nicht??
+ strcpy(ptdPrev->rightAction, ptd->rightAction); //geht noch nicht??
+ ptdPrev->disableWhen = ptd->disableWhen;
ppd.lchNotification = (HANDLE)ptdPrev;
}
- else if(ptd->typ == 2) {
- ppd.lchIcon = ptd->pupClass.hIcon;
- }
+ else if(ptd->typ == 2)
+ ppd.lchIcon = ptd->pupClass.hIcon;
+
CallService(MS_POPUP_ADDPOPUP2, (WPARAM)&ppd, APF_NO_HISTORY);
mir_free(ptdPrev); ptdPrev = NULL;
}
diff --git a/plugins/QuickMessages/src/Utils.cpp b/plugins/QuickMessages/src/Utils.cpp index 81f267ffe3..0d11c3f742 100644 --- a/plugins/QuickMessages/src/Utils.cpp +++ b/plugins/QuickMessages/src/Utils.cpp @@ -23,153 +23,151 @@ ListData* ButtonsList[100]; SortedList* QuickList=NULL;
-
typedef void (*ItemDestuctor)(void*);
-
int sstSortButtons(const void * vmtbi1, const void * vmtbi2)
- {
+{
ButtonData * mtbi1=(ButtonData *)*((ButtonData ** )vmtbi1);
ButtonData * mtbi2=(ButtonData *)*((ButtonData ** )vmtbi2);
if (mtbi1==NULL || mtbi2==NULL) return (mtbi1-mtbi2);
return mtbi1->dwPos-mtbi2->dwPos;
- }
+}
int sstQuickSortButtons(const void * vmtbi1, const void * vmtbi2)
- {
+{
QuickData * mtbi1=(QuickData *)*((QuickData ** )vmtbi1);
QuickData * mtbi2=(QuickData *)*((QuickData ** )vmtbi2);
if (mtbi1==NULL || mtbi2==NULL) return (mtbi1-mtbi2);
return mtbi1->dwPos-mtbi2->dwPos;
- }
+}
int sstOpSortButtons(const void * vmtbi1, const void * vmtbi2)
- {
+{
ButtonData * mtbi1=(ButtonData *)*((ButtonData ** )vmtbi1);
ButtonData * mtbi2=(ButtonData *)*((ButtonData ** )vmtbi2);
if (mtbi1==NULL || mtbi2==NULL) return (mtbi1-mtbi2);
return mtbi1->dwOPPos-mtbi2->dwOPPos;
- }
+}
void li_ListDestruct(SortedList *pList, ItemDestuctor pItemDestructor)
- {
+{
int i=0;
if (!pList) return;
for (i=0; i<pList->realCount; i++) pItemDestructor(pList->items[i]);
List_Destroy(pList);
mir_free(pList);
- }
+}
void li_RemoveDestruct(SortedList *pList, int index, ItemDestuctor pItemDestructor)
- {
+{
if (index>=0 && index<pList->realCount)
- {
+ {
pItemDestructor(pList->items[index]);
List_Remove(pList, index);
- }
}
+}
void li_RemovePtrDestruct(SortedList *pList, void * ptr, ItemDestuctor pItemDestructor)
- {
+{
if (List_RemovePtr(pList, ptr))
pItemDestructor(ptr);
- }
+}
void li_SortList(SortedList *pList, FSortFunc pSortFunct)
- {
+{
FSortFunc pOldSort=pList->sortFunc;
int i;
if (!pSortFunct) pSortFunct=pOldSort;
pList->sortFunc=NULL;
for (i=0; i<pList->realCount-1; i++)
if (pOldSort(pList->items[i],pList->items[i+1])<0)
- {
+ {
void * temp=pList->items[i];
pList->items[i]=pList->items[i+1];
pList->items[i+1]=temp;
i--;
if (i>0) i--;
- }
+ }
pList->sortFunc=pOldSort;
- }
+}
void li_ZeroQuickList(SortedList *pList)
- {
+{
int i;
for (i=0; i<pList->realCount; i++)
- {
- QuickData * qd=(QuickData *)pList->items[i];
- qd->dwPos=0;
- qd->bIsService=0;
- qd->ptszValue=NULL;
- qd->ptszValueName=NULL;
- List_Remove(pList, i);
- i--;
- }
+ {
+ QuickData * qd=(QuickData *)pList->items[i];
+ qd->dwPos=0;
+ qd->bIsService=0;
+ qd->ptszValue=NULL;
+ qd->ptszValueName=NULL;
+ List_Remove(pList, i);
+ i--;
}
+}
static void listdestructor(void * input)
- {
+{
ButtonData * cbdi=(ButtonData *)input;
-
+
if(cbdi->pszName!=cbdi->pszOpName)
- {
+ {
if(cbdi->pszOpName)
mir_free(cbdi->pszOpName);
if(cbdi->pszName)
mir_free(cbdi->pszName);
- }
+ }
else if(cbdi->pszName)
- mir_free(cbdi->pszName);
+ mir_free(cbdi->pszName);
if(cbdi->pszValue!=cbdi->pszOpValue)
- {
+ {
if(cbdi->pszOpValue)
mir_free(cbdi->pszOpValue);
if(cbdi->pszValue)
mir_free(cbdi->pszValue);
- }
+ }
else if(cbdi->pszValue)
- mir_free(cbdi->pszValue);
+ mir_free(cbdi->pszValue);
mir_free(cbdi);
- }
+}
void RemoveMenuEntryNode(SortedList *pList, int index)
- {
- li_RemoveDestruct(pList,index,listdestructor);
- }
+{
+ li_RemoveDestruct(pList,index,listdestructor);
+}
void DestroyButton(int listnum)
- {
+{
int i=listnum;
ListData* ld=ButtonsList[listnum];
-
+
if(ld->ptszButtonName) mir_free(ld->ptszButtonName);
if(ld->ptszOPQValue!=ld->ptszQValue)
if(ld->ptszOPQValue) mir_free(ld->ptszOPQValue);
-
+
if (ld->ptszQValue) mir_free(ld->ptszQValue);
li_ListDestruct((SortedList*)ld->sl,listdestructor);
-
+
mir_free(ld);
ButtonsList[i]=NULL;
while(ButtonsList[i+1])
{
- ButtonsList[i]=ButtonsList[i+1];
- ButtonsList[i+1]=NULL;
- i++;
+ ButtonsList[i]=ButtonsList[i+1];
+ ButtonsList[i+1]=NULL;
+ i++;
}
}
void SaveModuleSettings(int buttonnum,ButtonData* bd)
- {
+{
char szMEntry[256]={'\0'};
mir_snprintf(szMEntry,255,"EntryName_%u_%u",buttonnum,bd->dwPos);
@@ -189,10 +187,10 @@ void SaveModuleSettings(int buttonnum,ButtonData* bd) mir_snprintf(szMEntry,255,"EntryIsServiceName_%u_%u",buttonnum,bd->dwPos);
DBWriteContactSettingByte(NULL, PLGNAME,szMEntry,bd->bIsServName);
- }
+}
void CleanSettings(int buttonnum,int from)
- {
+{
char szMEntry[256]={'\0'};
DBVARIANT dbv = {0};
if(from==-1){
@@ -202,7 +200,7 @@ void CleanSettings(int buttonnum,int from) DBDeleteContactSetting(NULL, PLGNAME,szMEntry);
mir_snprintf(szMEntry,255,"RCEntryIsServiceName_%u",buttonnum);
DBDeleteContactSetting(NULL, PLGNAME,szMEntry);
- }
+ }
mir_snprintf(szMEntry,255,"EntryName_%u_%u",buttonnum,from);
while(!DBGetContactSettingTString(NULL, PLGNAME,szMEntry,&dbv)) {
@@ -217,12 +215,12 @@ void CleanSettings(int buttonnum,int from) DBDeleteContactSetting(NULL, PLGNAME,szMEntry);
mir_snprintf(szMEntry,255,"EntryName_%u_%u",buttonnum,++from);
- }
- DBFreeVariant(&dbv);
}
+ DBFreeVariant(&dbv);
+}
BYTE getEntryByte(int buttonnum,int entrynum,BOOL mode)
- {
+{
char szMEntry[256]={'\0'};
if (mode==0)
mir_snprintf(szMEntry,255,"EntryToQMenu_%u_%u",buttonnum,entrynum);
@@ -233,52 +231,64 @@ BYTE getEntryByte(int buttonnum,int entrynum,BOOL mode) else if (mode==3)
mir_snprintf(szMEntry,255,"RCEntryIsServiceName_%u",buttonnum);
return DBGetContactSettingByte(NULL, PLGNAME,szMEntry, 0);
- }
+}
-DWORD BalanceButtons(int buttonsWas,int buttonsNow)
- {
- if (ServiceExists(MS_BB_ADDBUTTON))
- {
- BBButton bb={0};
- bb.cbSize=sizeof(BBButton);
- bb.pszModuleName=PLGNAME;
-
- while(buttonsWas>(buttonsNow))
- {
- bb.dwButtonID=--buttonsWas;
- CallService(MS_BB_REMOVEBUTTON,0,(LPARAM)&bb);
- }
- while (buttonsWas<(buttonsNow))
- {
- if (ServiceExists(MS_BB_ADDBUTTON))
- {
- char iconname[20]={'\0'};
- mir_snprintf(iconname,SIZEOF(iconname),"QMessagesButton_%u",buttonsWas);
- bb.bbbFlags=BBBF_ISIMBUTTON|BBBF_ISCHATBUTTON|BBBF_ISLSIDEBUTTON;
- bb.dwButtonID=buttonsWas++;
- bb.dwDefPos=300+buttonsWas;
- bb.hIcon = (HANDLE)AddIcon(hIcon, iconname, iconname);
+static HANDLE AddIcon(char* szIcoName)
+{
+ TCHAR tszPath[MAX_PATH];
+ GetModuleFileName(hinstance, tszPath, SIZEOF(tszPath));
+
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.flags = SIDF_PATH_TCHAR;
+ sid.pszSection = "Quick Messages";
+ sid.cx = sid.cy = 16;
+ sid.pszDescription = szIcoName;
+ sid.pszName = szIcoName;
+ sid.ptszDefaultFile = tszPath;
+ sid.iDefaultIndex = -IDI_QICON;
+ return Skin_AddIcon(&sid);
+}
+
+DWORD BalanceButtons(int buttonsWas, int buttonsNow)
+{
+ if ( !ServiceExists(MS_BB_ADDBUTTON)) {
+ BBButton bb = { sizeof(bb) };
+ bb.pszModuleName = PLGNAME;
+
+ while (buttonsWas > buttonsNow) {
+ bb.dwButtonID = --buttonsWas;
+ CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bb);
+ }
+
+ while (buttonsWas < buttonsNow) {
+ if (ServiceExists(MS_BB_ADDBUTTON)) {
+ char iconname[20];
+ mir_snprintf(iconname, SIZEOF(iconname), "QMessagesButton_%u", buttonsWas);
+ bb.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISLSIDEBUTTON;
+ bb.dwButtonID = buttonsWas++;
+ bb.dwDefPos = 300+buttonsWas;
+ bb.hIcon = AddIcon(iconname);
CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bb);
- }
}
}
- return buttonsNow;
}
+ return buttonsNow;
+}
void InitButtonsList()
- {
+{
int i,j,k=0;
QuickList=List_Create(0,1);
for(i=0;i<g_iButtonsCount;i++)
- {
+ {
TCHAR* pszBName=NULL;
ListData* ld=NULL;
if (!(pszBName=getMenuEntry(i,0,3))) {
g_iButtonsCount=i;
DBWriteContactSettingByte(NULL, PLGNAME,"ButtonsCount", (BYTE)g_iButtonsCount);
break;}
-
+
ld = (ListData *)mir_alloc(sizeof(ListData));
ButtonsList[i]=ld;
ld->sl=List_Create(0,1);
@@ -288,10 +298,10 @@ void InitButtonsList() ld->dwOPFlags=0;
ld->bIsServName=ld->bIsOpServName=getEntryByte(i,0,3);
for(j=0;;j++)
- {
+ {
TCHAR* pszEntry=NULL;
ButtonData *bd=NULL;
-
+
if (!(pszEntry=getMenuEntry(i,j,0)))
break;
@@ -310,35 +320,34 @@ void InitButtonsList() qd->ptszValue=bd->pszValue;
qd->ptszValueName=bd->pszName;
List_InsertPtr(QuickList,qd);
- }
- List_InsertPtr((SortedList*)ld->sl,bd);
}
+ List_InsertPtr((SortedList*)ld->sl,bd);
}
-
}
+}
void DestructButtonsList()
{
int i=0;
-// for ( i=0; i < g_iButtonsCount; i++ )
-while(ButtonsList[i])
- {
+ // for ( i=0; i < g_iButtonsCount; i++ )
+ while(ButtonsList[i])
+ {
li_ListDestruct(ButtonsList[i]->sl,listdestructor);
mir_free(ButtonsList[i]->ptszButtonName);
if(ButtonsList[i]->ptszOPQValue!=ButtonsList[i]->ptszQValue)
if (ButtonsList[i]->ptszOPQValue) mir_free(ButtonsList[i]->ptszOPQValue);
if (ButtonsList[i]->ptszQValue) mir_free(ButtonsList[i]->ptszQValue);
- i++;
+ i++;
}
-if(QuickList)
+ if(QuickList)
{
- li_ZeroQuickList(QuickList);
- List_Destroy(QuickList);
+ li_ZeroQuickList(QuickList);
+ List_Destroy(QuickList);
}
}
TCHAR* getMenuEntry(int buttonnum,int entrynum,BYTE mode)
- {
+{
TCHAR* buffer=NULL;
char szMEntry[256]={'\0'};
DBVARIANT dbv = {0};
@@ -356,74 +365,56 @@ TCHAR* getMenuEntry(int buttonnum,int entrynum,BYTE mode) DBGetContactSettingTString(NULL, PLGNAME,szMEntry, &dbv);
if(dbv.ptszVal&&_tcslen(dbv.ptszVal))
- {
+ {
buffer=mir_tstrdup(dbv.ptszVal);
DBFreeVariant(&dbv);
- }
-
- return buffer;
}
-
-int AddIcon(HICON icon, char *name, char *description)
-{
- SKINICONDESC sid = {0};
- sid.cbSize = sizeof(SKINICONDESC);
- sid.pszSection = "Quick Messages";
- sid.cx = sid.cy = 16;
- sid.pszDescription = description;
- sid.pszName = name;
- sid.hDefaultIcon = icon;
-
- return (int)Skin_AddIcon(&sid);
+ return buffer;
}
int RegisterCustomButton(WPARAM wParam,LPARAM lParam)
- {
- if (ServiceExists(MS_BB_ADDBUTTON))
- {
- int i;
- for(i=0;i<g_iButtonsCount;i++)
- {
- BBButton bbd={0};
- ListData* ld=ButtonsList[i];
- char iconname[20]={'\0'};
- mir_snprintf(iconname,SIZEOF(iconname),"QMessagesButton_%u",i);
-
- bbd.cbSize=sizeof(BBButton);
- bbd.bbbFlags=BBBF_ISIMBUTTON|BBBF_ISCHATBUTTON|BBBF_ISLSIDEBUTTON;
- bbd.dwButtonID=i;
- bbd.dwDefPos=320+i;
- bbd.hIcon=(HANDLE)AddIcon(hIcon, iconname, iconname);
- bbd.pszModuleName=PLGNAME;
- bbd.ptszTooltip=ld->ptszButtonName;
- CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
- }
- return 0;
- }
- return 1;
+{
+ if ( !ServiceExists(MS_BB_ADDBUTTON))
+ return 1;
+
+ for (int i=0; i < g_iButtonsCount; i++) {
+ ListData* ld = ButtonsList[i];
+
+ char iconname[20];
+ mir_snprintf(iconname, SIZEOF(iconname), "QMessagesButton_%u", i);
+
+ BBButton bbd = { sizeof(bbd) };
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISLSIDEBUTTON;
+ bbd.dwButtonID = i;
+ bbd.dwDefPos = 320+i;
+ bbd.hIcon = AddIcon(iconname);
+ bbd.pszModuleName = PLGNAME;
+ bbd.ptszTooltip = ld->ptszButtonName;
+ CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
}
+ return 0;
+}
TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptszClip,int QVSize,int TextSize ,int ClipSize)
- {
+{
int i=0,iOffset=0,iCount=0;
TCHAR* tempPointer=NULL;
TCHAR* ptszQValue=_tcsdup(ptszQValIn);
TCHAR* tempQValue=ptszQValue;
TCHAR varstr=_T('%');
-
- if(TextSize&&ptszText[TextSize-1]=='\0') TextSize--;
- if(ClipSize&&ptszClip[ClipSize-1]=='\0') ClipSize--;
+
+ if(TextSize&&ptszText[TextSize-1]=='\0') TextSize--;
+ if(ClipSize&&ptszClip[ClipSize-1]=='\0') ClipSize--;
if (!_tcschr(ptszQValue,varstr))
return ptszQValue;
- while(ptszQValue[i])
- {
+ while(ptszQValue[i]) {
if(ptszQValue[i]=='%') {
- switch(ptszQValue[i+1])
+ switch(ptszQValue[i+1]) {
+ case 't':
{
- case 't':{
TCHAR* p=NULL;
p = (TCHAR *)realloc(tempQValue, (QVSize + TextSize+1)*sizeof(TCHAR));
if(p){
@@ -432,23 +423,24 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz tempQValue=ptszQValue=p;
tempPointer = (TCHAR *)memmove(ptszQValue + i + TextSize, ptszQValue + i + 2, (QVSize - i - 1)*sizeof(TCHAR));
-
+
if(TextSize) memcpy(ptszQValue+i, ptszText, TextSize*sizeof(TCHAR));
-
- QVSize+=(TextSize-2);
-
- ptszQValue[QVSize]='\0';
-
+
+ QVSize+=(TextSize-2);
+
+ ptszQValue[QVSize]='\0';
+
if (!_tcschr(ptszQValue,varstr))
return ptszQValue;
ptszQValue=tempPointer;
iOffset+=TextSize-1;
i=-1;
- }
+ }
}break;
- case 'c':{
+ case 'c':
+ {
TCHAR* p=NULL;
p = (TCHAR *)realloc(tempQValue, (QVSize + ClipSize + 1)*sizeof(TCHAR));
if(p){
@@ -460,17 +452,18 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz QVSize+=(ClipSize-2);
ptszQValue[QVSize]='\0';
-
+
if (!_tcschr(ptszQValue,varstr))
return ptszQValue;
ptszQValue=tempPointer;
iOffset+=ClipSize-1;
i=-1;
- }
+ }
}break;
- case 'P':{
+ case 'P':
+ {
TCHAR* p=NULL;
int NameLenght=0;
TCHAR* ptszName=NULL;
@@ -497,10 +490,11 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz ptszQValue=tempPointer;
iOffset+=NameLenght-1;
i=-1;
- }
- }break;
+ }
+ }break;
- case 'n':{
+ case 'n':
+ {
TCHAR* p=NULL;
int NameLenght=0;
TCHAR* ptszName=NULL;
@@ -526,9 +520,10 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz ptszQValue=tempPointer;
iOffset+=NameLenght-1;
i=-1;
- }
- }break;
- case 'F':{
+ }
+ }break;
+ case 'F':
+ {
TCHAR* p=NULL;
int NameLenght=0;
TCHAR* ptszName=NULL;
@@ -543,7 +538,7 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz if (!CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)&&ci.pszVal){
NameLenght=(int)_tcslen(ci.pszVal);
ptszName=ci.pszVal;
- }
+ }
p = (TCHAR *)realloc(tempQValue, (QVSize + NameLenght + 1)*sizeof(TCHAR));
if(p){
i=iOffset;
@@ -563,9 +558,10 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz ptszQValue=tempPointer;
iOffset+=NameLenght-1;
i=-1;
- }
- }break;
- case 'L':{
+ }
+ }break;
+ case 'L':
+ {
TCHAR* p=NULL;
int NameLenght=0;
TCHAR* ptszName=NULL;
@@ -580,7 +576,7 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz if (!CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)&&ci.pszVal){
NameLenght=(int)_tcslen(ci.pszVal);
ptszName=ci.pszVal;
- }
+ }
p = (TCHAR *)realloc(tempQValue, (QVSize + NameLenght + 1)*sizeof(TCHAR));
if(p){
i=iOffset;
@@ -598,12 +594,12 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz ptszQValue=tempPointer;
iOffset+=NameLenght-1;
i=-1;
- }
- }break;
- }
+ }
+ }break;
}
+ }
iOffset++;
i++;
- }
+ }
return ptszQValue;
- }
\ No newline at end of file +}
diff --git a/plugins/QuickMessages/src/main.cpp b/plugins/QuickMessages/src/main.cpp index e13d075041..7fba5f8e4e 100644 --- a/plugins/QuickMessages/src/main.cpp +++ b/plugins/QuickMessages/src/main.cpp @@ -20,13 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "quickmessages.h"
HINSTANCE hinstance;
+int hLangpack;
WNDPROC mainProc;
-HANDLE hEventCBButtonPressed, hEventCBInit,hEventInputMenu, hEventDbOptionsInit, hEventDbPluginsLoaded,
-hEventDbPreShutdown;
-HICON hIcon;
-
int g_iButtonsCount=0;
int g_bShutDown=0;
int g_bStartup=0;
@@ -34,9 +31,6 @@ BOOL g_bRClickAuto=0; BOOL g_bLClickAuto=0;
BOOL g_bQuickMenu=0;
-
-int hLangpack;
-
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
MODULENAME,
@@ -53,16 +47,8 @@ PLUGININFOEX pluginInfo = { int PreShutdown(WPARAM wparam,LPARAM lparam)
{
- g_bShutDown=1;
+ g_bShutDown = 1;
DestructButtonsList();
-
- if(hEventCBButtonPressed) UnhookEvent(hEventCBButtonPressed);
- if(hEventCBInit) UnhookEvent(hEventCBInit);
- if(hEventInputMenu) UnhookEvent(hEventInputMenu);
- UnhookEvent(hEventDbPluginsLoaded);
- UnhookEvent(hEventDbOptionsInit);
- UnhookEvent(hEventDbPreShutdown);
-
return 0;
}
@@ -74,28 +60,28 @@ static int InputMenuPopup(WPARAM wParam,LPARAM lParam) if(mwpd->uFlags==MSG_WINDOWPOPUP_LOG||!g_bQuickMenu||!QuickList->realCount) return 0;
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);
else
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)
- {
+ {
CHARRANGE cr;
UINT textlenght=0;
TCHAR* pszText=NULL;
@@ -116,25 +102,25 @@ static int InputMenuPopup(WPARAM wParam,LPARAM lParam) pszCBText=mir_tstrdup(chBuffer);
GlobalUnlock(hData);
CloseClipboard();
- }
}
+ }
SendMessage(mwpd->hwnd, EM_EXGETSEL, 0, (LPARAM)&cr);
textlenght=cr.cpMax-cr.cpMin;
if(textlenght)
- {
+ {
pszText = (TCHAR *)mir_alloc((textlenght+10)*sizeof(TCHAR));
ZeroMemory(pszText,(textlenght+10)*sizeof(TCHAR));
SendMessage(mwpd->hwnd,EM_GETSELTEXT, 0, (LPARAM)pszText);
- }
+ }
if(qd->ptszValue){
- ptszQValue=ParseString(mwpd->hContact,qd->ptszValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)_tcslen(qd->ptszValue),textlenght,pszCBText?(int)_tcslen(pszCBText):0);
+ ptszQValue=ParseString(mwpd->hContact,qd->ptszValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)_tcslen(qd->ptszValue),textlenght,pszCBText?(int)_tcslen(pszCBText):0);
if ((bIsService=qd->bIsService)&&ptszQValue)
CallService(mir_u2a(ptszQValue),(WPARAM)mwpd->hContact,0);
- }
+ }
if(ptszQValue)
SendMessage(mwpd->hwnd, EM_REPLACESEL, TRUE, (LPARAM)ptszQValue);
@@ -143,10 +129,10 @@ static int InputMenuPopup(WPARAM wParam,LPARAM lParam) if(ptszQValue) free(ptszQValue);
if(pszCBText) mir_free(pszCBText);
break;
- }
}
- return 1;
}
+ return 1;
+ }
return 0;
}
@@ -191,11 +177,8 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) pszCBText=mir_tstrdup(chBuffer);
GlobalUnlock(hData);
CloseClipboard();
- }
}
-
-
-
+ }
qsort(sl->items,sl->realCount,sizeof(ButtonData *),sstSortButtons);
@@ -207,11 +190,11 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) textlenght=cr.cpMax-cr.cpMin;
if(textlenght)
- {
+ {
pszText = (TCHAR *)mir_alloc((textlenght+10)*sizeof(TCHAR));
ZeroMemory(pszText,(textlenght+10)*sizeof(TCHAR));
SendMessage(hEdit,EM_GETSELTEXT, 0, (LPARAM)pszText);
- }
+ }
if(cbcd->flags&BBCF_RIGHTBUTTON)
state=1;
@@ -220,118 +203,105 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) else
state=3;
+ switch(state) {
+ case 1:
+ if(ButtonsList[cbcd->dwButtonId]->ptszQValue)
+ ptszQValue = ParseString(cbcd->hContact,ButtonsList[cbcd->dwButtonId]->ptszQValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)_tcslen(ButtonsList[cbcd->dwButtonId]->ptszQValue),textlenght,pszCBText?(int)_tcslen(pszCBText):0);
+ if ((bIsService = ButtonsList[cbcd->dwButtonId]->bIsServName) && ptszQValue)
+ CallService(mir_u2a(ptszQValue),(WPARAM)cbcd->hContact,0);
+ break;
- switch(state)
+ case 2:
{
- case 1:
- if(ButtonsList[cbcd->dwButtonId]->ptszQValue)
- ptszQValue=ParseString(cbcd->hContact,ButtonsList[cbcd->dwButtonId]->ptszQValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)_tcslen(ButtonsList[cbcd->dwButtonId]->ptszQValue),textlenght,pszCBText?(int)_tcslen(pszCBText):0);
- if ((bIsService=ButtonsList[cbcd->dwButtonId]->bIsServName)&&ptszQValue)
-
- CallService(mir_u2a(ptszQValue),(WPARAM)cbcd->hContact,0);
+ ButtonData *bd = (ButtonData *)sl->items[0];
+ if(bd && bd->pszValue){
+ ptszQValue = ParseString(cbcd->hContact,bd->pszValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)_tcslen(bd->pszValue),textlenght,pszCBText?(int)_tcslen(pszCBText):0);
+ if ((bIsService = bd->bIsServName)&&ptszQValue)
+ CallService(mir_u2a(ptszQValue),(WPARAM)cbcd->hContact,0);
+ }
+ }
+ break;
- break;
- case 2:
- {
- ButtonData * bd=NULL;
- bd=(ButtonData *)sl->items[0];
- if(bd&&bd->pszValue){
- ptszQValue=ParseString(cbcd->hContact,bd->pszValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)_tcslen(bd->pszValue),textlenght,pszCBText?(int)_tcslen(pszCBText):0);
- if ((bIsService=bd->bIsServName)&&ptszQValue)
+ case 3:
+ int res=0;
+ int menunum;
+ ButtonData * bd=NULL;
+ HMENU hMenu=NULL,hSubMenu=NULL;
+ BOOL bSetPopUpMark=FALSE;
- CallService(mir_u2a(ptszQValue),(WPARAM)cbcd->hContact,0);
+ if(g_iButtonsCount){
+ hMenu = CreatePopupMenu();
+ }
+ else break;
+ for(menunum=0;menunum<sl->realCount;menunum++)
+ {
+ bd=(ButtonData *)sl->items[menunum];
+ if(bd->dwOPFlags&QMF_NEW)
+ continue;
- }
+ bSetPopUpMark=FALSE;
+ if(bd->pszValue==0&&bd->fEntryType==0)
+ {
+ hSubMenu = CreatePopupMenu();
+ bSetPopUpMark=TRUE;
}
- 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)
- continue;
-
- bSetPopUpMark=FALSE;
- if(bd->pszValue==0&&bd->fEntryType==0)
- {
- hSubMenu = CreatePopupMenu();
- bSetPopUpMark=TRUE;
- }
-
- if(bd->pszValue&&bd->fEntryType==0)
- hSubMenu=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);
- }
+ if(bd->pszValue&&bd->fEntryType==0)
+ hSubMenu=NULL;
- 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)_tcslen(bd->pszValue),textlenght,pszCBText?(int)_tcslen(pszCBText):0);
- if ((bIsService=bd->bIsServName)&&ptszQValue)
+ 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);
+ }
- CallService(mir_u2a(ptszQValue),(WPARAM)cbcd->hContact,0);
+ res = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbcd->pt.x, cbcd->pt.y, 0, cbcd->hwndFrom, NULL);
+ if(res==0) break;
- }
- }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)_tcslen(bd->pszValue),textlenght,pszCBText?(int)_tcslen(pszCBText):0);
+ if ((bIsService=bd->bIsServName)&&ptszQValue)
+ CallService(mir_u2a(ptszQValue),(WPARAM)cbcd->hContact,0);
}
+ break;
+ }
-
- if(ptszQValue){
- if (!bIsService){
+ 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);
}
free(ptszQValue);
- }
+ }
- if(pszText) mir_free(pszText);
- if(pszCBText) mir_free(pszCBText);
+ mir_free(pszText);
+ mir_free(pszCBText);
return 1;
}
-
static int PluginInit(WPARAM wparam,LPARAM lparam)
{
- g_bStartup=1;
- hEventDbOptionsInit=HookEvent(ME_OPT_INITIALISE,OptionsInit);
- hEventCBButtonPressed=HookEvent(ME_MSG_BUTTONPRESSED,CustomButtonPressed);
- hEventCBInit=HookEvent(ME_MSG_TOOLBARLOADED,RegisterCustomButton);
-
- hEventInputMenu=HookEvent(ME_MSG_WINDOWPOPUP,InputMenuPopup);
-
-
- g_bRClickAuto=DBGetContactSettingByte(NULL,PLGNAME,"RClickAuto",0);
- g_bLClickAuto=DBGetContactSettingByte(NULL,PLGNAME,"LClickAuto",0);
- g_iButtonsCount=DBGetContactSettingByte(NULL, PLGNAME,"ButtonsCount", 0);
- g_bQuickMenu=DBGetContactSettingByte(NULL, PLGNAME,"QuickMenu", 1);
+ g_bStartup = 1;
+ HookEvent(ME_OPT_INITIALISE, OptionsInit);
+ HookEvent(ME_MSG_BUTTONPRESSED, CustomButtonPressed);
+ HookEvent(ME_MSG_TOOLBARLOADED, RegisterCustomButton);
+ HookEvent(ME_MSG_WINDOWPOPUP, InputMenuPopup);
- hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(IDI_QICON));
+ g_bRClickAuto = DBGetContactSettingByte(NULL,PLGNAME,"RClickAuto",0);
+ g_bLClickAuto = DBGetContactSettingByte(NULL,PLGNAME,"LClickAuto",0);
+ g_iButtonsCount = DBGetContactSettingByte(NULL, PLGNAME,"ButtonsCount", 0);
+ g_bQuickMenu = DBGetContactSettingByte(NULL, PLGNAME,"QuickMenu", 1);
InitButtonsList();
- g_bStartup=0;
+ g_bStartup = 0;
return 0;
}
@@ -347,17 +317,15 @@ extern "C" __declspec(dllexport) int Unload(void) BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID lpvReserved)
{
- hinstance=hinst;
+ hinstance = hinst;
return 1;
}
extern "C" __declspec(dllexport) int Load(void)
{
-
-
mir_getLP(&pluginInfo);
- hEventDbPluginsLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit);
- hEventDbPreShutdown=HookEvent(ME_SYSTEM_PRESHUTDOWN,PreShutdown);
+ HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN,PreShutdown);
return 0;
-}
\ No newline at end of file +}
diff --git a/plugins/QuickMessages/src/quickmessages.h b/plugins/QuickMessages/src/quickmessages.h index f236b4175f..af7c4a5879 100644 --- a/plugins/QuickMessages/src/quickmessages.h +++ b/plugins/QuickMessages/src/quickmessages.h @@ -38,6 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "m_icolib.h"
#include "m_message.h"
#include "m_contacts.h"
+#include "win2k.h"
#include "Utils.h"
#include "m_msg_buttonsbar.h"
@@ -48,7 +49,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define PLGNAME "QuickMessages"
extern HINSTANCE hinstance;
-extern HICON hIcon;
+extern HANDLE hIcolib;
extern ListData* ButtonsList[100];
extern SortedList* QuickList;
extern BOOL g_bRClickAuto;
@@ -56,29 +57,16 @@ extern BOOL g_bLClickAuto; extern BOOL g_bQuickMenu;
extern int g_iButtonsCount;
-//#define MIIM_STRING 0x00000040
-
-
-
-int AddIcon(HICON icon, char *name, char *description);
int OptionsInit(WPARAM,LPARAM);
-
-#define IDC_MESSAGE 1002
-#define IDC_CHATMESSAGE 1009
-
-#define SIZEOF(X)(sizeof(X)/sizeof(X[0]))
-
+#define IDC_MESSAGE 1002
+#define IDC_CHATMESSAGE 1009
#define QMESSAGES_NAME "quickmessages"
-
#define QMESSAGES_VERSION_URL "http://miranda.radicaled.ru/public/updater/quickmessages.txt"
-
#define QMESSAGES_CHAGELOG_URL "http://miranda.radicaled.ru/public/quickmessages/changelog_en.txt"
-
#define QMESSAGES_UPDATE_URL "http://miranda.radicaled.ru/public/quickmessages/"QMESSAGES_NAME".zip"
-
#define QMESSAGES_UPDATE_URL "http://miranda.radicaled.ru/public/quickmessages/"QMESSAGES_NAME".zip"
#define QMESSAGES_VERSION_PREFIX "QuickMessages "
diff --git a/plugins/QuickReplies/src/events.cpp b/plugins/QuickReplies/src/events.cpp index 4fdf1827fb..5729ee29cb 100644 --- a/plugins/QuickReplies/src/events.cpp +++ b/plugins/QuickReplies/src/events.cpp @@ -35,11 +35,8 @@ INT_PTR QuickRepliesService(WPARAM, LPARAM) int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
UnhookEvent(hOnModulesLoaded);
- HANDLE hIcon = NULL;
- char buttonName[32];
- if (!ServiceExists(MS_QUICKREPLIES_SERVICE))
- {
+ if ( !ServiceExists(MS_QUICKREPLIES_SERVICE)) {
iNumber = 0;
hQuickRepliesService = CreateServiceFunction(MS_QUICKREPLIES_SERVICE, QuickRepliesService);
}
@@ -49,20 +46,23 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) hOnOptInitialized = HookEvent(ME_OPT_INITIALISE, OnOptInitialized);
hOnButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, OnButtonPressed);
- char buttonNameTranslated[32];
- mir_snprintf(buttonName, SIZEOF(buttonName), "Button %x", iNumber + 1);
- mir_snprintf(buttonNameTranslated, SIZEOF(buttonNameTranslated), "%s %x",Translate("Button"), iNumber + 1);
+ if ( ServiceExists(MS_BB_ADDBUTTON)) {
+ char buttonNameTranslated[32], buttonName[32];
+ mir_snprintf(buttonName, SIZEOF(buttonName), "Button %x", iNumber + 1);
+ mir_snprintf(buttonNameTranslated, SIZEOF(buttonNameTranslated), "%s %x",Translate("Button"), iNumber + 1);
+
+ TCHAR tszPath[MAX_PATH];
+ GetModuleFileName(hInstance, tszPath, SIZEOF(tszPath));
- SKINICONDESC sid = {0};
- sid.cbSize = sizeof(sid);
- sid.pszSection = "TabSRMM/Quick Replies";
- sid.cx = sid.cy = 16;
- sid.pszDescription = buttonNameTranslated;
- sid.pszName = buttonName;
- sid.hDefaultIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_QICON));
- hIcon = Skin_AddIcon(&sid);
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.pszSection = "TabSRMM/Quick Replies";
+ sid.cx = sid.cy = 16;
+ sid.pszDescription = buttonNameTranslated;
+ sid.pszName = buttonName;
+ sid.ptszDefaultFile = tszPath;
+ sid.iDefaultIndex = -IDI_QICON;
+ HANDLE hIcon = Skin_AddIcon(&sid);
- if (ServiceExists(MS_BB_ADDBUTTON)) {
mir_snprintf(buttonName, SIZEOF(buttonName), MODULE_NAME" %x", iNumber + 1);
BBButton bbd = {0};
diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index b76e322a17..7567ec2522 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -181,19 +181,19 @@ void InitNetlib() void DeinitNetlib()
{
- if(hNetlibUser)
+ if (hNetlibUser)
CallService(MS_NETLIB_CLOSEHANDLE, (WPARAM)hNetlibUser, 0);
}
int Sent_NetLog(const char *fmt,...)
{
- va_list va;
- char szText[1024];
+ va_list va;
+ char szText[1024];
- va_start(va,fmt);
- mir_vsnprintf(szText,sizeof(szText),fmt,va);
- va_end(va);
- return CallService(MS_NETLIB_LOG,(WPARAM)hNetlibUser,(LPARAM)szText);
+ va_start(va,fmt);
+ mir_vsnprintf(szText,sizeof(szText),fmt,va);
+ va_end(va);
+ return CallService(MS_NETLIB_LOG,(WPARAM)hNetlibUser,(LPARAM)szText);
}
#endif
diff --git a/plugins/SecureIM/src/crypt_check.cpp b/plugins/SecureIM/src/crypt_check.cpp index ad15f3f9de..b1bb9512ce 100644 --- a/plugins/SecureIM/src/crypt_check.cpp +++ b/plugins/SecureIM/src/crypt_check.cpp @@ -35,7 +35,7 @@ BYTE isContactSecured(HANDLE hContact) { r=clist[j].mode;
switch(r) {
case MODE_NATIVE:
- if(cpp_keyx(clist[j].cntx)!=0) r|=SECURED;
+ if (cpp_keyx(clist[j].cntx)!=0) r|=SECURED;
break;
case MODE_PGP:
DBGetContactSetting(hContact,szModuleName,"pgp",&dbv);
@@ -48,10 +48,10 @@ BYTE isContactSecured(HANDLE hContact) { DBFreeVariant(&dbv);
break;
case MODE_RSAAES:
- if(exp->rsa_get_state(clist[j].cntx)==7) r|=SECURED;
+ if (exp->rsa_get_state(clist[j].cntx)==7) r|=SECURED;
break;
case MODE_RSA:
- if(clist[j].cntx) r|=SECURED;
+ if (clist[j].cntx) r|=SECURED;
break;
}
break;
diff --git a/plugins/SecureIM/src/crypt_dll.cpp b/plugins/SecureIM/src/crypt_dll.cpp index e7779831ff..f81ea8ad3a 100644 --- a/plugins/SecureIM/src/crypt_dll.cpp +++ b/plugins/SecureIM/src/crypt_dll.cpp @@ -10,7 +10,7 @@ LPSTR InitKeyA(pUinKey ptr,int features) { ptr->cntx = cpp_create_context(isProtoSmallPackets(ptr->hContact)?CPP_MODE_BASE64:0);
char *tmp = myDBGetString(ptr->hContact,szModuleName,"PSK");
- if(tmp) {
+ if (tmp) {
cpp_init_keyp(ptr->cntx,tmp); // make pre-shared key from password
mir_free(tmp);
}
@@ -18,14 +18,14 @@ LPSTR InitKeyA(pUinKey ptr,int features) { LPSTR pub_text = cpp_init_keya(ptr->cntx,features); // calculate public and private key & fill KeyA
LPSTR keysig;
- if(features&CPP_FEATURES_NEWPG) {
- if(features&KEY_B_SIG)
+ if (features&CPP_FEATURES_NEWPG) {
+ if (features&KEY_B_SIG)
keysig = (LPSTR)SIG_KEYB;
else
keysig = (LPSTR)SIG_KEYA;
}
else
- if(isProtoSmallPackets(ptr->hContact))
+ if (isProtoSmallPackets(ptr->hContact))
keysig = (LPSTR)SIG_KEY4;
else
keysig = (LPSTR)SIG_KEY3;
@@ -51,7 +51,7 @@ int InitKeyB(pUinKey ptr,LPCSTR key) { if (!cpp_keyp(ptr->cntx)) {
char *tmp = myDBGetString(ptr->hContact,szModuleName,"PSK");
- if(tmp) {
+ if (tmp) {
cpp_init_keyp(ptr->cntx,tmp); // make pre-shared key from password
mir_free(tmp);
}
@@ -161,7 +161,7 @@ LPSTR decodeMsg(pUinKey ptr, LPARAM lParam, LPSTR szEncMsg) { LPSTR szNewMsg = NULL;
LPSTR szOldMsg = (ppre->flags&PREF_UTF)?cpp_decodeU(ptr->cntx,szEncMsg):cpp_decode(ptr->cntx,szEncMsg);
- if(szOldMsg == NULL) {
+ if (szOldMsg == NULL) {
ptr->decoded=false;
switch(cpp_get_error(ptr->cntx)) {
case CPP_ERROR_BAD_LEN:
@@ -201,16 +201,16 @@ LPSTR decodeMsg(pUinKey ptr, LPARAM lParam, LPSTR szEncMsg) { BOOL LoadKeyPGP(pUinKey ptr) {
int mode = db_get_b(ptr->hContact,szModuleName,"pgp_mode",255);
- if(mode==0) {
+ if (mode==0) {
DBVARIANT dbv;
DBGetContactSetting(ptr->hContact,szModuleName,"pgp",&dbv);
BOOL r=(dbv.type==DBVT_BLOB);
- if(r) pgp_set_keyid(ptr->cntx,(PVOID)dbv.pbVal);
+ if (r) pgp_set_keyid(ptr->cntx,(PVOID)dbv.pbVal);
DBFreeVariant(&dbv);
return r;
}
else
- if(mode==1) {
+ if (mode==1) {
LPSTR key = myDBGetStringDecode(ptr->hContact,szModuleName,"pgp");
if ( key ) {
pgp_set_key(ptr->cntx,key);
diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp index 97b3c1ee3e..2e616a46b7 100644 --- a/plugins/SecureIM/src/crypt_lists.cpp +++ b/plugins/SecureIM/src/crypt_lists.cpp @@ -71,7 +71,7 @@ void freeSupportedProtocols() { pSupPro getSupPro(HANDLE hContact) {
int j;
for(j=0;j<proto_cnt && !CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)proto[j].name);j++);
- if(j==proto_cnt) return NULL;
+ if (j==proto_cnt) return NULL;
return &proto[j];
}
@@ -84,7 +84,7 @@ pUinKey addContact(HANDLE hContact) { for(j=0;j<clist_cnt;j++) {
if ( !clist[j].hContact ) break;
}
- if(j==clist_cnt) {
+ if (j==clist_cnt) {
clist_cnt+=clist_inc;
clist = (pUinKey) mir_realloc(clist,sizeof(UinKey)*clist_cnt);
memset(&clist[j],0,sizeof(UinKey)*clist_inc);
@@ -117,7 +117,7 @@ void delContact(HANDLE hContact) { if (hContact) {
int j;
for(j=0;j<clist_cnt;j++) {
- if(clist[j].hContact == hContact) {
+ if (clist[j].hContact == hContact) {
cpp_delete_context(clist[j].cntx); clist[j].cntx = 0;
clist[j].hContact = 0;
SAFE_FREE(clist[j].tmp);
@@ -183,7 +183,7 @@ void addMsg2Queue(pUinKey ptr,WPARAM wParam,LPSTR szMsg) { EnterCriticalSection(&localQueueMutex);
- if(ptr->msgQueue==NULL){
+ if (ptr->msgQueue==NULL){
// create new
ptr->msgQueue = (pWM) mir_alloc(sizeof(struct waitingMessage));
ptrMessage = ptr->msgQueue;
@@ -201,7 +201,7 @@ void addMsg2Queue(pUinKey ptr,WPARAM wParam,LPSTR szMsg) { ptrMessage->wParam = wParam;
ptrMessage->nextMessage = NULL;
- if(wParam & PREF_UNICODE) {
+ if (wParam & PREF_UNICODE) {
int slen = (int)strlen(szMsg)+1;
int wlen = (int)wcslen((wchar_t *)(szMsg+slen))+1;
ptrMessage->Message = (LPSTR) mir_alloc(slen+wlen*sizeof(WCHAR));
diff --git a/plugins/SecureIM/src/crypt_metacontacts.cpp b/plugins/SecureIM/src/crypt_metacontacts.cpp index 065ad5145d..d78f4adc49 100644 --- a/plugins/SecureIM/src/crypt_metacontacts.cpp +++ b/plugins/SecureIM/src/crypt_metacontacts.cpp @@ -2,14 +2,14 @@ BOOL isProtoMetaContacts(HANDLE hContact) {
- if(bMetaContacts) {
+ if (bMetaContacts) {
LPSTR proto = GetContactProto(hContact);
if ( proto && strcmp(proto,"MetaContacts")==0 ) {
return true;
}
}
// for(int j=0;j<clist_cnt;j++)
-// if(clist[j].hContact==hContact && clist[j].proto->inspecting)
+// if (clist[j].hContact==hContact && clist[j].proto->inspecting)
// return strstr(clist[j].proto->name,"MetaContacts")!=NULL;
return false;
}
@@ -17,7 +17,7 @@ BOOL isProtoMetaContacts(HANDLE hContact) { BOOL isDefaultSubContact(HANDLE hContact) {
- if(bMetaContacts) {
+ if (bMetaContacts) {
return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0),0)==hContact;
}
return false;
@@ -26,7 +26,7 @@ BOOL isDefaultSubContact(HANDLE hContact) { HANDLE getMetaContact(HANDLE hContact) {
- if(bMetaContacts) {
+ if (bMetaContacts) {
return (HANDLE)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0);
}
return 0;
@@ -35,7 +35,7 @@ HANDLE getMetaContact(HANDLE hContact) { HANDLE getMostOnline(HANDLE hContact) {
- if(bMetaContacts) {
+ if (bMetaContacts) {
return (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hContact,0);
}
return 0;
diff --git a/plugins/SecureIM/src/loadicons.cpp b/plugins/SecureIM/src/loadicons.cpp index 77bcb57168..ab011af206 100644 --- a/plugins/SecureIM/src/loadicons.cpp +++ b/plugins/SecureIM/src/loadicons.cpp @@ -1,18 +1,53 @@ #include "commonheaders.h"
+struct
+{
+ UINT key; // Resource ID
+ BYTE tbl; // Table NUM
+ BYTE idx; // Table IDX
+ char *section;
+ char *name;
+ char *text;
+}
+static icons[] =
+{
+ // Contact List
+ {IDI_CL_DIS, TBL_IEC, IEC_CL_DIS, MODULENAME"/Contact List", "sim_cl_dis", "Connection Disabled"},
+ {IDI_CL_EST, TBL_IEC, IEC_CL_EST, MODULENAME"/Contact List", "sim_cl_est", "Connection Established"},
+
+ // Contact Menu
+ {IDI_CM_DIS, TBL_ICO, ICO_CM_DIS, MODULENAME"/Contact Menu", "sim_cm_dis", "Disable Secure Connection"},
+ {IDI_CM_EST, TBL_ICO, ICO_CM_EST, MODULENAME"/Contact Menu", "sim_cm_est", "Establishe Secure Connection"},
+
+ // Message Window
+ {IDI_MW_DIS, TBL_ICO, ICO_MW_DIS, MODULENAME"/Message Window", "sim_mw_dis", "Connection Disabled"},
+ {IDI_MW_EST, TBL_ICO, ICO_MW_EST, MODULENAME"/Message Window", "sim_mw_est", "Connection Established"},
+
+ // popup's
+ {IDI_PU_DIS, TBL_POP, POP_PU_DIS, MODULENAME"/Popups", "sim_pu_dis", "Secure Connection Disabled"},
+ {IDI_PU_EST, TBL_POP, POP_PU_EST, MODULENAME"/Popups", "sim_pu_est", "Secure Connection Established"},
+ {IDI_PU_PRC, TBL_POP, POP_PU_PRC, MODULENAME"/Popups", "sim_pu_prc", "Secure Connection In Process"},
+ {IDI_PU_MSG, TBL_POP, POP_PU_MSR, MODULENAME"/Popups", "sim_pu_msr", "Recv Secured Message"},
+ {IDI_PU_MSG, TBL_POP, POP_PU_MSS, MODULENAME"/Popups", "sim_pu_mss", "Sent Secured Message"},
+
+ // statuses
+ {IDI_ST_DIS, TBL_ICO, ICO_ST_DIS, MODULENAME"/Menu State", "sim_st_dis", "Disabled"},
+ {IDI_ST_ENA, TBL_ICO, ICO_ST_ENA, MODULENAME"/Menu State", "sim_st_ena", "Enabled"},
+ {IDI_ST_TRY, TBL_ICO, ICO_ST_TRY, MODULENAME"/Menu State", "sim_st_try", "Always Try"},
+
+ // overlay
+ {IDI_OV_NAT, TBL_ICO, ICO_OV_NAT, MODULENAME"/Overlays", "sim_ov_nat", "Native mode"},
+ {IDI_OV_PGP, TBL_ICO, ICO_OV_PGP, MODULENAME"/Overlays", "sim_ov_pgp", "PGP mode"},
+ {IDI_OV_GPG, TBL_ICO, ICO_OV_GPG, MODULENAME"/Overlays", "sim_ov_gpg", "GPG mode"},
+ {IDI_OV_RSA, TBL_ICO, ICO_OV_RSA, MODULENAME"/Overlays", "sim_ov_rsa", "RSA/AES mode"},
+};
HINSTANCE LoadIconsPack(const char* szIconsPack)
{
- HINSTANCE hNewIconInst = NULL;
- WORD i;
-
- hNewIconInst = LoadLibrary(szIconsPack);
-
- if (hNewIconInst != NULL)
- {
- for(i=ID_FIRSTICON; i<=ID_LASTICON; i++)
- if (LoadIcon(hNewIconInst, MAKEINTRESOURCE(i)) == NULL)
- {
+ HINSTANCE hNewIconInst = LoadLibrary(szIconsPack);
+ if (hNewIconInst != NULL) {
+ for(int i=ID_FIRSTICON; i <= ID_LASTICON; i++)
+ if (LoadIcon(hNewIconInst, MAKEINTRESOURCE(i)) == NULL) {
FreeLibrary(hNewIconInst);
hNewIconInst = NULL;
break;
@@ -21,21 +56,16 @@ HINSTANCE LoadIconsPack(const char* szIconsPack) return hNewIconInst;
}
-
-
int ReloadIcons(WPARAM wParam, LPARAM lParam)
{
- HICON hIcon;
- for (int i=0; icons[i].key; i++) {
- hIcon = Skin_GetIcon(icons[i].name);
- if(icons[i].tbl == TBL_IEC)
- g_hIEC[icons[i].idx]=hIcon;
- else
- if(icons[i].tbl == TBL_ICO)
- g_hICO[icons[i].idx]=hIcon;
- else
- if(icons[i].tbl == TBL_POP)
- g_hPOP[icons[i].idx]=hIcon;
+ for (int i=0; i < SIZEOF(icons); i++) {
+ HICON hIcon = Skin_GetIcon(icons[i].name);
+ if (icons[i].tbl == TBL_IEC)
+ g_hIEC[icons[i].idx] = hIcon;
+ else if (icons[i].tbl == TBL_ICO)
+ g_hICO[icons[i].idx] = hIcon;
+ else if (icons[i].tbl == TBL_POP)
+ g_hPOP[icons[i].idx] = hIcon;
}
return 0;
@@ -47,8 +77,8 @@ void InitIcons(void) HINSTANCE hNewIconInst = NULL;
if ( g_hFolders ) {
- LPSTR pathname = (LPSTR) alloca(MAX_PATH);
- FoldersGetCustomPathEx(g_hFolders, pathname, MAX_PATH, "icons\\", "secureim_icons.dll");
+ TCHAR pathname[MAX_PATH];
+ FoldersGetCustomPathExT(g_hFolders, pathname, MAX_PATH, "icons\\");
if (hNewIconInst == NULL)
hNewIconInst = LoadIconsPack(pathname);
}
@@ -64,30 +94,27 @@ void InitIcons(void) else
g_hIconInst = hNewIconInst;
+ TCHAR tszPath[MAX_PATH];
+ GetModuleFileName(g_hInst, tszPath, SIZEOF(tszPath));
- SKINICONDESC sid = { 0 };
- sid.cbSize = sizeof(sid);
+ SKINICONDESC sid = { sizeof(sid) };
sid.pszSection = "SecureIM";
+ sid.ptszDefaultFile = tszPath;
- HICON hIcon;
- for (int i=0; icons[i].key; i++) {
+ for (int i=0; i < SIZEOF(icons); i++) {
sid.pszSection = icons[i].section;
sid.pszName = icons[i].name;
sid.pszDescription = icons[i].text;
- sid.pszDefaultFile = "secureim_icons.dll";
- sid.iDefaultIndex = icons[i].key;
- sid.hDefaultIcon = (HICON)LoadImage(g_hIconInst, MAKEINTRESOURCE(icons[i].key), IMAGE_ICON, 16, 16, LR_SHARED);
- Skin_AddIcon(&sid);
- hIcon = Skin_GetIcon(icons[i].name);
-
- if(icons[i].tbl == TBL_IEC)
- g_hIEC[icons[i].idx]=hIcon;
- else
- if(icons[i].tbl == TBL_ICO)
- g_hICO[icons[i].idx]=hIcon;
- else
- if(icons[i].tbl == TBL_POP)
- g_hPOP[icons[i].idx]=hIcon;
+ sid.iDefaultIndex = -icons[i].key;
+ HANDLE hIcolib = Skin_AddIcon(&sid);
+
+ HICON hIcon = Skin_GetIconByHandle(hIcolib);
+ if (icons[i].tbl == TBL_IEC)
+ g_hIEC[icons[i].idx] = hIcon;
+ else if (icons[i].tbl == TBL_ICO)
+ g_hICO[icons[i].idx] = hIcon;
+ else if (icons[i].tbl == TBL_POP)
+ g_hPOP[icons[i].idx] = hIcon;
}
AddHookFunction(ME_SKIN2_ICONSCHANGED, ReloadIcons);
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 0591ce40cf..dff745ce1c 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -81,7 +81,7 @@ extern "C" __declspec(dllexport) int __cdecl Load(void) GetTempPath(sizeof(temp),temp);
GetLongPathName(temp,TEMP,sizeof(TEMP));
TEMP_SIZE = (int)strlen(TEMP);
- if(TEMP[TEMP_SIZE-1]=='\\') {
+ if (TEMP[TEMP_SIZE-1]=='\\') {
TEMP_SIZE--;
TEMP[TEMP_SIZE]='\0';
}
@@ -170,8 +170,8 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { bPopupExists = ServiceExists(MS_POPUP_ADDPOPUPEX)!=0;
bPopupUnicode = ServiceExists(MS_POPUP_ADDPOPUPW)!=0;
- g_hFolders = FoldersRegisterCustomPath(szModuleName, "Icons", MIRANDA_PATH"\\icons");
- if ( g_hFolders==(HANDLE)CALLSERVICE_NOTFOUND ) g_hFolders = 0;
+ if ( ServiceExists(MS_FOLDERS_GET_PATH))
+ g_hFolders = FoldersRegisterCustomPathT(szModuleName, "Icons", _T(MIRANDA_PATH"\\icons"));
InitIcons();
GetFlags();
@@ -234,37 +234,37 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { Sent_NetLog("pgp_init");
#endif
bPGP = db_get_b(0, szModuleName, "pgp", 0);
- if(bPGP) { //PGP
+ if (bPGP) { //PGP
bPGPloaded = pgp_init();
bUseKeyrings = db_get_b(0,szModuleName,"ukr",1);
LPSTR priv = myDBGetStringDecode(0,szModuleName,"pgpPrivKey");
- if(priv) {
+ if (priv) {
bPGPprivkey = true;
- if(bPGPloaded)
+ if (bPGPloaded)
pgp_set_priv_key(priv);
mir_free(priv);
- }// if(priv)
- if(bPGPloaded && bUseKeyrings) {
+ }// if (priv)
+ if (bPGPloaded && bUseKeyrings) {
char PubRingPath[MAX_PATH], SecRingPath[MAX_PATH];
PubRingPath[0]='\0'; SecRingPath[0]='\0';
- if(pgp_get_version()<0x02000000) { // 6xx
+ if (pgp_get_version()<0x02000000) { // 6xx
bPGPkeyrings = pgp_open_keyrings(PubRingPath,SecRingPath);
}
else {
LPSTR tmp;
tmp = myDBGetString(0,szModuleName,"pgpPubRing");
- if(tmp) {
+ if (tmp) {
strncpy(PubRingPath,tmp,sizeof(PubRingPath));
mir_free(tmp);
}
tmp = myDBGetString(0,szModuleName,"pgpSecRing");
- if(tmp) {
+ if (tmp) {
strncpy(SecRingPath,tmp,sizeof(SecRingPath));
mir_free(tmp);
}
- if(PubRingPath[0] && SecRingPath[0]) {
+ if (PubRingPath[0] && SecRingPath[0]) {
bPGPkeyrings = pgp_open_keyrings(PubRingPath,SecRingPath);
- if(bPGPkeyrings) {
+ if (bPGPkeyrings) {
DBWriteContactSettingString(0,szModuleName,"pgpPubRing",PubRingPath);
DBWriteContactSettingString(0,szModuleName,"pgpSecRing",SecRingPath);
}
@@ -274,14 +274,14 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { }
}
}
- }// if(bPGPloaded && bUseKeyrings)
- }// if(bPGP)
+ }// if (bPGPloaded && bUseKeyrings)
+ }// if (bPGP)
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("gpg_init");
#endif
bGPG = db_get_b(0, szModuleName, "gpg", 0);
- if(bGPG) { //GPG
+ if (bGPG) { //GPG
LPSTR tmp;
@@ -291,34 +291,34 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { gpgexec[0]='\0'; gpghome[0]='\0';
tmp = myDBGetString(0,szModuleName,"gpgExec");
- if(tmp) {
+ if (tmp) {
strncpy(gpgexec,tmp,sizeof(gpgexec));
mir_free(tmp);
}
tmp = myDBGetString(0,szModuleName,"gpgHome");
- if(tmp) {
+ if (tmp) {
strncpy(gpghome,tmp,sizeof(gpghome));
mir_free(tmp);
}
- if(db_get_b(0, szModuleName, "gpgLogFlag",0)) {
+ if (db_get_b(0, szModuleName, "gpgLogFlag",0)) {
tmp = myDBGetString(0,szModuleName,"gpgLog");
- if(tmp) {
+ if (tmp) {
gpg_set_log(tmp);
mir_free(tmp);
}
}
- if(db_get_b(0, szModuleName, "gpgTmpFlag",0)) {
+ if (db_get_b(0, szModuleName, "gpgTmpFlag",0)) {
tmp = myDBGetString(0,szModuleName,"gpgTmp");
- if(tmp) {
+ if (tmp) {
gpg_set_tmp(tmp);
mir_free(tmp);
}
}
bGPGkeyrings = gpg_open_keyrings(gpgexec,gpghome);
- if(bGPGkeyrings) {
+ if (bGPGkeyrings) {
DBWriteContactSettingString(0,szModuleName,"gpgExec",gpgexec);
DBWriteContactSettingString(0,szModuleName,"gpgHome",gpghome);
}
@@ -328,9 +328,9 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { }
bSavePass = db_get_b(0,szModuleName,"gpgSaveFlag",0);
- if(bSavePass) {
+ if (bSavePass) {
tmp = myDBGetString(0,szModuleName,"gpgSave");
- if(tmp) {
+ if (tmp) {
gpg_set_passphrases(tmp);
mir_free(tmp);
}
@@ -362,7 +362,7 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { // hook init options
AddHookFunction(ME_OPT_INITIALISE, onRegisterOptions);
- if(bPopupExists)
+ if (bPopupExists)
AddHookFunction(ME_OPT_INITIALISE, onRegisterPopOptions);
AddHookFunction(ME_PROTO_ACK, onProtoAck);
AddHookFunction(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
@@ -382,7 +382,7 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { g_hMenu[0] = AddMenuItem(sim301,110000,g_hICO[ICO_CM_EST],MODULENAME"/SIM_EST",CMIF_NOTOFFLINE);
g_hMenu[1] = AddMenuItem(sim302,110001,g_hICO[ICO_CM_DIS],MODULENAME"/SIM_DIS",CMIF_NOTOFFLINE);
- if(ServiceExists(MS_CLIST_MENUBUILDSUBGROUP)) {
+ if (ServiceExists(MS_CLIST_MENUBUILDSUBGROUP)) {
g_hMenu[2] = AddMenuItem(sim312[0],110002,NULL,NULL,CMIF_ROOTPOPUP);
g_hMenu[3] = AddSubItem(g_hMenu[2],sim232[0],110003,110002,MODULENAME"/SIM_ST_DIS");
g_hMenu[4] = AddSubItem(g_hMenu[2],sim232[1],110004,110002,MODULENAME"/SIM_ST_ENA");
@@ -406,7 +406,7 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { g_hMenu[7] = AddMenuItem(sim307,110007,icon,MODULENAME"/PGP_DEL",0);
}
- if(bGPGloaded) {
+ if (bGPGloaded) {
icon=mode2icon(MODE_GPG|SECURED,2);
g_hMenu[8] = AddMenuItem(sim308,110008,icon,MODULENAME"/GPG_SET",0);
icon=mode2icon(MODE_GPG,2);
@@ -416,7 +416,7 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { #if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("create Mode menu");
#endif
- if(ServiceExists(MS_CLIST_MENUBUILDSUBGROUP)) {
+ if (ServiceExists(MS_CLIST_MENUBUILDSUBGROUP)) {
g_hMenu[10] = AddMenuItem(sim311[0],110010,NULL,NULL,CMIF_ROOTPOPUP);
g_hMenu[11] = AddSubItem(g_hMenu[10],sim231[0],110011,110010,MODULENAME"/MODE_NAT");
g_hMenu[12] = AddSubItem(g_hMenu[10],sim231[1],110012,110010,MODULENAME"/MODE_PGP");
@@ -436,7 +436,7 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { Sent_NetLog("create srmm icons");
#endif
// add icon to srmm status icons
- if(ServiceExists(MS_MSG_ADDICON)) {
+ if (ServiceExists(MS_MSG_ADDICON)) {
StatusIconData sid;
memset(&sid,0,sizeof(sid));
@@ -482,7 +482,7 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { int __cdecl onSystemOKToExit(WPARAM wParam,LPARAM lParam) {
- if(bSavePass) {
+ if (bSavePass) {
LPSTR tmp = gpg_get_passphrases();
DBWriteContactSettingString(0,szModuleName,"gpgSave",tmp);
LocalFree(tmp);
@@ -490,8 +490,8 @@ int __cdecl onSystemOKToExit(WPARAM wParam,LPARAM lParam) { else {
DBDeleteContactSetting(0,szModuleName,"gpgSave");
}
- if(bPGPloaded) pgp_done();
- if(bGPGloaded) gpg_done();
+ if (bPGPloaded) pgp_done();
+ if (bGPGloaded) gpg_done();
rsa_done();
while(iHook--) UnhookEvent(g_hHook[iHook]);
mir_free(g_hHook);
diff --git a/plugins/SecureIM/src/mmi.cpp b/plugins/SecureIM/src/mmi.cpp index 2269d76a51..76a6bd065b 100644 --- a/plugins/SecureIM/src/mmi.cpp +++ b/plugins/SecureIM/src/mmi.cpp @@ -136,11 +136,11 @@ LPSTR utf8_to_miranda(LPCSTR szUtfMsg, DWORD& flags) { // ЇаҐ®Ўа §гҐ¬ ⥪бв Ё§ д®а¬ в ¬Ёа ¤л ў зЁбвл© UTF8
LPSTR miranda_to_utf8(LPCSTR szMirMsg, DWORD flags) {
LPSTR szNewMsg;
- if(flags & PREF_UTF) {
+ if (flags & PREF_UTF) {
szNewMsg = (LPSTR) szMirMsg;
}
else
- if(flags & PREF_UNICODE) {
+ if (flags & PREF_UNICODE) {
szNewMsg = exp->utf8encode((LPCWSTR)(szMirMsg+strlen(szMirMsg)+1));
}
else {
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 26eeb0f1ee..0bef6112b6 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -120,7 +120,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara MoveWindow((HWND)tci.lParam,5,26,rcClient.right-8,rcClient.bottom-29,1);
ShowWindow((HWND)tci.lParam, SW_HIDE);
- if(bPGP && bPGPloaded) {
+ if (bPGP && bPGPloaded) {
tci.lParam = (LPARAM)CreateDialog(g_hInst,MAKEINTRESOURCE(IDD_TAB_PGP),hwnd,DlgProcOptionsPGP);
tci.pszText = (LPSTR)sim214;
TC_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 3, &tci);
@@ -128,7 +128,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara ShowWindow((HWND)tci.lParam, SW_HIDE);
}
- if(bGPG && bGPGloaded) {
+ if (bGPG && bGPGloaded) {
tci.lParam = (LPARAM)CreateDialog(g_hInst,MAKEINTRESOURCE(IDD_TAB_GPG),hwnd,DlgProcOptionsGPG);
tci.pszText = (LPSTR)sim226;
TC_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 4, &tci);
@@ -320,11 +320,11 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR case ID_SETPSK: {
idx = ListView_GetSelectionMark(hLV);
ptr = (pUinKey) getListViewParam(hLV,idx);
- if(ptr) {
+ if (ptr) {
LPSTR buffer = (LPSTR)alloca(PSKSIZE+1);
getContactName(ptr->hContact, buffer);
int res = DialogBoxParam(g_hInst,MAKEINTRESOURCE(IDD_PSK),NULL,DlgProcSetPSK,(LPARAM)buffer);
- if(res == IDOK) {
+ if (res == IDOK) {
setListViewPSK(hLV,idx,1);
DBWriteContactSettingString(ptr->hContact,szModuleName,"tPSK",buffer);
}
@@ -335,7 +335,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR case ID_DELPSK: {
idx = ListView_GetSelectionMark(hLV);
ptr = (pUinKey) getListViewParam(hLV,idx);
- if(ptr) {
+ if (ptr) {
setListViewPSK(hLV,idx,0);
DBDeleteContactSetting(ptr->hContact, szModuleName, "tPSK");
}
@@ -345,7 +345,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR case ID_DELPUBL: {
idx = ListView_GetSelectionMark(hLV);
ptr = (pUinKey) getListViewParam(hLV,idx);
- if(ptr) {
+ if (ptr) {
setListViewPUB(hLV,idx,0);
}
}
@@ -354,7 +354,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR case ID_EXPPUBL: {
idx = ListView_GetSelectionMark(hLV);
ptr = (pUinKey) getListViewParam(hLV,idx);
- if(ptr) {
+ if (ptr) {
if ( !ptr->keyLoaded ) {
createRSAcntx(ptr);
loadRSAkey(ptr);
@@ -373,7 +373,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR case ID_IMPPUBL: {
idx = ListView_GetSelectionMark(hLV);
ptr = (pUinKey) getListViewParam(hLV,idx);
- if(ptr) {
+ if (ptr) {
createRSAcntx(ptr);
LPSTR pub = (LPSTR) alloca(RSASIZE);
if ( !LoadImportRSAKeyDlg(hDlg,pub,0)) return TRUE;
@@ -463,7 +463,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR case IDC_STD_USERLIST: {
switch(((LPNMHDR)lParam)->code) {
case NM_DBLCLK: {
- if(LPNMLISTVIEW(lParam)->iSubItem == 2) {
+ if (LPNMLISTVIEW(lParam)->iSubItem == 2) {
idx = LPNMLISTVIEW(lParam)->iItem;
ptr = (pUinKey) getListViewParam(hLV,idx);
if (ptr) {
@@ -476,11 +476,11 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
}
}
- if(LPNMLISTVIEW(lParam)->iSubItem == 3) {
+ if (LPNMLISTVIEW(lParam)->iSubItem == 3) {
idx = LPNMLISTVIEW(lParam)->iItem;
ptr = (pUinKey) getListViewParam(hLV,idx);
if (ptr) {
- ptr->tstatus++; if(ptr->tstatus>(ptr->tmode==MODE_RSAAES?1:2)) ptr->tstatus=0;
+ ptr->tstatus++; if (ptr->tstatus>(ptr->tmode==MODE_RSAAES?1:2)) ptr->tstatus=0;
setListViewStatus(hLV,idx,ptr->tstatus);
setListViewIcon(hLV,idx,ptr);
SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
@@ -761,7 +761,7 @@ INT_PTR CALLBACK DlgProcOptionsPGP(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l char PubRingPath[MAX_PATH], SecRingPath[MAX_PATH];
PubRingPath[0]='\0'; SecRingPath[0]='\0';
bPGPkeyrings = pgp_open_keyrings(PubRingPath,SecRingPath);
- if(bPGPkeyrings && PubRingPath[0] && SecRingPath[0]) {
+ if (bPGPkeyrings && PubRingPath[0] && SecRingPath[0]) {
DBWriteContactSettingString(0,szModuleName,"pgpPubRing",PubRingPath);
DBWriteContactSettingString(0,szModuleName,"pgpSecRing",SecRingPath);
}
@@ -780,9 +780,9 @@ INT_PTR CALLBACK DlgProcOptionsPGP(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l break;
case IDC_LOAD_PRIVKEY: {
char KeyPath[MAX_PATH]; KeyPath[0]='\0';
- if(ShowSelectKeyDlg(hDlg,KeyPath)) {
+ if (ShowSelectKeyDlg(hDlg,KeyPath)) {
char *priv = LoadKeys(KeyPath,true);
- if(priv) {
+ if (priv) {
DBWriteContactSettingString(0,szModuleName,"tpgpPrivKey",priv);
mir_free(priv);
}
@@ -911,9 +911,9 @@ INT_PTR CALLBACK DlgProcOptionsGPG(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l switch(LOWORD(wParam)) {
/* case IDC_LOAD_PRIVKEY: {
char KeyPath[MAX_PATH] = {0};
- if(ShowSelectKeyDlg(hDlg,KeyPath)) {
+ if (ShowSelectKeyDlg(hDlg,KeyPath)) {
char *priv = LoadKeys(KeyPath,true);
- if(priv) {
+ if (priv) {
DBWriteContactSettingString(0,szModuleName,"tpgpPrivKey",priv);
mir_free(priv);
}
@@ -985,7 +985,7 @@ INT_PTR CALLBACK DlgProcOptionsGPG(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l case IDC_GPG_USERLIST: {
switch(((LPNMHDR)lParam)->code) {
case NM_DBLCLK: {
- if(LPNMLISTVIEW(lParam)->iSubItem == 3) {
+ if (LPNMLISTVIEW(lParam)->iSubItem == 3) {
idx = LPNMLISTVIEW(lParam)->iItem;
ptr = (pUinKey) getListViewParam(hLV,idx);
if ( !ptr ) break;
@@ -1034,7 +1034,7 @@ INT_PTR CALLBACK DlgProcSetPSK(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) switch(LOWORD(wParam)) {
case IDOK: {
int len = GetDlgItemTextA(hDlg,IDC_EDIT1,buffer,PSKSIZE);
- if(len<8) {
+ if (len<8) {
msgbox1(hDlg,sim211,szModuleName,MB_OK|MB_ICONEXCLAMATION);
return TRUE;
}
@@ -1218,7 +1218,7 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit) { EnableWindow(GetDlgItem(hDlg, IDC_LOAD_PRIVKEY), !bUseKeyrings);
SetDlgItemText(hDlg, IDC_PGP_PRIVKEY, bPGPprivkey?Translate(sim222):Translate(sim223));
- if(bPGPloaded && ver) {
+ if (bPGPloaded && ver) {
char pgpVerStr[64];
sprintf(pgpVerStr, Translate(sim218), ver >> 24, (ver >> 16) & 255, (ver >> 8) & 255);
SetDlgItemText(hDlg, IDC_PGP_SDK, pgpVerStr);
@@ -1276,19 +1276,19 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit) { Sent_NetLog("RefreshGPGDlg");
#endif
path = myDBGetString(0,szModuleName,"gpgExec");
- if(path) {
+ if (path) {
SetDlgItemText(hDlg, IDC_GPGEXECUTABLE_EDIT, path);
mir_free(path);
}
path = myDBGetString(0,szModuleName,"gpgHome");
- if(path) {
+ if (path) {
SetDlgItemText(hDlg, IDC_GPGHOME_EDIT, path);
mir_free(path);
}
BOOL bGPGLogFlag = db_get_b(0, szModuleName, "gpgLogFlag",0);
SendMessage(GetDlgItem(hDlg,IDC_LOGGINGON_CBOX),BM_SETCHECK,(bGPGLogFlag)?BST_CHECKED:BST_UNCHECKED,0L);
path = myDBGetString(0,szModuleName,"gpgLog");
- if(path) {
+ if (path) {
SetDlgItemText(hDlg, IDC_GPGLOGFILE_EDIT, path);
mir_free(path);
}
@@ -1296,7 +1296,7 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit) { BOOL bGPGTmpFlag = db_get_b(0, szModuleName, "gpgTmpFlag",0);
SendMessage(GetDlgItem(hDlg,IDC_TMPPATHON_CBOX),BM_SETCHECK,(bGPGTmpFlag)?BST_CHECKED:BST_UNCHECKED,0L);
path = myDBGetString(0,szModuleName,"gpgTmp");
- if(path) {
+ if (path) {
SetDlgItemText(hDlg, IDC_GPGTMPPATH_EDIT, path);
mir_free(path);
}
@@ -1420,7 +1420,7 @@ void ApplyGeneralSettings(HWND hDlg) { // Key Exchange Timeout
GetDlgItemText(hDlg,IDC_KET,timeout,5);
- tmp = atoi(timeout); if(tmp > 65535) tmp = 65535;
+ tmp = atoi(timeout); if (tmp > 65535) tmp = 65535;
DBWriteContactSettingWord(0,szModuleName,"ket",tmp);
exp->rsa_set_timeout( DBGetContactSettingWord(0,szModuleName,"ket",10));
mir_itoa(tmp,timeout,10);
@@ -1428,7 +1428,7 @@ void ApplyGeneralSettings(HWND hDlg) { // Offline Key Timeout
GetDlgItemText(hDlg,IDC_OKT,timeout,5);
- tmp = atoi(timeout); if(tmp > 65535) tmp = 65535;
+ tmp = atoi(timeout); if (tmp > 65535) tmp = 65535;
DBWriteContactSettingWord(0,szModuleName,"okt",tmp);
mir_itoa(tmp,timeout,10);
SetDlgItemText(hDlg,IDC_OKT,timeout);
@@ -1450,16 +1450,16 @@ void ApplyGeneralSettings(HWND hDlg) { {
tmp = 0;
i = SendMessage(GetDlgItem(hDlg, IDC_PGP),BM_GETCHECK,0L,0L)==BST_CHECKED;
- if(i!=bPGP) {
+ if (i!=bPGP) {
bPGP = i; tmp++;
db_set_b(0, szModuleName, "pgp", bPGP);
}
i = SendMessage(GetDlgItem(hDlg, IDC_GPG),BM_GETCHECK,0L,0L)==BST_CHECKED;
- if(i!=bGPG) {
+ if (i!=bGPG) {
bGPG = i; tmp++;
db_set_b(0, szModuleName, "gpg", bGPG);
}
- if(tmp) msgbox1(hDlg, sim224, szModuleName, MB_OK|MB_ICONINFORMATION);
+ if (tmp) msgbox1(hDlg, sim224, szModuleName, MB_OK|MB_ICONINFORMATION);
}
HWND hLV = GetDlgItem(hDlg,IDC_STD_USERLIST);
@@ -1473,7 +1473,7 @@ void ApplyGeneralSettings(HWND hDlg) { }
if ( ptr->status!=ptr->tstatus ) {
ptr->status = ptr->tstatus;
- if(ptr->status==STATUS_ENABLED) DBDeleteContactSetting(ptr->hContact, szModuleName, "StatusID");
+ if (ptr->status==STATUS_ENABLED) DBDeleteContactSetting(ptr->hContact, szModuleName, "StatusID");
else db_set_b(ptr->hContact, szModuleName, "StatusID", ptr->status);
}
if ( ptr->mode==MODE_NATIVE ) {
@@ -1525,7 +1525,7 @@ void ApplyPGPSettings(HWND hDlg) { db_set_b(0,szModuleName,"ukr",bUseKeyrings);
char *priv = myDBGetString(0,szModuleName,"tpgpPrivKey");
- if(priv) {
+ if (priv) {
bPGPprivkey = true;
pgp_set_priv_key(priv);
myDBWriteStringEncode(0,szModuleName,"pgpPrivKey",priv);
@@ -1551,14 +1551,14 @@ void ApplyGPGSettings(HWND hDlg) { db_set_b(0,szModuleName,"gpgLogFlag",bgpgLogFlag);
GetDlgItemText(hDlg, IDC_GPGLOGFILE_EDIT, tmp, sizeof(tmp));
DBWriteContactSettingString(0,szModuleName,"gpgLog",tmp);
- if(bgpgLogFlag) gpg_set_log(tmp);
+ if (bgpgLogFlag) gpg_set_log(tmp);
else gpg_set_log(0);
BOOL bgpgTmpFlag = (SendMessage(GetDlgItem(hDlg, IDC_TMPPATHON_CBOX),BM_GETCHECK,0L,0L)==BST_CHECKED);
db_set_b(0,szModuleName,"gpgTmpFlag",bgpgTmpFlag);
GetDlgItemText(hDlg, IDC_GPGTMPPATH_EDIT, tmp, sizeof(tmp));
DBWriteContactSettingString(0,szModuleName,"gpgTmp",tmp);
- if(bgpgTmpFlag) gpg_set_tmp(tmp);
+ if (bgpgTmpFlag) gpg_set_tmp(tmp);
else gpg_set_tmp(0);
HWND hLV = GetDlgItem(hDlg,IDC_GPG_USERLIST);
@@ -1684,7 +1684,7 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { int s,d,m=1;
DBVARIANT dbv1,dbv2;
- if(lParamSort&0x100) {
+ if (lParamSort&0x100) {
lParamSort&=0xFF;
m=-1;
}
@@ -1714,7 +1714,7 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { DBGetContactSetting(pUinKey(lParam2)->hContact,szModuleName,"pgp_abbr",&dbv2);
s=(dbv1.type==DBVT_ASCIIZ);
d=(dbv2.type==DBVT_ASCIIZ);
- if(s && d) {
+ if (s && d) {
s=strcmp(dbv1.pszVal,dbv2.pszVal);
d=0;
}
@@ -1727,7 +1727,7 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { DBGetContactSetting(pUinKey(lParam2)->hContact,szModuleName,"gpg",&dbv2);
s=(dbv1.type==DBVT_ASCIIZ);
d=(dbv2.type==DBVT_ASCIIZ);
- if(s && d) {
+ if (s && d) {
s=strcmp(dbv1.pszVal,dbv2.pszVal);
d=0;
}
@@ -1767,7 +1767,7 @@ void ListView_Sort(HWND hLV, LPARAM lParamSort) { // restore sort order
sprintf(t,"os%02x",(UINT)lParamSort);
int m=db_get_b(0, szModuleName, t, 0);
- if(bChangeSortOrder){ m=!m; db_set_b(0, szModuleName, t, m); }
+ if (bChangeSortOrder){ m=!m; db_set_b(0, szModuleName, t, m); }
ListView_SortItems(hLV,&CompareFunc,lParamSort|(m<<8));
}
@@ -1804,7 +1804,7 @@ LPSTR LoadKeys(LPCSTR file,BOOL priv) { fseek(f,0,SEEK_SET);
LPCSTR beg,end;
- if(priv) {
+ if (priv) {
beg = priv_beg;
end = priv_end;
}
@@ -1820,11 +1820,11 @@ LPSTR LoadKeys(LPCSTR file,BOOL priv) { b=true;
}
else
- if(b && strncmp(keys+i,end,strlen(end))==0) {
+ if (b && strncmp(keys+i,end,strlen(end))==0) {
i+=(int)strlen(keys+i);
b=false;
}
- if(b) {
+ if (b) {
i+=(int)strlen(keys+i);
}
}
@@ -1883,7 +1883,7 @@ BOOL LoadImportRSAKeyDlg(HWND hParent, LPSTR key, BOOL priv) if ( !f ) return FALSE;
fseek(f,0,SEEK_END);
- int flen = ftell(f); if(flen>RSASIZE) { fclose(f); return FALSE; }
+ int flen = ftell(f); if (flen>RSASIZE) { fclose(f); return FALSE; }
fseek(f,0,SEEK_SET);
fread(key,flen,1,f);
diff --git a/plugins/SecureIM/src/popupOptions.cpp b/plugins/SecureIM/src/popupOptions.cpp index eb588dde70..23db06cfef 100644 --- a/plugins/SecureIM/src/popupOptions.cpp +++ b/plugins/SecureIM/src/popupOptions.cpp @@ -171,7 +171,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk }
else indic=1;
- if(indic==1)SendMessage(hec,BM_SETCHECK,BST_CHECKED,0L);
+ if (indic==1)SendMessage(hec,BM_SETCHECK,BST_CHECKED,0L);
else SendMessage(hec,BM_SETCHECK,BST_UNCHECKED,0L);
// dc checkbox
@@ -180,7 +180,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk }
else indic=1;
- if(indic==1)SendMessage(hdc,BM_SETCHECK,BST_CHECKED,0L);
+ if (indic==1)SendMessage(hdc,BM_SETCHECK,BST_CHECKED,0L);
else SendMessage(hdc,BM_SETCHECK,BST_UNCHECKED,0L);
// ks checkbox
@@ -189,7 +189,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk }
else indic=1;
- if(indic==1)SendMessage(hks,BM_SETCHECK,BST_CHECKED,0L);
+ if (indic==1)SendMessage(hks,BM_SETCHECK,BST_CHECKED,0L);
else SendMessage(hks,BM_SETCHECK,BST_UNCHECKED,0L);
// kr checkbox
@@ -198,7 +198,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk }
else indic=1;
- if(indic==1)SendMessage(hkr,BM_SETCHECK,BST_CHECKED,0L);
+ if (indic==1)SendMessage(hkr,BM_SETCHECK,BST_CHECKED,0L);
else SendMessage(hkr,BM_SETCHECK,BST_UNCHECKED,0L);
//ss checkbox
@@ -207,7 +207,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk }
else indic=0;
- if(indic==1)SendMessage(hss,BM_SETCHECK,BST_CHECKED,0L);
+ if (indic==1)SendMessage(hss,BM_SETCHECK,BST_CHECKED,0L);
else SendMessage(hss,BM_SETCHECK,BST_UNCHECKED,0L);
//sr checkbox
@@ -216,7 +216,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk }
else indic=0;
- if(indic==1)SendMessage(hsr,BM_SETCHECK,BST_CHECKED,0L);
+ if (indic==1)SendMessage(hsr,BM_SETCHECK,BST_CHECKED,0L);
else SendMessage(hsr,BM_SETCHECK,BST_UNCHECKED,0L);
DBFreeVariant(&dbv);
diff --git a/plugins/SecureIM/src/secureim.h b/plugins/SecureIM/src/secureim.h index a307d1e5a2..c2c3ff3eea 100644 --- a/plugins/SecureIM/src/secureim.h +++ b/plugins/SecureIM/src/secureim.h @@ -132,41 +132,4 @@ const SIG signs[] = { #define ADV_CNT 8
#define ALL_CNT (IEC_CNT+ICO_CNT+POP_CNT)
-struct ICONS {
- UINT key; // Resource ID
- BYTE tbl; // Table NUM
- BYTE idx; // Table IDX
- char *section;
- char *name;
- char *text;
-};
-
-const ICONS icons[] = {
- // Contact List
- {IDI_CL_DIS, TBL_IEC, IEC_CL_DIS, MODULENAME"/Contact List", "sim_cl_dis", "Connection Disabled"},
- {IDI_CL_EST, TBL_IEC, IEC_CL_EST, MODULENAME"/Contact List", "sim_cl_est", "Connection Established"},
- // Contact Menu
- {IDI_CM_DIS, TBL_ICO, ICO_CM_DIS, MODULENAME"/Contact Menu", "sim_cm_dis", "Disable Secure Connection"},
- {IDI_CM_EST, TBL_ICO, ICO_CM_EST, MODULENAME"/Contact Menu", "sim_cm_est", "Establishe Secure Connection"},
- // Message Window
- {IDI_MW_DIS, TBL_ICO, ICO_MW_DIS, MODULENAME"/Message Window", "sim_mw_dis", "Connection Disabled"},
- {IDI_MW_EST, TBL_ICO, ICO_MW_EST, MODULENAME"/Message Window", "sim_mw_est", "Connection Established"},
- // popup's
- {IDI_PU_DIS, TBL_POP, POP_PU_DIS, MODULENAME"/Popups", "sim_pu_dis", "Secure Connection Disabled"},
- {IDI_PU_EST, TBL_POP, POP_PU_EST, MODULENAME"/Popups", "sim_pu_est", "Secure Connection Established"},
- {IDI_PU_PRC, TBL_POP, POP_PU_PRC, MODULENAME"/Popups", "sim_pu_prc", "Secure Connection In Process"},
- {IDI_PU_MSG, TBL_POP, POP_PU_MSR, MODULENAME"/Popups", "sim_pu_msr", "Recv Secured Message"},
- {IDI_PU_MSG, TBL_POP, POP_PU_MSS, MODULENAME"/Popups", "sim_pu_mss", "Sent Secured Message"},
- // statuses
- {IDI_ST_DIS, TBL_ICO, ICO_ST_DIS, MODULENAME"/Menu State", "sim_st_dis", "Disabled"},
- {IDI_ST_ENA, TBL_ICO, ICO_ST_ENA, MODULENAME"/Menu State", "sim_st_ena", "Enabled"},
- {IDI_ST_TRY, TBL_ICO, ICO_ST_TRY, MODULENAME"/Menu State", "sim_st_try", "Always Try"},
- // overlay
- {IDI_OV_NAT, TBL_ICO, ICO_OV_NAT, MODULENAME"/Overlays", "sim_ov_nat", "Native mode"},
- {IDI_OV_PGP, TBL_ICO, ICO_OV_PGP, MODULENAME"/Overlays", "sim_ov_pgp", "PGP mode"},
- {IDI_OV_GPG, TBL_ICO, ICO_OV_GPG, MODULENAME"/Overlays", "sim_ov_gpg", "GPG mode"},
- {IDI_OV_RSA, TBL_ICO, ICO_OV_RSA, MODULENAME"/Overlays", "sim_ov_rsa", "RSA/AES mode"},
- {0}
-};
-
#endif
diff --git a/plugins/SecureIM/src/splitmsg.cpp b/plugins/SecureIM/src/splitmsg.cpp index ca4f0635cf..944393025b 100644 --- a/plugins/SecureIM/src/splitmsg.cpp +++ b/plugins/SecureIM/src/splitmsg.cpp @@ -68,7 +68,7 @@ LPSTR combineMessage(pUinKey ptr, LPSTR szMsg) { #endif
int len=0,i;
for ( i=0; i<part_all; i++ ) {
- if(pm->message[i]==NULL) break;
+ if (pm->message[i]==NULL) break;
len+=(int)strlen(pm->message[i]);
}
if ( i==part_all ) { // combine message
@@ -79,7 +79,7 @@ LPSTR combineMessage(pUinKey ptr, LPSTR szMsg) { delete pm->message[i];
}
delete pm->message;
- if(ppm) ppm->nextMessage = pm->nextMessage;
+ if (ppm) ppm->nextMessage = pm->nextMessage;
else ptr->msgPart = pm->nextMessage;
delete pm;
#if defined(_DEBUG) || defined(NETLIB_LOG)
diff --git a/plugins/SecureIM/src/svcs_clist.cpp b/plugins/SecureIM/src/svcs_clist.cpp index a37dbf70d5..e1c1d7e19c 100644 --- a/plugins/SecureIM/src/svcs_clist.cpp +++ b/plugins/SecureIM/src/svcs_clist.cpp @@ -148,7 +148,7 @@ int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) { }
}
if ( ptr->mode==MODE_GPG && bGPGloaded ) {
- if(bGPGkeyrings && !isPGP) {
+ if (bGPGkeyrings && !isPGP) {
mi.flags = CMIM_FLAGS;
CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_hMenu[isGPG+8],(LPARAM)&mi);
}
diff --git a/plugins/SecureIM/src/svcs_menu.cpp b/plugins/SecureIM/src/svcs_menu.cpp index 77a9271994..d2b37b8155 100644 --- a/plugins/SecureIM/src/svcs_menu.cpp +++ b/plugins/SecureIM/src/svcs_menu.cpp @@ -26,9 +26,9 @@ INT_PTR __cdecl Service_Status(WPARAM wParam, LPARAM lParam) { case STATUS_ENABLED:
case STATUS_ALWAYSTRY:
pUinKey ptr = getUinKey((HANDLE)wParam);
- if(ptr) {
+ if (ptr) {
ptr->status=ptr->tstatus=(BYTE)lParam;
- if(ptr->status==STATUS_ENABLED) DBDeleteContactSetting(ptr->hContact, szModuleName, "StatusID");
+ if (ptr->status==STATUS_ENABLED) DBDeleteContactSetting(ptr->hContact, szModuleName, "StatusID");
else db_set_b(ptr->hContact, szModuleName, "StatusID", ptr->status);
}
break;
@@ -58,7 +58,7 @@ INT_PTR __cdecl Service_StatusTry(WPARAM wParam, LPARAM lParam) { INT_PTR __cdecl Service_PGPdelKey(WPARAM wParam, LPARAM lParam) {
- if(bPGPloaded) {
+ if (bPGPloaded) {
DBDeleteContactSetting((HANDLE)wParam, szModuleName, "pgp");
DBDeleteContactSetting((HANDLE)wParam, szModuleName, "pgp_mode");
DBDeleteContactSetting((HANDLE)wParam, szModuleName, "pgp_abbr");
@@ -75,11 +75,11 @@ INT_PTR __cdecl Service_PGPdelKey(WPARAM wParam, LPARAM lParam) { INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) {
BOOL del = true;
- if(bPGPloaded) {
- if(bPGPkeyrings) {
+ if (bPGPloaded) {
+ if (bPGPkeyrings) {
char szKeyID[128]; szKeyID[0]='\0';
PVOID KeyID = pgp_select_keyid(GetForegroundWindow(),szKeyID);
- if(szKeyID[0]) {
+ if (szKeyID[0]) {
DBDeleteContactSetting((HANDLE)wParam,szModuleName,"pgp");
DBCONTACTWRITESETTING cws;
memset(&cws,0,sizeof(cws));
@@ -95,11 +95,11 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) { }
}
else
- if(bPGPprivkey) {
+ if (bPGPprivkey) {
char KeyPath[MAX_PATH]; KeyPath[0]='\0';
- if(ShowSelectKeyDlg(0,KeyPath)) {
+ if (ShowSelectKeyDlg(0,KeyPath)) {
char *publ = LoadKeys(KeyPath,false);
- if(publ) {
+ if (publ) {
DBDeleteContactSetting((HANDLE)wParam,szModuleName,"pgp");
myDBWriteStringEncode((HANDLE)wParam,szModuleName,"pgp",publ);
db_set_b((HANDLE)wParam,szModuleName,"pgp_mode",1);
@@ -111,7 +111,7 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) { }
}
- if(del) Service_PGPdelKey(wParam,lParam);
+ if (del) Service_PGPdelKey(wParam,lParam);
else {
pUinKey ptr = getUinKey((HANDLE)wParam);
cpp_delete_context(ptr->cntx); ptr->cntx=0;
@@ -123,7 +123,7 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) { INT_PTR __cdecl Service_GPGdelKey(WPARAM wParam, LPARAM lParam) {
- if(bGPGloaded) {
+ if (bGPGloaded) {
DBDeleteContactSetting((HANDLE)wParam, szModuleName, "gpg");
}
{
@@ -138,16 +138,16 @@ INT_PTR __cdecl Service_GPGdelKey(WPARAM wParam, LPARAM lParam) { INT_PTR __cdecl Service_GPGsetKey(WPARAM wParam, LPARAM lParam) {
BOOL del = true;
- if(bGPGloaded && bGPGkeyrings) {
+ if (bGPGloaded && bGPGkeyrings) {
char szKeyID[128]; szKeyID[0]='\0';
gpg_select_keyid(GetForegroundWindow(),szKeyID);
- if(szKeyID[0]) {
+ if (szKeyID[0]) {
DBWriteContactSettingString((HANDLE)wParam,szModuleName,"gpg",szKeyID);
del = false;
}
}
- if(del) Service_GPGdelKey(wParam,lParam);
+ if (del) Service_GPGdelKey(wParam,lParam);
else {
pUinKey ptr = getUinKey((HANDLE)wParam);
cpp_delete_context(ptr->cntx); ptr->cntx=0;
@@ -174,7 +174,7 @@ INT_PTR __cdecl Service_Mode(WPARAM wParam, LPARAM lParam) { case MODE_PGP:
case MODE_GPG:
// нужно много проверок и отключение активного контекста если необходимо
- if(ptr) {
+ if (ptr) {
if ( ptr->cntx ) {
cpp_delete_context(ptr->cntx);
ptr->cntx = 0;
diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp index eb5466c329..803ba30c8a 100644 --- a/plugins/SecureIM/src/svcs_proto.cpp +++ b/plugins/SecureIM/src/svcs_proto.cpp @@ -3,7 +3,7 @@ // return SignID
int getSecureSig(LPCSTR szMsg, LPSTR *szPlainMsg=NULL) {
- if(szPlainMsg) *szPlainMsg=(LPSTR)szMsg;
+ if (szPlainMsg) *szPlainMsg=(LPSTR)szMsg;
for(int i=0;signs[i].len;i++) {
if (memcmp(szMsg,signs[i].sig,signs[i].len)==0) {
/* for(int i=strlen(szMsg)-1;i;i--) {
@@ -12,8 +12,8 @@ int getSecureSig(LPCSTR szMsg, LPSTR *szPlainMsg=NULL) { else
break;
}*/
- if(szPlainMsg) *szPlainMsg = (LPSTR)(szMsg+signs[i].len);
- if(signs[i].key==SiG_GAME && !bDGP)
+ if (szPlainMsg) *szPlainMsg = (LPSTR)(szMsg+signs[i].len);
+ if (signs[i].key==SiG_GAME && !bDGP)
return SiG_NONE;
return signs[i].key;
}
@@ -60,7 +60,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { SAFE_FREE(szUnrtfMsg);
int len = (int)strlen(szEncMsg)+1;
LPWSTR szTemp = (LPWSTR)mir_alloc(len*sizeof(WCHAR));
- if(ppre->flags & PREF_UNICODE)
+ if (ppre->flags & PREF_UNICODE)
rtfconvW((LPWSTR)(szEncMsg+len),szTemp);
else
rtfconvA(szEncMsg,szTemp);
@@ -118,7 +118,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { #if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onRecvMsg: non-secure message");
#endif
- if(ppre->flags & PREF_UNICODE) {
+ if (ppre->flags & PREF_UNICODE) {
szPlainMsg = m_awstrcat(Translate(sim402),szEncMsg);
}
else {
@@ -201,9 +201,9 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { if (!ptr->keyLoaded && bPGPloaded) ptr->keyLoaded = LoadKeyPGP(ptr);
if (!ptr->keyLoaded && bGPGloaded) ptr->keyLoaded = LoadKeyGPG(ptr);
- if(ptr->keyLoaded==1) szOldMsg = pgp_decode(ptr->cntx, szEncMsg);
+ if (ptr->keyLoaded==1) szOldMsg = pgp_decode(ptr->cntx, szEncMsg);
else
- if(ptr->keyLoaded==2) szOldMsg = gpg_decode(ptr->cntx, szEncMsg);
+ if (ptr->keyLoaded==2) szOldMsg = gpg_decode(ptr->cntx, szEncMsg);
if (!szOldMsg) { // error while decrypting message, send error
SAFE_FREE(ptr->msgSplitted);
@@ -473,7 +473,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { showPopUpKR(ptr->hContact);
cpp_reset_context(ptr->cntx);
- if(InitKeyB(ptr,szEncMsg)!=CPP_ERROR_NONE) {
+ if (InitKeyB(ptr,szEncMsg)!=CPP_ERROR_NONE) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onRecvMsg: SiG_KEYA InitKeyB error");
#endif
@@ -618,7 +618,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { // если можно зашифровать - шифруем
if ( isContactPGP(ptr->hContact) || isContactGPG(ptr->hContact)) {
/*
- if(stat==ID_STATUS_OFFLINE) {
+ if (stat==ID_STATUS_OFFLINE) {
if (msgbox1(0,sim110,szModuleName,MB_YESNO|MB_ICONQUESTION)==IDNO) {
return returnNoError(pccsd->hContact);
}
@@ -894,8 +894,8 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { dbei.flags = DBEF_SENT;
dbei.timestamp = time(NULL);
dbei.eventType = EVENTTYPE_MESSAGE;
- if(pccsd->wParam & PREF_RTL) dbei.flags |= DBEF_RTL;
- if(pccsd->wParam & PREF_UTF) dbei.flags |= DBEF_UTF;
+ if (pccsd->wParam & PREF_RTL) dbei.flags |= DBEF_RTL;
+ if (pccsd->wParam & PREF_UTF) dbei.flags |= DBEF_UTF;
dbei.cbBlob = strlen((char *)pccsd->lParam) + 1;
if ( pccsd->wParam & PREF_UNICODE )
dbei.cbBlob *= ( sizeof( wchar_t )+1 );
@@ -970,7 +970,7 @@ INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam) { if ( isContactSecured(pccsd->hContact)&SECURED ) {
char **file=(char **)pccsd->lParam;
- if(file_idx==100) file_idx=0;
+ if (file_idx==100) file_idx=0;
int i;
for(i=0;file[i];i++) {
@@ -1090,7 +1090,7 @@ int __cdecl onProtoAck(WPARAM wParam,LPARAM lParam) { buf[0]='\0';
LPSTR p=strrchr(file_out,'.');
LPSTR x=strrchr(file_out,'\\');
- if(p>x) {
+ if (p>x) {
strcpy(buf,p);
pos=p;
}
diff --git a/plugins/SecureIM/src/svcs_rsa.cpp b/plugins/SecureIM/src/svcs_rsa.cpp index 3b75840b74..18daf53c62 100644 --- a/plugins/SecureIM/src/svcs_rsa.cpp +++ b/plugins/SecureIM/src/svcs_rsa.cpp @@ -67,7 +67,7 @@ int __cdecl rsa_check_pub(HANDLE context, PBYTE pub, int pubLen, PBYTE sig, int Sent_NetLog("rsa_check_pub: manual accepted %d",v);
#endif
}
- if(v) {
+ if (v) {
DBCONTACTWRITESETTING cws;
cws.szModule = szModuleName;
cws.szSetting = "rsa_pub";
@@ -129,7 +129,7 @@ void __cdecl rsa_notify(HANDLE context, int state) { sprintf(buf,sim510,-state);
showPopUpDCmsg(ptr->hContact,buf);
ShowStatusIconNotify(ptr->hContact);
- if(ptr->cntx) deleteRSAcntx(ptr);
+ if (ptr->cntx) deleteRSAcntx(ptr);
waitForExchange(ptr,3); // досылаем нешифровано
return;
}
@@ -137,7 +137,7 @@ void __cdecl rsa_notify(HANDLE context, int state) { case -4: { // соединение разорвано вручную другой стороной
showPopUpDC(ptr->hContact);
ShowStatusIconNotify(ptr->hContact);
- if(ptr->cntx) deleteRSAcntx(ptr);
+ if (ptr->cntx) deleteRSAcntx(ptr);
waitForExchange(ptr,3); // досылаем нешифровано
return;
}
@@ -146,7 +146,7 @@ void __cdecl rsa_notify(HANDLE context, int state) { }
showPopUpDCmsg(ptr->hContact,msg);
ShowStatusIconNotify(ptr->hContact);
- if(ptr->cntx) deleteRSAcntx(ptr);
+ if (ptr->cntx) deleteRSAcntx(ptr);
waitForExchange(ptr,3); // досылаем нешифровано
}
diff --git a/plugins/SecureIM/src/svcs_srmm.cpp b/plugins/SecureIM/src/svcs_srmm.cpp index 688246847e..6504a209ac 100644 --- a/plugins/SecureIM/src/svcs_srmm.cpp +++ b/plugins/SecureIM/src/svcs_srmm.cpp @@ -4,7 +4,7 @@ int __cdecl onWindowEvent(WPARAM wParam, LPARAM lParam) {
MessageWindowEventData *mwd = (MessageWindowEventData *)lParam;
- if(mwd->uType == MSG_WINDOW_EVT_OPEN || mwd->uType == MSG_WINDOW_EVT_OPENING) {
+ if (mwd->uType == MSG_WINDOW_EVT_OPEN || mwd->uType == MSG_WINDOW_EVT_OPENING) {
ShowStatusIcon(mwd->hContact);
}
return 0;
@@ -26,7 +26,7 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) { BOOL isChat = isChatRoom(hContact);
if ( !isPGP && !isGPG && !isChat ) {
- if(isSecured) Service_DisableIM(wParam,0);
+ if (isSecured) Service_DisableIM(wParam,0);
else Service_CreateIM(wParam,0);
}
diff --git a/plugins/SendScreenshotPlus/src/mir_icolib.cpp b/plugins/SendScreenshotPlus/src/mir_icolib.cpp index c3a16a43e4..59585c9ad3 100644 --- a/plugins/SendScreenshotPlus/src/mir_icolib.cpp +++ b/plugins/SendScreenshotPlus/src/mir_icolib.cpp @@ -237,125 +237,114 @@ VOID IcoLib_SetCtrlIcons(HWND hDlg, const ICONCTRL* pCtrl, BYTE numCtrls) *
* @return This function returns the HANDLE of the icon item.
**/
+
static HANDLE IcoLib_RegisterIconHandleEx(LPSTR szIconID, LPSTR szDescription, LPSTR szSection, LPTSTR szDefaultFile, INT idIcon, INT Size, HICON hDefIcon)
{
- HANDLE hIconHandle = NULL;
-
- if (szIconID && szDescription && szSection)
- {
- SKINICONDESC sid;
-
- ZeroMemory(&sid, sizeof(sid));
- sid.cbSize = sizeof(sid);
- sid.flags = SIDF_ALL_TCHAR;
- sid.pszName = szIconID;
- sid.ptszDescription = mir_a2t(szDescription);
- sid.ptszSection = mir_a2t(szSection);
-
- if (sid.ptszDescription && sid.ptszSection)
- {
- switch (Size)
- {
- // small and big icons
- case -1:
- {
- sid.cx = sid.cy = 0;
- break;
- }
- // small icons (16x16)
- case 0:
- {
- sid.cx = GetSystemMetrics(SM_CXSMICON);
- sid.cy = GetSystemMetrics(SM_CYSMICON);
- break;
- }
- // normal icons (32x32)
- case 1:
- {
- sid.cx = GetSystemMetrics(SM_CXICON);
- sid.cy = GetSystemMetrics(SM_CYICON);
- break;
- }
- // custom icon size
- default:
- {
- sid.cx = sid.cy = Size;
- break;
- }
- }
+ if (!szIconID || !szDescription || !szSection)
+ return NULL;
+
+ SKINICONDESC sid;
+
+ ZeroMemory(&sid, sizeof(sid));
+ sid.cbSize = sizeof(sid);
+ sid.flags = SIDF_ALL_TCHAR;
+ sid.pszName = szIconID;
+ sid.ptszDescription = mir_a2t(szDescription);
+ sid.ptszSection = mir_a2t(szSection);
+
+ switch (Size) {
+ // small and big icons
+ case -1:
+ sid.cx = sid.cy = 0;
+ break;
+
+ // small icons (16x16)
+ case 0:
+ sid.cx = GetSystemMetrics(SM_CXSMICON);
+ sid.cy = GetSystemMetrics(SM_CYSMICON);
+ break;
+
+ // normal icons (32x32)
+ case 1:
+ sid.cx = GetSystemMetrics(SM_CXICON);
+ sid.cy = GetSystemMetrics(SM_CYICON);
+ break;
+
+ // custom icon size
+ default:
+ sid.cx = sid.cy = Size;
+ break;
+ }
- sid.ptszDefaultFile = szDefaultFile;
- if (sid.ptszDefaultFile && sid.ptszDefaultFile[0])
- {
- if(idIcon < IDI_FIRST_ICON || idIcon > IDI_LASTICON) {
- // Icon from Plugin.dll
- sid.iDefaultIndex = idIcon - IDI_PLUG_MAIN;
- }
- else{
- //UserinfoEx Icon pack
- sid.iDefaultIndex = ICONINDEX(idIcon);
- }
- }
- else
- {
- sid.hDefaultIcon = hDefIcon;
- sid.iDefaultIndex = -1;
- }
- hIconHandle = Skin_AddIcon(&sid);
+ sid.ptszDefaultFile = szDefaultFile;
+ if (sid.ptszDefaultFile && sid.ptszDefaultFile[0]) {
+ if(idIcon < IDI_FIRST_ICON || idIcon > IDI_LASTICON) {
+ // Icon from Plugin.dll
+ sid.iDefaultIndex = idIcon - IDI_PLUG_MAIN;
+ }
+ else{
+ //UserinfoEx Icon pack
+ sid.iDefaultIndex = ICONINDEX(idIcon);
}
- mir_freeAndNil(sid.ptszDescription);
- mir_freeAndNil(sid.ptszSection);
}
+ else {
+ sid.hDefaultIcon = hDefIcon;
+ sid.iDefaultIndex = -1;
+ }
+
+ HANDLE hIconHandle = Skin_AddIcon(&sid);
+ mir_free(sid.ptszDescription);
+ mir_free(sid.ptszSection);
return hIconHandle;
}
/**
- * This function manually registers a single icon from the default icon library.
- *
- * @param szIconID - This is the uniquely identifying string for an icon.
- * This string is the setting name in the database and should
- * only use ASCII characters.
- * @param szDescription - This is the description displayed in the options dialog.
- * @param szSection - This is the subsection, where the icon is organized in the options dialog.
- * @param idIcon - This is the ResourceID of the icon in the default file
- * @param Size - This is the desired size of the icon to load.
- * 0: default size for small icons (16x16)
- * 1: default size for normal icons (32x32)
- *
- * @return This function returns the HANDLE of the icon item.
- **/
+* This function manually registers a single icon from the default icon library.
+*
+* @param szIconID - This is the uniquely identifying string for an icon.
+* This string is the setting name in the database and should
+* only use ASCII characters.
+* @param szDescription - This is the description displayed in the options dialog.
+* @param szSection - This is the subsection, where the icon is organized in the options dialog.
+* @param idIcon - This is the ResourceID of the icon in the default file
+* @param Size - This is the desired size of the icon to load.
+* 0: default size for small icons (16x16)
+* 1: default size for normal icons (32x32)
+*
+* @return This function returns the HANDLE of the icon item.
+**/
HANDLE IcoLib_RegisterIconHandle(LPSTR szIconID, LPSTR szDescription, LPSTR szSection, INT idIcon, INT Size)
{
return IcoLib_RegisterIconHandleEx(szIconID, szDescription, szSection, IcoLib_GetDefaultIconFileName(), idIcon, Size, ghDefIcon);
}
/**
- * This function manually registers a single icon from the default icon library.
- *
- * @param szIconID - This is the uniquely identifying string for an icon.
- * This string is the setting name in the database and should
- * only use ASCII characters.
- * @param szDescription - This is the description displayed in the options dialog.
- * @param szSection - This is the subsection, where the icon is organized in the options dialog.
- * @param idIcon - This is the ResourceID of the icon in the default file
- * @param Size - This is the desired size of the icon to load.
- * 0: default size for small icons (16x16)
- * 1: default size for normal icons (32x32)
- *
- * @return This function returns the HICON of the icon itself.
- **/
+* This function manually registers a single icon from the default icon library.
+*
+* @param szIconID - This is the uniquely identifying string for an icon.
+* This string is the setting name in the database and should
+* only use ASCII characters.
+* @param szDescription - This is the description displayed in the options dialog.
+* @param szSection - This is the subsection, where the icon is organized in the options dialog.
+* @param idIcon - This is the ResourceID of the icon in the default file
+* @param Size - This is the desired size of the icon to load.
+* 0: default size for small icons (16x16)
+* 1: default size for normal icons (32x32)
+*
+* @return This function returns the HICON of the icon itself.
+**/
HICON IcoLib_RegisterIcon(LPSTR szIconID, LPSTR szDescription, LPSTR szSection, INT idIcon, INT Size)
{
return IcoLib_GetIconByHandle(IcoLib_RegisterIconHandle(szIconID, szDescription, szSection, idIcon, Size));
}
/**
- * Add default icons to the skin library or load customized icons
- *
- * @param none
- *
- * @return nothing
- **/
+* Add default icons to the skin library or load customized icons
+*
+* @param none
+*
+* @return nothing
+**/
VOID IcoLib_LoadModule()
{
LPTSTR szDefaultFile;
@@ -370,7 +359,7 @@ VOID IcoLib_LoadModule() // load default icon if required
ghDefIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_PLUG_DEFAULT), IMAGE_ICON,
- GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
+ GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
for (i = 0; i < SIZEOF(icoDesc); i++)
{
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index ac82ba2010..31d5bdddac 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -23,12 +23,10 @@ HINSTANCE hinstance = NULL; WNDPROC mainProc;
-HANDLE hServiceOpenManager,hServiceShowFavMenu,hServiceCloseCurrentSession,hServiceSaveUserSession,
-hServiceLoadLastSession,hmSaveCurrentSession, hmLoadLastSession,hmLoadSession,hmSessionsManager,
-hibSessionsLoad,hibSessionsSave,hibSessionsLoadLast,hibChecked,hibNotChecked;
-
-HICON hiChecked,hiNotChecked,hiSessions,hiSessionsLoad ,hiSessionsSave,hiSessionsLoadLast;
-
+HANDLE
+ hServiceOpenManager, hServiceShowFavMenu, hServiceCloseCurrentSession, hServiceSaveUserSession,
+ hServiceLoadLastSession, hmSaveCurrentSession, hmLoadLastSession, hmLoadSession, hmSessionsManager,
+ hibSessions, hibSessionsLoad, hibSessionsSave, hibSessionsLoadLast, hibChecked, hibNotChecked;
HANDLE hmTBButton[2],hiTBbutton[2],iTBbutton[2];
@@ -781,18 +779,9 @@ int SessionPreShutdown(WPARAM wparam,LPARAM lparam) if (g_hDlg) DestroyWindow(g_hDlg);
if (g_hSDlg) DestroyWindow(g_hSDlg);
- DestroyIcon(hiSessions);
- DestroyIcon(hiSessionsLoad);
- DestroyIcon(hiSessionsSave);
- DestroyIcon(hiSessionsLoadLast);
- DestroyIcon(hiChecked);
- DestroyIcon(hiNotChecked);
-
- if(g_bIncompletedSave)
- {
+ if(g_bIncompletedSave) {
int i=0;
- while(session_list_recovered[i])
- {
+ while(session_list_recovered[i]) {
DBWriteContactSettingByte((HANDLE)session_list_recovered[i], __INTERNAL_NAME, "wasInLastSession", 0);
i++;
}
@@ -888,21 +877,20 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) HookEvent(ME_OPT_INITIALISE, OptionsInit);
HookEvent(ME_TTB_MODULELOADED, CreateButtons);
- hServiceShowFavMenu=CreateServiceFunction(MS_SESSIONS_SHOWFAVORITESMENU, BuildFavMenu);
- hServiceOpenManager=CreateServiceFunction(MS_SESSIONS_OPENMANAGER, OpenSessionsManagerWindow);
- hServiceLoadLastSession=CreateServiceFunction(MS_SESSIONS_RESTORELASTSESSION, LoadLastSession/*LoadSession*/);
- hServiceSaveUserSession=CreateServiceFunction(MS_SESSIONS_SAVEUSERSESSION, SaveUserSessionHandles);
- hServiceCloseCurrentSession=CreateServiceFunction(MS_SESSIONS_CLOSESESSION, CloseCurrentSession);
+ hServiceShowFavMenu = CreateServiceFunction(MS_SESSIONS_SHOWFAVORITESMENU, BuildFavMenu);
+ hServiceOpenManager = CreateServiceFunction(MS_SESSIONS_OPENMANAGER, OpenSessionsManagerWindow);
+ hServiceLoadLastSession = CreateServiceFunction(MS_SESSIONS_RESTORELASTSESSION, LoadLastSession/*LoadSession*/);
+ hServiceSaveUserSession = CreateServiceFunction(MS_SESSIONS_SAVEUSERSESSION, SaveUserSessionHandles);
+ hServiceCloseCurrentSession = CreateServiceFunction(MS_SESSIONS_CLOSESESSION, CloseCurrentSession);
- g_ses_count=DBGetContactSettingByte(0, __INTERNAL_NAME, "UserSessionsCount", 0);
+ g_ses_count = DBGetContactSettingByte(0, __INTERNAL_NAME, "UserSessionsCount", 0);
if (!g_ses_count)
- g_ses_count=DBGetContactSettingByte(0, "Sessions (Unicode)", "UserSessionsCount", 0);
- ses_limit=DBGetContactSettingByte(0, __INTERNAL_NAME, "TrackCount", 10);
- g_bExclHidden=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "ExclHidden", 0);
- g_bWarnOnHidden=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "WarnOnHidden", 0);
- g_bOtherWarnings=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "OtherWarnings", 1);
- g_bCrashRecovery=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "CrashRecovery", 0);
-
+ g_ses_count = DBGetContactSettingByte(0, "Sessions (Unicode)", "UserSessionsCount", 0);
+ ses_limit = DBGetContactSettingByte(0, __INTERNAL_NAME, "TrackCount", 10);
+ g_bExclHidden = DBGetContactSettingByte(NULL, __INTERNAL_NAME, "ExclHidden", 0);
+ g_bWarnOnHidden = DBGetContactSettingByte(NULL, __INTERNAL_NAME, "WarnOnHidden", 0);
+ g_bOtherWarnings = DBGetContactSettingByte(NULL, __INTERNAL_NAME, "OtherWarnings", 1);
+ g_bCrashRecovery = DBGetContactSettingByte(NULL, __INTERNAL_NAME, "CrashRecovery", 0);
if(g_bCrashRecovery)
g_bIncompletedSave=!DBGetContactSettingByte(NULL, __INTERNAL_NAME, "lastSaveCompleted", 0);
@@ -938,8 +926,8 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) g_hDlg=CreateDialog(hinstance,MAKEINTRESOURCE(IDD_WLCMDIALOG), 0, LoadSessionDlgProc);
}
- HOTKEYDESC hkd = {0};
- hkd.cbSize = sizeof(hkd);
+ // Hotkeys
+ HOTKEYDESC hkd = { sizeof(hkd) };
hkd.dwFlags = HKD_TCHAR;
hkd.ptszSection = _T("Sessions");
hkd.pszName = "OpenSessionsManager";
@@ -962,50 +950,45 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) hkd.pszService = MS_SESSIONS_CLOSESESSION;
Hotkey_Register(&hkd);
- hiChecked = LoadIcon(hinstance, MAKEINTRESOURCE(IDD_SESSION_CHECKED));
- hiNotChecked = LoadIcon(hinstance, MAKEINTRESOURCE(IDD_SESSION_UNCHECKED));
-
- hiSessions = LoadIcon(hinstance, MAKEINTRESOURCE(IDI_SESSIONS));
- hiSessionsLoad = LoadIcon(hinstance, MAKEINTRESOURCE(IDI_SESSIONS_LOAD));
- hiSessionsSave = LoadIcon(hinstance, MAKEINTRESOURCE(IDD_SESSIONS_SAVE));
- hiSessionsLoadLast = LoadIcon(hinstance, MAKEINTRESOURCE(IDD_SESSIONS_LOADLAST));
-
- hibChecked = AddIcon(hiChecked, "SessionMarked", LPGENT("Favorite Session"));
- hibNotChecked = AddIcon(hiNotChecked, "SessionUnMarked", LPGENT("Not favorite Session"));
- hibSessionsLoad = AddIcon(hiSessionsLoad, "SessionsLoad", LPGENT("Load Session"));
- hibSessionsSave = AddIcon(hiSessionsSave, "SessionsSave", LPGENT("Save Session"));
- hibSessionsLoadLast = AddIcon(hiSessionsLoadLast, "SessionsLoadLast", LPGENT("Load last Session"));
+ // Icons
+ hibSessions = AddIcon("Sessions", LPGEN("Sessions"), IDD_SESSION_CHECKED);
+ hibChecked = AddIcon("SessionMarked", LPGEN("Favorite Session"), IDD_SESSION_CHECKED);
+ hibNotChecked = AddIcon("SessionUnMarked", LPGEN("Not favorite Session"), IDD_SESSION_UNCHECKED);
+ hibSessionsLoad = AddIcon("SessionsLoad", LPGEN("Load Session"), IDI_SESSIONS_LOAD);
+ hibSessionsSave = AddIcon("SessionsSave", LPGEN("Save Session"), IDD_SESSIONS_SAVE);
+ hibSessionsLoadLast = AddIcon("SessionsLoadLast", LPGEN("Load last Session"), IDD_SESSIONS_LOADLAST);
+ // Main menu
CLISTMENUITEM cl = { sizeof(cl) };
cl.position = 1000000000;
- cl.flags = CMIM_ALL | CMIF_TCHAR;
+ cl.flags = CMIM_ALL | CMIF_TCHAR | CMIF_ICONFROMICOLIB;
cl.ptszName = _T("Save session...");
cl.ptszPopupName = _T("Sessions Manager");
- cl.hIcon = hiSessions;
+ cl.icolibItem = hibSessions;
cl.pszService = MS_SESSIONS_SAVEUSERSESSION;
hmSaveCurrentSession = Menu_AddMainMenuItem(&cl);
cl.ptszName = _T("Load session...");
cl.pszService = MS_SESSIONS_OPENMANAGER;
- cl.hIcon = hiSessionsLoad;
+ cl.icolibItem = hibSessionsLoad;
hmLoadLastSession = Menu_AddMainMenuItem(&cl);
cl.ptszName = _T("Close session");
cl.pszService = MS_SESSIONS_CLOSESESSION;
- cl.hIcon = 0;
+ cl.icolibItem = 0;
hmLoadSession = Menu_AddMainMenuItem(&cl);
cl.ptszName = _T("Load last session");
cl.pszService = MS_SESSIONS_RESTORELASTSESSION;
- cl.hIcon = hiSessionsLoadLast;
+ cl.icolibItem = hibSessionsLoadLast;
cl.position = 10100000;
hmLoadSession = Menu_AddMainMenuItem(&cl);
ZeroMemory(&cl, sizeof(cl));
cl.cbSize = sizeof(cl);
cl.flags = CMIM_ICON;
- cl.hIcon = hiSessionsSave;
+ cl.icolibItem = hibSessionsSave;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hmSaveCurrentSession, (LPARAM)&cl);
return 0;
diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp index 93e7849c2c..97c1d7dc95 100644 --- a/plugins/Sessions/Src/Utils.cpp +++ b/plugins/Sessions/Src/Utils.cpp @@ -526,16 +526,19 @@ BYTE IsMarkedUserDefSession(int ses_count) return DBGetContactSettingByte(NULL, __INTERNAL_NAME, szSessionName, 0);
}
-HANDLE AddIcon(HICON icon, char *name, TCHAR *description)
+HANDLE AddIcon(char *name, char *description, int idx)
{
- SKINICONDESC sid = {0};
- sid.cbSize = sizeof(SKINICONDESC);
- sid.flags = SIDF_ALL_TCHAR;
- sid.ptszSection = _T(__INTERNAL_NAME);
+ TCHAR tszPath[MAX_PATH];
+ GetModuleFileName(hinstance, tszPath, SIZEOF(tszPath));
+
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.flags = SIDF_PATH_TCHAR;
+ sid.pszSection = __INTERNAL_NAME;
sid.cx = sid.cy = 16;
- sid.ptszDescription = description;
+ sid.pszDescription = description;
sid.pszName = name;
- sid.hDefaultIcon = icon;
+ sid.ptszDefaultFile = tszPath;
+ sid.iDefaultIndex = -idx;
return Skin_AddIcon( &sid);
}
diff --git a/plugins/Sessions/Src/Utils.h b/plugins/Sessions/Src/Utils.h index f73dad00ad..3e044a4d17 100644 --- a/plugins/Sessions/Src/Utils.h +++ b/plugins/Sessions/Src/Utils.h @@ -33,7 +33,7 @@ int CheckForDuplicate(DWORD contact_list[],DWORD lparam); BOOL ResaveSettings(char* szName,int iFirst,int iLimit,TCHAR* pszPrevSetting);
void OffsetWindow(HWND parent, HWND hwnd, int dx, int dy);
int LoadSessionToCombobox (HWND hdlg,BOOL mode,int iLimit,char* pszSetting,int iFirstNum);
-HANDLE AddIcon(HICON icon, char *name, TCHAR *description);
+HANDLE AddIcon(char *name, char *description, int idx);
int MarkUserDefSession(int ses_count,BYTE bCheck);
BYTE IsMarkedUserDefSession(int ses_count);
void SavePosition(HWND hWnd, char *wndName);
diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index 6d41e565c4..6fb39c5831 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -189,7 +189,7 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) else { sid.hDefaultIcon = NULL; sid.ptszDefaultFile = path; - sid.iDefaultIndex = - IDI_UNKNOWN_FLAG; + sid.iDefaultIndex = -IDI_UNKNOWN_FLAG; } // Oki, lets add to IcoLib, then diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index 1167763997..3fc13c09b9 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -151,8 +151,7 @@ static void Icon2button(TTBButton* but, HANDLE& hIcoLib, HICON& hIcon, bool bIsU if (!hIcoLib) {
char buf[256];
mir_snprintf(buf, SIZEOF(buf), "toptoolbar_%s%s", but->name, (bIsUp) ? (but->hIconDn ? "%s_up" : "%s") : "%s_dn");
- SKINICONDESC sid = {0};
- sid.cbSize = sizeof(sid);
+ SKINICONDESC sid = { sizeof(sid) };
sid.pszSection = "Toolbar";
sid.pszName = buf;
sid.pszDefaultFile = NULL;
diff --git a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp index bc1d41f08d..1e934a070a 100644 --- a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp +++ b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp @@ -75,16 +75,14 @@ INT_PTR ServiceInvert(WPARAM wParam, LPARAM lParam) int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- HANDLE hSwitchIcon = NULL, hTranslitIcon = NULL, hInvertIcon = NULL;
+ hService = CreateServiceFunction(MS_TS_SWITCHLAYOUT, ServiceSwitch);
+ hService2 = CreateServiceFunction(MS_TS_TRANSLITLAYOUT, ServiceTranslit);
+ hService3 = CreateServiceFunction(MS_TS_INVERTCASE, ServiceInvert);
HOTKEYDESC hkd = {0};
hkd.cbSize = sizeof(hkd);
hkd.dwFlags = HKD_TCHAR;
- hService = CreateServiceFunction(MS_TS_SWITCHLAYOUT, ServiceSwitch);
- hService2 = CreateServiceFunction(MS_TS_TRANSLITLAYOUT, ServiceTranslit);
- hService3 = CreateServiceFunction(MS_TS_INVERTCASE, ServiceInvert);
-
hkd.pszName = "TranslitSwitcher/ConvertAllOrSelected";
hkd.ptszDescription = _T("Convert All / Selected");
hkd.ptszSection = _T("TranslitSwitcher");
@@ -133,25 +131,28 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) hOnButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, OnButtonPressed);
if (ServiceExists(MS_BB_ADDBUTTON)) {
- SKINICONDESC sid = {0};
- sid.cbSize = sizeof(SKINICONDESC);
- sid.flags = SIDF_TCHAR;
+ TCHAR tszPath[MAX_PATH];
+ GetModuleFileName(hInst, tszPath, SIZEOF(tszPath));
+
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.flags = SIDF_ALL_TCHAR;
sid.ptszSection = _T("TabSRMM/TranslitSwitcher");
sid.cx = sid.cy = 16;
- sid.ptszDescription = _T("SwitchLayout and Send");
- sid.pszName = "SwitchLayout and Send";
- sid.hDefaultIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SWITCHSEND));
- hSwitchIcon = Skin_AddIcon(&sid);
+ sid.ptszDescription = _T("Switch Layout and Send");
+ sid.pszName = "Switch Layout and Send";
+ sid.ptszDefaultFile = tszPath;
+ sid.iDefaultIndex = -IDI_SWITCHSEND;
+ HANDLE hSwitchIcon = Skin_AddIcon(&sid);
sid.ptszDescription = _T("Translit and Send");
sid.pszName = "Translit and Send";
- sid.hDefaultIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_TRANSLITSEND));
- hTranslitIcon = Skin_AddIcon(&sid);
+ sid.iDefaultIndex = -IDI_TRANSLITSEND;
+ HANDLE hTranslitIcon = Skin_AddIcon(&sid);
sid.ptszDescription = _T("Invert Case and Send");
sid.pszName = "Invert Case and Send";
- sid.hDefaultIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_INVERTSEND));
- hInvertIcon = Skin_AddIcon(&sid);
+ sid.iDefaultIndex = -IDI_INVERTSEND;
+ HANDLE hInvertIcon = Skin_AddIcon(&sid);
BBButton bbd = {0};
bbd.cbSize = sizeof(BBButton);
diff --git a/plugins/TranslitSwitcher/src/TranslitSwitcher.h b/plugins/TranslitSwitcher/src/TranslitSwitcher.h index ea29c2c7bf..f8f99f0bb3 100644 --- a/plugins/TranslitSwitcher/src/TranslitSwitcher.h +++ b/plugins/TranslitSwitcher/src/TranslitSwitcher.h @@ -19,6 +19,8 @@ Boston, MA 02111-1307, USA. #define MIRANDA_VER 0x0A00
+#define _CRT_SECURE_NO_WARNINGS
+
#ifndef __TRANSLITSWIITCHER_H__
#define __TRANSLITSWIITCHER_H__
diff --git a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp index fe4ce708bb..f1b8232871 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp @@ -415,25 +415,25 @@ VOID InitIcons() phIconHandles = (HANDLE*)mir_alloc(nCountriesCount*sizeof(HANDLE));
if (phIconHandles != NULL) {
char szId[20];
- SKINICONDESC skid = { sizeof(skid) };
- skid.ptszSection = LPGENT("Country Flags");
- skid.pszName = szId; // name to refer to icon when playing and in db
- skid.cx = GetSystemMetrics(SM_CXSMICON);
- skid.cy = GetSystemMetrics(SM_CYSMICON);
- skid.flags = SIDF_SORTED | SIDF_TCHAR;
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.ptszSection = LPGENT("Country Flags");
+ sid.pszName = szId; // name to refer to icon when playing and in db
+ sid.cx = GetSystemMetrics(SM_CXSMICON);
+ sid.cy = GetSystemMetrics(SM_CYSMICON);
+ sid.flags = SIDF_SORTED | SIDF_TCHAR;
for (int i=0; i < nCountriesCount; i++) {
- skid.ptszDescription = mir_a2t(LPGEN(countries[i].szName));
+ sid.ptszDescription = mir_a2t(LPGEN(countries[i].szName));
/* create identifier */
wsprintfA(szId,(countries[i].id==0xFFFF)?"%s0x%X":"%s%i","flags_",countries[i].id); /* buffer safe */
int index = CountryNumberToBitmapIndex(countries[i].id);
/* create icon */
- skid.hDefaultIcon=ImageList_ExtractIcon(NULL, himl, index);
+ sid.hDefaultIcon = ImageList_ExtractIcon(NULL, himl, index);
index = CountryNumberToIndex(countries[i].id);
- phIconHandles[index] = Skin_AddIcon(&skid);
- if(skid.hDefaultIcon!=NULL) DestroyIcon(skid.hDefaultIcon);
- mir_free(skid.ptszDescription); skid.ptszDescription = NULL;
+ phIconHandles[index] = Skin_AddIcon(&sid);
+ if(sid.hDefaultIcon!=NULL) DestroyIcon(sid.hDefaultIcon);
+ mir_free(sid.ptszDescription); sid.ptszDescription = NULL;
}
}
ImageList_Destroy(himl);
diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp index c9da4f453d..47d161e573 100644 --- a/plugins/UserInfoEx/src/classPsTreeItem.cpp +++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp @@ -361,12 +361,8 @@ INT CPsTreeItem::Icon(HIMAGELIST hIml, OPTIONSDIALOGPAGE *odp, BOOLEAN bInitIcon LPCSTR pszIconName = IconKey();
// use icolib to handle icons
- if (!(hIcon = IcoLib_GetIcon(pszIconName)))
- {
- SKINICONDESC sid;
-
- ZeroMemory(&sid, sizeof(sid));
- sid.cbSize = sizeof(sid);
+ if (!(hIcon = IcoLib_GetIcon(pszIconName))) {
+ SKINICONDESC sid = { sizeof(sid) };
sid.flags = SIDF_ALL_TCHAR;
sid.cx = GetSystemMetrics(SM_CXSMICON);
sid.cy = GetSystemMetrics(SM_CYSMICON);
@@ -402,7 +398,8 @@ INT CPsTreeItem::Icon(HIMAGELIST hIml, OPTIONSDIALOGPAGE *odp, BOOLEAN bInitIcon else {
sid.iDefaultIndex = -1;
sid.hDefaultIcon = ProtoIcon();
- if (!sid.hDefaultIcon) sid.hDefaultIcon = ImageList_GetIcon(hIml, 0, ILD_NORMAL);
+ if (!sid.hDefaultIcon)
+ sid.hDefaultIcon = ImageList_GetIcon(hIml, 0, ILD_NORMAL);
}
// add file to icolib
Skin_AddIcon(&sid);
diff --git a/plugins/UserInfoEx/src/mir_icolib.cpp b/plugins/UserInfoEx/src/mir_icolib.cpp index ef5d22e487..adfa3e5149 100644 --- a/plugins/UserInfoEx/src/mir_icolib.cpp +++ b/plugins/UserInfoEx/src/mir_icolib.cpp @@ -380,19 +380,14 @@ HICON IcoLib_RegisterIcon(LPSTR szIconID, LPSTR szDescription, LPSTR szSection, **/
VOID IcoLib_LoadModule()
{
- LPTSTR szDefaultFile;
- INT_PTR i;
-
- // search for default icon file
- szDefaultFile = IcoLib_GetDefaultIconFileName();
-
+ LPTSTR szDefaultFile = IcoLib_GetDefaultIconFileName();
IcoLib_CheckIconPackVersion(szDefaultFile);
// load default icon if required
ghDefIcon = (HICON)LoadImage(ghInst, MAKEINTRESOURCE(IDI_DEFAULT), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
- for (i = 0; i < SIZEOF(icoDesc); i++) {
+ for (int i = 0; i < SIZEOF(icoDesc); i++) {
IcoLib_RegisterIconHandleEx(
icoDesc[i].pszName, icoDesc[i].pszDesc, icoDesc[i].pszSection,
szDefaultFile, icoDesc[i].idResource, icoDesc[i].size, ghDefIcon);
diff --git a/plugins/UserInfoEx/src/mir_icolib.h b/plugins/UserInfoEx/src/mir_icolib.h index d5ac62e9fa..e1743b18b1 100644 --- a/plugins/UserInfoEx/src/mir_icolib.h +++ b/plugins/UserInfoEx/src/mir_icolib.h @@ -138,7 +138,7 @@ typedef struct TIconCtrl LPTSTR IcoLib_GetDefaultIconFileName();
VOID IcoLib_SetCtrlIcons(HWND hDlg, const ICONCTRL* pCtrl, BYTE numCtrls);
-HANDLE IcoLib_RegisterIconHandle(LPSTR szName, LPSTR szDescription, LPSTR szSection, INT idIcon, INT Size);
+HANDLE IcoLib_RegisterIconHandle(LPSTR szName, LPSTR szDescription, LPSTR szSection, INT idIcon, INT Size);
HICON IcoLib_RegisterIcon(LPSTR szName, LPSTR szDescription, LPSTR szSection, INT idIcon, INT Size);
HICON IcoLib_GetIcon(LPCSTR pszIcon);
HICON IcoLib_GetIconByHandle(HANDLE hIconItem);
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index 2df794d300..3abf457b1b 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -347,7 +347,6 @@ static HICON LoadTransportIcon(char *filename,int i,char *IconName,TCHAR *SectNa {
char szPath[MAX_PATH],szMyPath[MAX_PATH], szFullPath[MAX_PATH],*str;
BOOL has_proto_icon=FALSE;
- SKINICONDESC sid={0};
if (needFree) *needFree=FALSE;
GetModuleFileNameA(NULL, szPath, MAX_PATH);
str=strrchr(szPath,'\\');
@@ -359,8 +358,8 @@ static HICON LoadTransportIcon(char *filename,int i,char *IconName,TCHAR *SectNa if (hi) has_proto_icon=TRUE;
if (hi && nf) DestroyIcon(hi);
if (IconName != NULL && SectName != NULL) {
- sid.cbSize = sizeof(sid);
- sid.hDefaultIcon = (has_proto_icon)?NULL:(HICON)CallService(MS_SKIN_LOADPROTOICON,0,(LPARAM)(-internalidx));
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.hDefaultIcon = (has_proto_icon) ? NULL : LoadSkinnedProtoIcon(0, -internalidx);
sid.ptszSection = SectName;
sid.pszName = IconName;
sid.ptszDescription = Description;
@@ -384,7 +383,6 @@ static HICON LoadSmallIcon(HINSTANCE hInstance, LPCTSTR lpIconName) int CJabberProto::LoadAdvancedIcons(int iID)
{
- int i;
char *proto = TransportProtoTable[iID].proto;
char defFile[MAX_PATH] = {0};
TCHAR Group[255];
@@ -398,7 +396,7 @@ int CJabberProto::LoadAdvancedIcons(int iID) hAdvancedStatusIcon=(HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST,0,0);
EnterCriticalSection(&m_csModeMsgMutex);
- for (i=0; i<ID_STATUS_ONTHEPHONE-ID_STATUS_OFFLINE; i++) {
+ for (int i=0; i < ID_STATUS_ONTHEPHONE-ID_STATUS_OFFLINE; i++) {
HICON hicon;
BOOL needFree;
int n=skinStatusToJabberStatus[i];
diff --git a/protocols/MRA/res/resource.rc b/protocols/MRA/res/resource.rc index ccc0d19ec0..3fcb6713ec 100644 --- a/protocols/MRA/res/resource.rc +++ b/protocols/MRA/res/resource.rc @@ -31,6 +31,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDI_MRA ICON "Magent.ico"
IDI_INBOX ICON "Mail.ico"
IDI_PROFILE ICON "Info.ico"
+IDI_DELETED ICON "Deleted.ico"
IDI_AUTHRUGUEST ICON "AuthReguest.ico"
IDI_AUTHGRANT ICON "AuthGrant.ico"
IDI_MAIL_NOTIFY ICON "MailNotify.ico"
diff --git a/protocols/MRA/src/MraIcons.cpp b/protocols/MRA/src/MraIcons.cpp index be4790745f..a7bf1d446b 100644 --- a/protocols/MRA/src/MraIcons.cpp +++ b/protocols/MRA/src/MraIcons.cpp @@ -38,7 +38,7 @@ GUI_DISPLAY_ITEM gdiContactMenuItems[] = GUI_DISPLAY_ITEM gdiExtraStatusIconsItems[] =
{
- { ADV_ICON_DELETED_ID, ADV_ICON_DELETED_STR, (INT_PTR)IDI_ERROR, NULL },
+ { ADV_ICON_DELETED_ID, ADV_ICON_DELETED_STR, IDI_DELETED, NULL },
{ ADV_ICON_NOT_ON_SERVER_ID, ADV_ICON_NOT_ON_SERVER_STR, IDI_AUTHGRANT, NULL },
{ ADV_ICON_NOT_AUTHORIZED_ID, ADV_ICON_NOT_AUTHORIZED_STR, IDI_AUTHRUGUEST, NULL },
{ ADV_ICON_PHONE_ID, ADV_ICON_PHONE_STR, IDI_MRA_PHONE, NULL },
@@ -47,30 +47,28 @@ GUI_DISPLAY_ITEM gdiExtraStatusIconsItems[] = //////////////////////////////////////////////////////////////////////////////////////
-static void AddIcoLibItems(LPWSTR lpwszSubSectionName, GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount)
+static void AddIcoLibItems(LPWSTR lptszSubSectionName, GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount)
{
- char szBuff[MAX_PATH];
- WCHAR wszSection[MAX_PATH], wszPath[MAX_FILEPATH];
+ TCHAR tszSection[MAX_PATH], tszPath[MAX_FILEPATH];
+ GetModuleFileName(masMraSettings.hInstance, tszPath, SIZEOF(tszPath));
+ mir_sntprintf(tszSection, SIZEOF(tszSection), L"Protocols/MRA/%s", lptszSubSectionName);
- SKINICONDESC sid = {0};
- sid.cbSize = sizeof(sid);
- sid.pwszSection = wszSection;
- sid.pwszDefaultFile = wszPath;
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.ptszSection = tszSection;
+ sid.ptszDefaultFile = tszPath;
sid.cx = sid.cy = 16;
sid.flags = SIDF_ALL_UNICODE;
- if (lpwszSubSectionName == NULL) lpwszSubSectionName = L"";
- GetModuleFileName(masMraSettings.hInstance, wszPath, SIZEOF(wszPath));
- mir_sntprintf(wszSection, SIZEOF(wszSection), L"Protocols/MRA/%s", lpwszSubSectionName);
+ if (lptszSubSectionName == NULL)
+ lptszSubSectionName = _T("");
for (size_t i = 0;i<dwCount;i++) {
+ char szBuff[MAX_PATH];
mir_snprintf(szBuff, SIZEOF(szBuff), "MRA_%s", pgdiItems[i].lpszName);
+
sid.pszName = szBuff;
sid.pwszDescription = pgdiItems[i].lpwszDescr;
sid.iDefaultIndex = -pgdiItems[i].defIcon;
- sid.hDefaultIcon = (HICON)LoadImage(masMraSettings.hInstance, MAKEINTRESOURCE(pgdiItems[i].defIcon), IMAGE_ICON, 0, 0, LR_SHARED);
- if (sid.hDefaultIcon == NULL)
- sid.hDefaultIcon = (HICON)LoadImage(NULL, MAKEINTRESOURCE(pgdiItems[i].defIcon), IMAGE_ICON, 0, 0, LR_SHARED);
pgdiItems[i].hIconHandle = Skin_AddIcon(&sid);
}
}
@@ -125,10 +123,6 @@ void InitXStatusIcons() int iCurIndex = i+IDI_XSTATUS1-1;
sid.pwszDescription = lpcszXStatusNameDef[i];
sid.iDefaultIndex = -iCurIndex;
- if (masMraSettings.hDLLXStatusIcons)
- sid.hDefaultIcon = (HICON)LoadImage(masMraSettings.hDLLXStatusIcons, MAKEINTRESOURCE(iCurIndex), IMAGE_ICON, 0, 0, LR_SHARED);
- else
- sid.hDefaultIcon = NULL;
hXStatusAdvancedStatusIcons[i] = Skin_AddIcon(&sid);
}
diff --git a/protocols/MRA/src/resource.h b/protocols/MRA/src/resource.h index da661ea9be..103ca8e88b 100644 --- a/protocols/MRA/src/resource.h +++ b/protocols/MRA/src/resource.h @@ -19,6 +19,7 @@ #define IDI_MRA_POSTCARD 114
#define IDI_MRA_ZHUKI 115
#define IDI_MRA_PHOTO 117
+#define IDI_DELETED 118
#define IDI_MRA_CHAT 120
#define IDI_MRA_PHONE 122
#define IDD_OPT_FILES 126
|