diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-03 17:32:37 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-03 17:32:37 +0000 |
commit | 31b191bc8ddb639e488ab8306f71ac1dbabf16f0 (patch) | |
tree | aa661023372aa18381e46c7f6fcecf67856ac8ae /plugins | |
parent | 6ba829af4e0c008865675b67b868f33d8e7641df (diff) |
removing built-in Clist Modern extra icons part I
git-svn-id: http://svn.miranda-ng.org/main/trunk@2167 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
34 files changed, 494 insertions, 2042 deletions
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index be864b115f..044808c013 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -561,20 +561,18 @@ int SettingChanged(WPARAM wParam, LPARAM lParam) return 0;
if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 1)
- return 0;
+ return 0;
char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (proto == 0 || (DBGetContactSettingByte(hContact, proto, "ChatRoom", 0) == 1)
- || !(CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
+ || !(CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
return 0;
int currentStatus = inf->value.wVal;
int prevStatus = DBGetContactSettingWord(hContact, "UserOnline", "OldStatus", ID_STATUS_OFFLINE);
if (currentStatus == prevStatus)
- {
- return 0;
- }
+ return 0;
// Last status
DBWriteContactSettingDword(hContact, MODULE_NAME, "LastStatus", prevStatus);
@@ -610,19 +608,11 @@ int SettingChanged(WPARAM wParam, LPARAM lParam) }
}
- if (currentStatus == ID_STATUS_OFFLINE)
- {
- setLastSeen(hContact);
- return 0;
- }
-
- /*
- if (CallService(MS_IGNORE_ISIGNORED, (WPARAM) hContact, (LPARAM) IGNOREEVENT_USERONLINE))
+ if (currentStatus == ID_STATUS_OFFLINE)
{
setLastSeen(hContact);
- return 0;
+ return 0;
}
- */
if (DBGetContactSettingDword(hContact, MODULE_NAME, "LastSeen", (DWORD)-1) == (DWORD)-1 && options.notifyFirstOnline)
{
@@ -632,35 +622,33 @@ int SettingChanged(WPARAM wParam, LPARAM lParam) }
unsigned int AbsencePeriod = DBGetContactSettingDword(hContact, MODULE_NAME, "iAbsencePeriod", options.iAbsencePeriod);
- if (isContactGoneFor(hContact, AbsencePeriod))
+ if (isContactGoneFor(hContact, AbsencePeriod))
{
- TCHAR* message = TranslateT("has returned after a long absence.");
- time_t tmpTime;
+ TCHAR* message = TranslateT("has returned after a long absence.");
+ time_t tmpTime;
TCHAR tmpBuf[251] = {0};
- tmpTime = getLastSeen(hContact);
- if (tmpTime != -1)
+ tmpTime = getLastSeen(hContact);
+ if (tmpTime != -1)
{
- _tcsftime(tmpBuf, 250, TranslateT("has returned after being absent since %#x"), gmtime(&tmpTime));
- message = tmpBuf;
- }
+ _tcsftime(tmpBuf, 250, TranslateT("has returned after being absent since %#x"), gmtime(&tmpTime));
+ message = tmpBuf;
+ }
else
{
- tmpTime = getLastInputMsg(hContact);
- if (tmpTime != -1)
+ tmpTime = getLastInputMsg(hContact);
+ if (tmpTime != -1)
{
- _tcsftime(tmpBuf, 250, TranslateT("has returned after being absent since %#x"), gmtime(&tmpTime));
- message = tmpBuf;
- }
- }
+ _tcsftime(tmpBuf, 250, TranslateT("has returned after being absent since %#x"), gmtime(&tmpTime));
+ message = tmpBuf;
+ }
+ }
ReturnNotify(hContact, message);
- if ((options.iShowMessageWindow == 0 && options.iShowUDetails == 0) || (options.iShowEvent == 0 && options.iShowPopUp == 0))
- {
+ if ((options.iShowMessageWindow == 0 && options.iShowUDetails == 0) || (options.iShowEvent == 0 && options.iShowPopUp == 0))
setLastSeen(hContact);
- }
- } else
- setLastSeen(hContact);
+ }
+ else setLastSeen(hContact);
return 0;
}
diff --git a/plugins/IgnoreState/src/commonheaders.h b/plugins/IgnoreState/src/commonheaders.h index e21e302b69..b7e495d570 100644 --- a/plugins/IgnoreState/src/commonheaders.h +++ b/plugins/IgnoreState/src/commonheaders.h @@ -58,57 +58,34 @@ #include "Version.h"
//external SDK headers
-#include <m_cluiframes.h>
#include <m_extraicons.h>
-static const int DefaultSlot = EXTRA_ICON_PROTO;
#define MODULENAME "IgnoreState"
/* 3f6acec5-df0e-4d33-a272-e3630addb6c8 */
#define MIID_IGNORESRATE {0x3f6acec5, 0xdf0e, 0x4d33, {0xa2, 0x72, 0xe3, 0x63, 0x0a, 0xdd, 0xb6, 0xc8}}
-static struct
+struct IGNOREITEMS
{
- TCHAR* szDescr;
- char* szName;
- int defIconID;
- HANDLE hIconLibItem;
-} iconList[] =
-{
- { LPGENT( "Full Ignore" ), "ignore_full", IDI_IFULL },
- { LPGENT( "Partial Ignore" ), "ignore_part", IDI_IPART },
- { LPGENT( "Message Ignore" ), "ignore_mess", IDI_IMESS },
-};
-
-typedef struct {
TCHAR* name;
int type;
int icon;
bool filtered;
-} IGNOREITEMS;
-
-static IGNOREITEMS ii[] = {
- { LPGENT("All"), IGNOREEVENT_ALL, SKINICON_OTHER_FILLEDBLOB },
- { LPGENT("Messages"), IGNOREEVENT_MESSAGE, SKINICON_EVENT_MESSAGE },
- { LPGENT("URL"), IGNOREEVENT_URL, SKINICON_EVENT_URL },
- { LPGENT("Files"), IGNOREEVENT_FILE, SKINICON_EVENT_FILE },
- { LPGENT("User Online"), IGNOREEVENT_USERONLINE, SKINICON_OTHER_USERONLINE },
- { LPGENT("Authorization"), IGNOREEVENT_AUTHORIZATION, SKINICON_OTHER_MIRANDA },
- { LPGENT("You Were Added"), IGNOREEVENT_YOUWEREADDED, SKINICON_OTHER_ADDCONTACT },
- { LPGENT("Typing Notify"), IGNOREEVENT_TYPINGNOTIFY, SKINICON_OTHER_TYPING }
};
-static int isExtraiconsUsed = 0;
+extern IGNOREITEMS ii[];
+extern int nII;
+
static byte bUseMirandaSettings;
extern HINSTANCE g_hInst;
-extern int onExtraImageApplying(WPARAM wParam, LPARAM lParam);
-extern int onExtraImageListRebuild(WPARAM wParam, LPARAM lParam);
-extern int onOptInitialise(WPARAM wParam, LPARAM lParam);
-extern BOOL checkState(int type);
-extern VOID fill_filter();
+
+void applyExtraImage(HANDLE hContact);
+
+int onOptInitialise(WPARAM wParam, LPARAM lParam);
+BOOL checkState(int type);
+VOID fill_filter();
+
extern HANDLE hExtraIcon;
-extern IconExtraColumn g_IECAuth, g_IECGrant, g_IECAuthGrant, g_IECClear;
-extern INT clistIcon;
#endif //COMMHEADERS_H
diff --git a/plugins/IgnoreState/src/main.cpp b/plugins/IgnoreState/src/main.cpp index 9249c85ca8..886219e20f 100644 --- a/plugins/IgnoreState/src/main.cpp +++ b/plugins/IgnoreState/src/main.cpp @@ -22,27 +22,30 @@ HINSTANCE g_hInst;
-HANDLE hHookModulesLoaded = NULL, hSystemOKToExit = NULL, hOptInitialise = NULL, hIcoLibIconsChanged = NULL;
+HANDLE hIcoLibIconsChanged = NULL;
HANDLE hHookExtraIconsRebuild = NULL, hHookExtraIconsApply = NULL, hContactSettingChanged = NULL;
HANDLE hPrebuildContactMenu = NULL;
HANDLE hExtraIcon = NULL;
int hLangpack;
INT currentFilter = 0;
-//static int bUseMirandaSettings = 0;
-
-IconExtraColumn g_IECIgnoreFull = {0};
-IconExtraColumn g_IECIgnorePart = {0};
-IconExtraColumn g_IECIgnoreMess = {0};
-IconExtraColumn g_IECClear = {0};
+INT clistIcon = 0; //Icon slot to use
+IGNOREITEMS ii[] = {
+ { LPGENT("All"), IGNOREEVENT_ALL, SKINICON_OTHER_FILLEDBLOB },
+ { LPGENT("Messages"), IGNOREEVENT_MESSAGE, SKINICON_EVENT_MESSAGE },
+ { LPGENT("URL"), IGNOREEVENT_URL, SKINICON_EVENT_URL },
+ { LPGENT("Files"), IGNOREEVENT_FILE, SKINICON_EVENT_FILE },
+ { LPGENT("User Online"), IGNOREEVENT_USERONLINE, SKINICON_OTHER_USERONLINE },
+ { LPGENT("Authorization"), IGNOREEVENT_AUTHORIZATION, SKINICON_OTHER_MIRANDA },
+ { LPGENT("You Were Added"), IGNOREEVENT_YOUWEREADDED, SKINICON_OTHER_ADDCONTACT },
+ { LPGENT("Typing Notify"), IGNOREEVENT_TYPINGNOTIFY, SKINICON_OTHER_TYPING }
+};
+int nII = SIZEOF(ii);
-INT clistIcon = 0; //Icon slot to use
-//DWORD dMask = IGNOREEVENT_USERONLINE; // by default hide online notification
-
-//DWORD dIgnore = 0x0;
+/////////////////////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
@@ -64,7 +67,6 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvRese return TRUE;
}
-// плагининфо
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
return &pluginInfo;
@@ -72,126 +74,67 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_IGNORESRATE, MIID_LAST};
-int onSystemOKToExit(WPARAM wParam,LPARAM lParam)
-{
- UnhookEvent(hHookModulesLoaded);
- UnhookEvent(hHookExtraIconsRebuild);
- UnhookEvent(hHookExtraIconsApply);
- UnhookEvent(hOptInitialise);
- UnhookEvent(hSystemOKToExit);
- if (hIcoLibIconsChanged) UnhookEvent(hIcoLibIconsChanged);
- if (hContactSettingChanged)
- UnhookEvent(hContactSettingChanged);
-
- return 0;
-}
-
+/////////////////////////////////////////////////////////////////////////////////////////
inline BOOL checkState(int type)
{
return ((currentFilter>>(type-1))&1);
}
-
INT_PTR isIgnored(HANDLE hContact, int type)
{
- int i = 0, all = 0, filtered = 0;
+ int all = 0, filtered = 0;
- if (type == IGNOREEVENT_ALL)
- {
- int cii = SIZEOF(ii);
- for (i = 1; i < cii; i++)
- {
- if (isIgnored(hContact, ii[i].type))
- {
-// checkState(ii[i].type) ? filtered++ : all++;
- ii[i].filtered ? filtered++ : all++;
- }
- }
- return (all+filtered == cii-1) ? 1 : (all > 0 ? -1 : 0) ;
- }
- else
+ if (type != IGNOREEVENT_ALL)
return CallService(MS_IGNORE_ISIGNORED, (WPARAM)hContact, (LPARAM)type);
+
+ for (int i = 1; i < nII; i++)
+ if (isIgnored(hContact, ii[i].type))
+ ii[i].filtered ? filtered++ : all++;
+
+ return (all+filtered == SIZEOF(ii)-1) ? 1 : (all > 0 ? -1 : 0) ;
}
-int onExtraImageApplying(WPARAM wParam, LPARAM lParam)
+void applyExtraImage(HANDLE hContact)
{
- HANDLE hContact = (HANDLE)wParam;
int ignore = isIgnored(hContact, IGNOREEVENT_ALL);
- if (hExtraIcon != NULL)
- {
- if (ignore == 1)
- {
+ if (ignore == 1)
ExtraIcon_SetIcon(hExtraIcon, hContact, "ignore_full");
- }
- else if (ignore == 0)
- {
+ else if (ignore == 0)
ExtraIcon_SetIcon(hExtraIcon, hContact, "");
- }
- else if (isIgnored((HANDLE)wParam, IGNOREEVENT_MESSAGE))
- {
+ else if (isIgnored(hContact, IGNOREEVENT_MESSAGE))
ExtraIcon_SetIcon(hExtraIcon, hContact, "ignore_mess");
- }
- else
- {
+ else
ExtraIcon_SetIcon(hExtraIcon, hContact, "ignore_part");
- }
- }
- else
- {
- if (ignore == 1)
- {
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) wParam, (LPARAM) &g_IECIgnoreFull);
- }
- else if (ignore == 0)
- {
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) wParam, (LPARAM) &g_IECClear);
- }
- else if (isIgnored((HANDLE)wParam, IGNOREEVENT_MESSAGE))
- {
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) wParam, (LPARAM) &g_IECIgnoreMess);
- }
- else
- {
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) wParam, (LPARAM) &g_IECIgnorePart);
- }
- }
- return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
-int onExtraImageListRebuild(WPARAM wParam, LPARAM lParam)
+static struct
{
- g_IECIgnoreMess.cbSize = sizeof(IconExtraColumn);
- g_IECIgnoreMess.ColumnType = clistIcon;
- g_IECIgnorePart.cbSize = sizeof(IconExtraColumn);
- g_IECIgnorePart.ColumnType = clistIcon;
- g_IECIgnoreFull.cbSize = sizeof(IconExtraColumn);
- g_IECIgnoreFull.ColumnType = clistIcon;
-
- if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
- {
- g_IECIgnoreMess.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)Skin_GetIcon("ignore_mess"), 0);
- g_IECIgnorePart.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)Skin_GetIcon("ignore_part"), 0);
- g_IECIgnoreFull.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)Skin_GetIcon("ignore_full"), 0);
- }
- return 0;
+ TCHAR* szDescr;
+ char* szName;
+ int defIconID;
+ HANDLE hIconLibItem;
}
+iconList[] =
+{
+ { LPGENT( "Full Ignore" ), "ignore_full", IDI_IFULL },
+ { LPGENT( "Partial Ignore" ), "ignore_part", IDI_IPART },
+ { LPGENT( "Message Ignore" ), "ignore_mess", IDI_IMESS },
+};
static VOID init_icolib (void)
{
- SKINICONDESC sid = {0};
- ZeroMemory(&sid, sizeof(sid));
TCHAR tszFile[MAX_PATH];
- sid.cbSize = sizeof(sid);
- sid.flags = SIDF_ALL_TCHAR;
- int i = 0;
+ GetModuleFileName(g_hInst, tszFile, MAX_PATH);
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.flags = SIDF_ALL_TCHAR;
sid.ptszSection = _T(MODULENAME);
- GetModuleFileName(g_hInst, tszFile, MAX_PATH);
sid.ptszDefaultFile = tszFile;
- for ( i = 0; i < SIZEOF(iconList); i++ ) {
+ for (int i = 0; i < SIZEOF(iconList); i++) {
sid.pszName = iconList[i].szName;
sid.ptszDescription = iconList[i].szDescr;
sid.iDefaultIndex = -iconList[i].defIconID;
@@ -205,20 +148,17 @@ VOID fill_filter(void) currentFilter = bUseMirandaSettings ? DBGetContactSettingDword(NULL, "Ignore", "Default1", 0) : DBGetContactSettingDword(NULL, MODULENAME, "Filter", 0x8);
- int i = 0, cii = SIZEOF(ii);
-
- for (; i< cii; i++)
- {
- if (checkState((ii[i].type)))
- ii[i].filtered = true;
- else
- ii[i].filtered = false;
- }
+ for (int i=0; i < SIZEOF(ii); i++) {
+ if (checkState((ii[i].type)))
+ ii[i].filtered = true;
+ else
+ ii[i].filtered = false;
+ }
}
int onModulesLoaded(WPARAM wParam,LPARAM lParam)
{
- hOptInitialise = HookEvent(ME_OPT_INITIALISE, onOptInitialise);
+ HookEvent(ME_OPT_INITIALISE, onOptInitialise);
//IcoLib support
init_icolib();
@@ -226,59 +166,40 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) hExtraIcon = ExtraIcon_Register("ignore", "IgnoreState", "ignore_full");
- if (hExtraIcon != NULL)
- {
- // Set initial value for all contacts
- HANDLE hContact = db_find_first();
- while (hContact != NULL)
- {
- onExtraImageApplying((WPARAM)hContact, NULL);
- hContact = db_find_next(hContact);
- }
- }
- else
- {
- hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, onExtraImageListRebuild);
- hHookExtraIconsRebuild = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, onExtraImageListRebuild);
- hHookExtraIconsApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, onExtraImageApplying);
- onExtraImageListRebuild(0,0);
+ // Set initial value for all contacts
+ HANDLE hContact = db_find_first();
+ while (hContact != NULL) {
+ applyExtraImage(hContact);
+ hContact = db_find_next(hContact);
}
return 0;
}
-
int onContactSettingChanged(WPARAM wParam,LPARAM lParam)
{
- DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam;
- if (!lstrcmpA(cws->szModule,"Ignore") & !lstrcmpA(cws->szSetting,"Mask1")) {
- onExtraImageApplying(wParam, lParam);
- }
- if ((HANDLE)wParam ==0)
- if (!lstrcmpA(cws->szModule,MODULENAME) & !lstrcmpA(cws->szSetting,"Filter") ||
- bUseMirandaSettings && (!lstrcmpA(cws->szModule,"Ignore") & !lstrcmpA(cws->szSetting,"Default1"))
- ) {
+ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
+ HANDLE hContact = (HANDLE)wParam;
+
+ if ( !lstrcmpA(cws->szModule,"Ignore") && !lstrcmpA(cws->szSetting,"Mask1"))
+ applyExtraImage(hContact);
+ else if (hContact == 0) {
+ if (( !lstrcmpA(cws->szModule,MODULENAME) && !lstrcmpA(cws->szSetting,"Filter")) ||
+ (bUseMirandaSettings && !lstrcmpA(cws->szModule,"Ignore") && !lstrcmpA(cws->szSetting,"Default1")))
+ {
fill_filter();
}
+ }
return 0;
}
extern "C" int __declspec(dllexport) Load(void)
{
-
mir_getLP(&pluginInfo);
- hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
- hSystemOKToExit = HookEvent(ME_SYSTEM_OKTOEXIT,onSystemOKToExit);
- hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
-
- clistIcon = DBGetContactSettingByte(NULL, MODULENAME, "AdvancedIcon", DefaultSlot);
-
- g_IECClear.cbSize = sizeof(IconExtraColumn);
- g_IECClear.ColumnType = clistIcon;
- g_IECClear.hImage = (HANDLE) -1;
-
+ HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
return 0;
}
diff --git a/plugins/IgnoreState/src/options.cpp b/plugins/IgnoreState/src/options.cpp index ba1f01488e..cdd27fb3be 100644 --- a/plugins/IgnoreState/src/options.cpp +++ b/plugins/IgnoreState/src/options.cpp @@ -20,244 +20,93 @@ #include "commonheaders.h"
-//extern byte bUseAuthIcon, bUseGrantIcon, bContactMenuItem, bIconsForRecentContacts;
-
-//#define EXTRA_ICON_RES0 0 // only used by nicer
-//#define EXTRA_ICON_EMAIL 1
-//#define EXTRA_ICON_WEB 2
-//#define EXTRA_ICON_SMS 3
-//#define EXTRA_ICON_ADV1 4
-//#define EXTRA_ICON_ADV2 5
-//#define EXTRA_ICON_ADV3 6
-//#define EXTRA_ICON_CLIENT 7
-//#define EXTRA_ICON_ADV4 8
-//#define EXTRA_ICON_RES1 9 // only used by nicer
-//#define EXTRA_ICON_PROTO 9 // used by mwclist and modern
-//#define EXTRA_ICON_RES2 10 // only used by nicer
-//#define EXTRA_ICON_VISMODE 10 // only used by modern
-
#define MS_SKINENG_DRAWICONEXFIX "SkinEngine/DrawIconEx_Fix"
-enum {
- clist_none,
- clist_modern,
- clist_nicer
-};
-
-TCHAR* szAdvancedIconsModern[] = {
- _T("E-mail"),
- _T("Web page"),
- _T("Phone/SMS"),
- _T("Advanced #1"),
- _T("Advanced #2"),
- _T("Advanced #3"),
- _T("Client"),
- _T("Advanced #4"),
- _T("Protocol"),
- _T("Visibility/Chat activity")
-};
-//const int cAdvancedIconsModern = sizeof(szAdvancedIconsModern) / sizeof(szAdvancedIconsModern[0]);
-
-TCHAR* szAdvancedIconsNicer[] = {
- _T("Reserved"),
- _T("E-mail"),
- _T("Homepage"),
- _T("Telephone"),
- _T("Advanced #1"),
- _T("Advanced #2"),
- _T("Client"),
- _T("Advanced #3"),
- _T("Advanced #4"),
- _T("Reserved #1"),
- _T("Reserved #2")
- };
-//const int cAdvancedIconsNicer = sizeof(szAdvancedIconsNicer) / sizeof(szAdvancedIconsNicer[0]);
+static bool bInitializing;
INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- HIMAGELIST himlButtonIcons=NULL;
- INT bInitializing = 0;
- INT usedClist = clist_none;
- INT cAdvancedIcons;
- isExtraiconsUsed = ServiceExists(MS_EXTRAICON_REGISTER);
-// const char **szAdvancedIcons;
HWND hTree=GetDlgItem(hwndDlg,IDC_FILTER);
- switch (msg)
- {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
- bInitializing = 1;
+ bInitializing = true;
fill_filter();
- if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
- {
- if (hExtraIcon == NULL)
- {
- if (ServiceExists(MS_SKINENG_DRAWICONEXFIX))
- { // modern?
- cAdvancedIcons = SIZEOF(szAdvancedIconsModern);
- usedClist = clist_modern;
- }
- else
- {
- if (ServiceExists("CLN/About"))
- {
- usedClist = clist_nicer;
- cAdvancedIcons = SIZEOF(szAdvancedIconsNicer);
- }
- else
- {
- usedClist = clist_modern;
- cAdvancedIcons = SIZEOF(szAdvancedIconsModern) - 1; // mw doesn`t have last modern extraicon
- }
- }
- }
- else
- {
- SendDlgItemMessage(hwndDlg,IDC_NOTICE, WM_SETTEXT,0,(LPARAM)TranslateT("Extraicons plugin is used, use Contact list > Extraicons for customize."));
- ShowWindow(GetDlgItem(hwndDlg, IDC_NOTICE), SW_SHOW);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADVICON), 0);
- }
- }
- else
- {
- cAdvancedIcons = 0;
-// SendDlgItemMessage(hwndDlg,IDC_USED_CLIST, WM_SETTEXT,0,(LPARAM)_T("Your clist: classic"));
- SendDlgItemMessage(hwndDlg,IDC_NOTICE, WM_SETTEXT,0,(LPARAM)TranslateT("Warning: classic contact list plugin doesn`t have ability to use extraicons"));
- ShowWindow(GetDlgItem(hwndDlg, IDC_NOTICE), SW_SHOW);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADVICON), 0);
- }
- if (usedClist != clist_none) {
- for (int i = 0; i < cAdvancedIcons; i++)
- {
- SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_ADDSTRING, 0, (LPARAM) TranslateTS( usedClist==clist_modern ? szAdvancedIconsModern[i] : szAdvancedIconsNicer[i]));
- }
- if (usedClist == clist_modern )
- SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_SETCURSEL, clistIcon-1, 0);
- else
- SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_SETCURSEL, clistIcon, 0);
- }
+ SendDlgItemMessage(hwndDlg,IDC_NOTICE, WM_SETTEXT,0,(LPARAM)TranslateT("Extraicons plugin is used, use Contact list > Extraicons for customize."));
+ ShowWindow(GetDlgItem(hwndDlg, IDC_NOTICE), SW_SHOW);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADVICON), 0);
SetWindowLongPtr(hTree,GWL_STYLE,GetWindowLongPtr(hTree,GWL_STYLE)|TVS_NOHSCROLL);
- {
- himlButtonIcons=ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,2,2);
- TreeView_SetImageList(hTree,himlButtonIcons,TVSIL_NORMAL);
- }
+
+ HIMAGELIST himlButtonIcons = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,2,2);
+ TreeView_SetImageList(hTree,himlButtonIcons,TVSIL_NORMAL);
TreeView_DeleteAllItems(hTree);
- int i;
- int cii = SIZEOF(ii);
- for (i=2; i<cii; i++) // we don`t need it IGNORE_ALL and IGNORE_MESSAGE
- {
+ for (int i=2; i < nII; i++) { // we don`t need it IGNORE_ALL and IGNORE_MESSAGE
TVINSERTSTRUCT tvis={0};
- HTREEITEM hti;
- int index=ImageList_AddIcon(himlButtonIcons, LoadSkinnedIcon(ii[i].icon));
+ int index = ImageList_AddIcon(himlButtonIcons, LoadSkinnedIcon(ii[i].icon));
tvis.hParent=NULL;
tvis.hInsertAfter=TVI_LAST;
tvis.item.mask=TVIF_PARAM|TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_STATE;
tvis.item.lParam=(LPARAM)(ii[i].type);
tvis.item.pszText=TranslateTS(ii[i].name);
tvis.item.iImage=tvis.item.iSelectedImage=index;
- hti=TreeView_InsertItem(hTree,&tvis);
+ HTREEITEM hti = TreeView_InsertItem(hTree,&tvis);
TreeView_SetCheckState(hTree, hti, checkState(ii[i].type));
-// TreeView_SetCheckState(hTree, hti, (bool)(ii[i].filtered || ii[0].filtered));
}
CheckDlgButton(hwndDlg, IDC_IGNORE_IGNOREALL, bUseMirandaSettings );
EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER), !bUseMirandaSettings);
- bInitializing = 0;
- return TRUE;
+ bInitializing = false;
}
- case WM_COMMAND:
- {
- switch (LOWORD(wParam)) {
- case IDC_ADVICON:
- {
- if ((HIWORD(wParam) == EN_CHANGE) && (!bInitializing) || (HIWORD(wParam) == CBN_SELENDOK))
- {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
- }
- case IDC_IGNORE_IGNOREALL:
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER), !IsDlgButtonChecked(hwndDlg,IDC_IGNORE_IGNOREALL));
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- }
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_ADVICON:
+ if ((HIWORD(wParam) == EN_CHANGE) && (!bInitializing) || (HIWORD(wParam) == CBN_SELENDOK))
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
- }
- case WM_NOTIFY:
- {
- switch (((LPNMHDR)lParam)->idFrom)
- {
- case 0:
- {
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- if (usedClist==clist_none && hExtraIcon == NULL )
- return TRUE;
-///////////
- DWORD flags=0;
- TVITEM tvi;
- tvi.mask=TVIF_HANDLE|TBIF_LPARAM;
- HWND hTree=GetDlgItem(hwndDlg,IDC_FILTER);
- tvi.hItem=TreeView_GetRoot(hTree); //check ignore all
- while(tvi.hItem)
- {
- TreeView_GetItem(hTree,&tvi);
- if(TreeView_GetCheckState(hTree,tvi.hItem)) flags|=1<<(tvi.lParam-1);
- tvi.hItem=TreeView_GetNextSibling(hTree,tvi.hItem);
- }
- DBWriteContactSettingDword(NULL, MODULENAME, "Filter", flags);
- bUseMirandaSettings = IsDlgButtonChecked(hwndDlg,IDC_IGNORE_IGNOREALL) ? 1 : 0;
- DBWriteContactSettingByte(NULL, MODULENAME, "UseMirandaSettings", bUseMirandaSettings);
+ case IDC_IGNORE_IGNOREALL:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER), !IsDlgButtonChecked(hwndDlg,IDC_IGNORE_IGNOREALL));
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+ break;
- fill_filter();
-//////////
- if (hExtraIcon == NULL)
- {
- clistIcon = SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_GETCURSEL, 0, 0);
- if (usedClist == clist_modern )
- clistIcon++;
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ {
+ DWORD flags=0;
+ TVITEM tvi;
+ tvi.mask=TVIF_HANDLE|TBIF_LPARAM;
+ HWND hTree=GetDlgItem(hwndDlg,IDC_FILTER);
+ tvi.hItem=TreeView_GetRoot(hTree); //check ignore all
+ while(tvi.hItem) {
+ TreeView_GetItem(hTree,&tvi);
+ if(TreeView_GetCheckState(hTree,tvi.hItem)) flags|=1<<(tvi.lParam-1);
+ tvi.hItem=TreeView_GetNextSibling(hTree,tvi.hItem);
+ }
+ DBWriteContactSettingDword(NULL, MODULENAME, "Filter", flags);
- //Store options values to DB
- DBWriteContactSettingByte(NULL, MODULENAME, "AdvancedIcon", clistIcon);
+ bUseMirandaSettings = IsDlgButtonChecked(hwndDlg,IDC_IGNORE_IGNOREALL) ? 1 : 0;
+ DBWriteContactSettingByte(NULL, MODULENAME, "UseMirandaSettings", bUseMirandaSettings);
- HANDLE hContact = db_find_first();
- while (hContact)
- {
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&g_IECClear);
- hContact = db_find_next(hContact);
- }
- g_IECClear.ColumnType = clistIcon;
- if (hExtraIcon == NULL)
- onExtraImageListRebuild(0,0);
- hContact = db_find_first();
- while (hContact)
- {
- onExtraImageApplying((WPARAM)hContact,0);
- hContact = db_find_next(hContact);
- }
- }
- }
- }
- }
- case IDC_FILTER:
- if (((LPNMHDR)lParam)->code == NM_CLICK)
- {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ fill_filter();
}
}
- }
- case WM_DESTROY:
+ case IDC_FILTER:
+ if (((LPNMHDR)lParam)->code == NM_CLICK)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
+ }
}
return FALSE;
}
diff --git a/plugins/MetaContacts/src/meta_services.cpp b/plugins/MetaContacts/src/meta_services.cpp index 26609d23be..9379b39f8d 100644 --- a/plugins/MetaContacts/src/meta_services.cpp +++ b/plugins/MetaContacts/src/meta_services.cpp @@ -27,9 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "metacontacts.h"
-#define NB_SERVICES 62 //!< Number of services registered in Miranda (see Meta_CloseHandles()).
-#define NB_HOOKS 17 //!< Number of hooks set up (see Meta_CloseHandles()).
-
#define PREF_METANODB 0x2000 //!< Flag to indicate message should not be added to db by filter when sending
char *pendingACK = 0; //!< Name of the protocol in which an ACK is about to come.
@@ -37,12 +34,6 @@ char *pendingACK = 0; //!< Name of the protocol in which an ACK is about to com int previousMode, //!< Previous status of the MetaContacts Protocol
mcStatus; //!< Current status of the MetaContacts Protocol
-HANDLE hServices[NB_SERVICES] = {0}, //!< list of all the services registered (see Meta_CloseHandles()).
-hHooks[NB_HOOKS] = {0}; //!< list of all hooks set up (see Meta_CloseHandles()).
-
-HANDLE *hNudgeEvents = 0;
-int iNudgeProtos = 0;
-
HGENMENU
hMenuConvert, //!< \c HANDLE to the convert menu item.
hMenuAdd, //!< \c HANDLE to the add to menu item.
@@ -65,7 +56,6 @@ DWORD nextMetaID; //!< Global variable specifying the ID value the next MetaCont BOOL message_window_api_enabled = FALSE; //!< Global variable specifying whether the message window api ver 0.0.0.1+ is available
// stuff for mw_clist extra icon
-int proto_count = 0;
HANDLE hExtraImage[MAX_PROTOCOLS * 2]; // online and offline icons
char proto_names[MAX_PROTOCOLS * 128];
HANDLE hProtoIcons[MAX_PROTOCOLS * 2]; // online and offline icons
@@ -1167,7 +1157,6 @@ int NudgeRecieved(WPARAM wParam, LPARAM lParam) { */
int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- CLISTMENUITEM mi = {0};
char buffer[512], buffer2[512], buffer3[512];
int i;
@@ -1185,16 +1174,11 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) if (ServiceExists("DBEditorpp/RegisterSingleModule"))
CallService("DBEditorpp/RegisterSingleModule",(WPARAM)META_PROTO,0);
- hHooks[11] = (HANDLE)HookEvent(ME_CLIST_PREBUILDCONTACTMENU, Meta_ModifyMenu);
- hHooks[12] = (HANDLE)HookEvent(ME_CLIST_DOUBLECLICKED, Meta_ClistDoubleClicked );
- //hHooks[13] = (HANDLE)HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, Meta_CListMW_ExtraIconsRebuild);
- //hHooks[14] = (HANDLE)HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, Meta_CListMW_ExtraIconsApply);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, Meta_ModifyMenu);
+ HookEvent(ME_CLIST_DOUBLECLICKED, Meta_ClistDoubleClicked );
- // icons are erased on this event...
- // (BUT, the me_clist_extra_list_rebuild is send FIRST...so, we ignore this one...)
- hHooks[15] = 0;//(HANDLE)HookEvent(ME_SKIN_ICONSCHANGED, Meta_LoadIcons);
-
- mi.cbSize = sizeof(mi);
+ ////////////////////////////////////////////////////////////////////////////
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_ALL;
// main menu item
@@ -1284,8 +1268,7 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) }
// hook srmm window close/open events - message api ver 0.0.0.1+
- hHooks[16] = (HANDLE)HookEvent(ME_MSG_WINDOWEVENT, Meta_MessageWindowEvent);
- if (hHooks[16]) // message api available
+ if (HookEvent(ME_MSG_WINDOWEVENT, Meta_MessageWindowEvent))
message_window_api_enabled = TRUE;
// hook protocol nudge events to forward to subcontacts
@@ -1301,15 +1284,9 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) {
if (strcmp(ppProtocolDescriptors[i]->szModuleName, META_PROTO)) {
sprintf(str,"%s/Nudge",ppProtocolDescriptors[i]->szModuleName);
- hNudgeEvent = HookEvent(str, NudgeRecieved);
- if (hNudgeEvent != NULL) {
- ++iNudgeProtos;
- hNudgeEvents = (HANDLE *)realloc(hNudgeEvents, sizeof(HANDLE) * iNudgeProtos);
- hNudgeEvents[iNudgeProtos - 1] = hNudgeEvent;
- }
+ HookEvent(str, NudgeRecieved);
}
}
-
}
}
return 0;
@@ -1378,192 +1355,6 @@ INT_PTR Meta_ContactMenuFunc(WPARAM wParam, LPARAM lParam) { ////////////////////
// file transfer support - mostly not required, since subcontacts do the receiving
////////////////////
-/*
-INT_PTR Meta_FileResume(WPARAM wParam, LPARAM lParam)
-{
- DBVARIANT dbv;
- CCSDATA *ccs = (CCSDATA *) lParam;
- char *proto = 0;
-
- if (DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv))
- {
- // This is a simple contact
- // (this should normally not happen, since linked contacts do not appear on the list.)
- return 1;
- }
- else
- {
- HANDLE most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_FILERESUME);
- //DBEVENTINFO dbei;
- char szServiceName[100];
-
- DBFreeVariant(&dbv);
-
- if (!most_online)
- return 0;
-
- proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0);
-
- ccs->hContact = most_online;
- Meta_SetNick(proto);
-
- _snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PS_FILERESUME);
- if (ServiceExists(szServiceName)) {
- strncpy(szServiceName, PS_FILERESUME, sizeof(szServiceName));
- return (int)(CallContactService(ccs->hContact, szServiceName, ccs->wParam, ccs->lParam));
- }
- }
- return 1; // fail
-}
-
-INT_PTR Meta_FileAllow(WPARAM wParam, LPARAM lParam)
-{
- DBVARIANT dbv;
- CCSDATA *ccs = (CCSDATA *) lParam;
- char *proto = 0;
-
- if (DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv))
- {
- // This is a simple contact
- // (this should normally not happen, since linked contacts do not appear on the list.)
- return 0;
- }
- else
- {
- HANDLE most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_FILE);
- char szServiceName[100];
-
- DBFreeVariant(&dbv);
-
- if (!most_online)
- return 0;
-
- proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0);
-
- ccs->hContact = most_online;
- Meta_SetNick(proto);
-
- _snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PSS_FILEALLOW);
- if (ServiceExists(szServiceName)) {
- strncpy(szServiceName, PSS_FILEALLOW, sizeof(szServiceName));
- return (int)(CallContactService(ccs->hContact, szServiceName, ccs->wParam, ccs->lParam));
- }
- }
- return 0; // fail
-}
-
-INT_PTR Meta_FileDeny(WPARAM wParam, LPARAM lParam)
-{
- DBVARIANT dbv;
- CCSDATA *ccs = (CCSDATA *) lParam;
- char *proto = 0;
-
- if (DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv))
- {
- // This is a simple contact
- // (this should normally not happen, since linked contacts do not appear on the list.)
- return 1;
- }
- else
- {
- HANDLE most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_FILE);
- //DBEVENTINFO dbei;
- char szServiceName[100];
-
- DBFreeVariant(&dbv);
-
- if (!most_online)
- return 1;
-
- proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0);
-
- ccs->hContact = most_online;
- Meta_SetNick(proto);
-
- _snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PSS_FILEDENY);
- if (ServiceExists(szServiceName)) {
- strncpy(szServiceName, PSS_FILEDENY, sizeof(szServiceName));
- return (int)(CallContactService(ccs->hContact, szServiceName, ccs->wParam, ccs->lParam));
- }
- }
- return 1; // fail
-}
-
-INT_PTR Meta_FileRecv(WPARAM wParam, LPARAM lParam)
-{
- DBVARIANT dbv;
- CCSDATA *ccs = (CCSDATA *) lParam;
- char *proto = 0;
-
- if (DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv))
- {
- // This is a simple contact
- // (this should normally not happen, since linked contacts do not appear on the list.)
- return 0;
- }
- else
- {
- HANDLE most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_FILE);
- //DBEVENTINFO dbei;
- char szServiceName[100];
-
- DBFreeVariant(&dbv);
-
- if (!most_online)
- return 0;
-
- proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0);
-
- ccs->hContact = most_online;
- Meta_SetNick(proto);
-
- _snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PSR_FILE);
- if (ServiceExists(szServiceName)) {
- strncpy(szServiceName, PSR_FILE, sizeof(szServiceName));
- return (int)(CallContactService(ccs->hContact, szServiceName, ccs->wParam, ccs->lParam));
- }
- }
-
- return 0;
-}
-
-int Meta_FileCancel(WPARAM wParam, LPARAM lParam)
-{
- DBVARIANT dbv;
- CCSDATA *ccs = (CCSDATA *) lParam;
- char *proto = 0;
-
- if (DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv))
- {
- // This is a simple contact
- // (this should normally not happen, since linked contacts do not appear on the list.)
- return 0;
- }
- else
- {
- HANDLE most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_FILE);
- //DBEVENTINFO dbei;
- char szServiceName[100];
-
- DBFreeVariant(&dbv);
-
- if (!most_online)
- return 0;
-
- proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0);
-
- ccs->hContact = most_online;
- Meta_SetNick(proto);
-
- _snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PSS_FILECANCEL);
- if (ServiceExists(szServiceName)) {
- strncpy(szServiceName, PSS_FILECANCEL, sizeof(szServiceName));
- return (int)(CallContactService(ccs->hContact, szServiceName, ccs->wParam, ccs->lParam));
- }
- }
- return 0;
-}
-*/
INT_PTR Meta_FileSend(WPARAM wParam, LPARAM lParam)
{
@@ -1828,103 +1619,89 @@ int Meta_OnIdleChanged(WPARAM wParam, LPARAM lParam) { */
void Meta_InitServices()
{
- int i;
-
previousMode = mcStatus = ID_STATUS_OFFLINE;
- // set hooks pointers and services pointers to zero - in case we do not initialize them all correctly
- for (i=0;i<NB_HOOKS;i++)
- hHooks[i] = 0;
- for (i=0;i<NB_SERVICES;i++)
- hServices[i] = 0;
-
- hServices[0] = CreateServiceFunction("MetaContacts/Convert",Meta_Convert);
- hServices[1] = CreateServiceFunction("MetaContacts/AddTo",Meta_AddTo);
- hServices[2] = CreateServiceFunction("MetaContacts/Edit",Meta_Edit);
- hServices[3] = CreateServiceFunction("MetaContacts/Delete",Meta_Delete);
- hServices[4] = CreateServiceFunction("MetaContacts/Default",Meta_Default);
- hServices[5] = CreateServiceFunction("MetaContacts/ForceDefault",Meta_ForceDefault);
+ CreateServiceFunction("MetaContacts/Convert",Meta_Convert);
+ CreateServiceFunction("MetaContacts/AddTo",Meta_AddTo);
+ CreateServiceFunction("MetaContacts/Edit",Meta_Edit);
+ CreateServiceFunction("MetaContacts/Delete",Meta_Delete);
+ CreateServiceFunction("MetaContacts/Default",Meta_Default);
+ CreateServiceFunction("MetaContacts/ForceDefault",Meta_ForceDefault);
// hidden contact menu items...ho hum
- hServices[6 + 0] = CreateServiceFunction("MetaContacts/MenuFunc0",MenuFunc0);
- hServices[6 + 1] = CreateServiceFunction("MetaContacts/MenuFunc1",MenuFunc1);
- hServices[6 + 2] = CreateServiceFunction("MetaContacts/MenuFunc2",MenuFunc2);
- hServices[6 + 3] = CreateServiceFunction("MetaContacts/MenuFunc3",MenuFunc3);
- hServices[6 + 4] = CreateServiceFunction("MetaContacts/MenuFunc4",MenuFunc4);
- hServices[6 + 5] = CreateServiceFunction("MetaContacts/MenuFunc5",MenuFunc5);
- hServices[6 + 6] = CreateServiceFunction("MetaContacts/MenuFunc6",MenuFunc6);
- hServices[6 + 7] = CreateServiceFunction("MetaContacts/MenuFunc7",MenuFunc7);
- hServices[6 + 8] = CreateServiceFunction("MetaContacts/MenuFunc8",MenuFunc8);
- hServices[6 + 9] = CreateServiceFunction("MetaContacts/MenuFunc9",MenuFunc9);
- hServices[6 + 10] = CreateServiceFunction("MetaContacts/MenuFunc10",MenuFunc10);
- hServices[6 + 11] = CreateServiceFunction("MetaContacts/MenuFunc11",MenuFunc11);
- hServices[6 + 12] = CreateServiceFunction("MetaContacts/MenuFunc12",MenuFunc12);
- hServices[6 + 13] = CreateServiceFunction("MetaContacts/MenuFunc13",MenuFunc13);
- hServices[6 + 14] = CreateServiceFunction("MetaContacts/MenuFunc14",MenuFunc14);
- hServices[6 + 15] = CreateServiceFunction("MetaContacts/MenuFunc15",MenuFunc15);
- hServices[6 + 16] = CreateServiceFunction("MetaContacts/MenuFunc16",MenuFunc16);
- hServices[6 + 17] = CreateServiceFunction("MetaContacts/MenuFunc17",MenuFunc17);
- hServices[6 + 18] = CreateServiceFunction("MetaContacts/MenuFunc18",MenuFunc18);
- hServices[6 + 19] = CreateServiceFunction("MetaContacts/MenuFunc19",MenuFunc19);
-
- hServices[26] = CreateProtoServiceFunction(META_PROTO,PS_GETCAPS,Meta_GetCaps);
- hServices[27] = CreateProtoServiceFunction(META_PROTO,PS_GETNAME,Meta_GetName);
- hServices[28] = CreateProtoServiceFunction(META_PROTO,PS_LOADICON,Meta_LoadIcon);
-
- hServices[29] = CreateProtoServiceFunction(META_PROTO,PS_SETSTATUS,Meta_SetStatus);
-
- hServices[30] = CreateProtoServiceFunction(META_PROTO,PS_GETSTATUS,Meta_GetStatus);
- hServices[31] = CreateProtoServiceFunction(META_PROTO,PSS_MESSAGE,Meta_SendMessage);
- hServices[32] = CreateProtoServiceFunction(META_PROTO,PSS_MESSAGE"W",Meta_SendMessage); // unicode send (same send func as above line, checks for PREF_UNICODE)
-
- hServices[33] = CreateProtoServiceFunction(META_PROTO,PSS_USERISTYPING,Meta_UserIsTyping );
-
- hServices[34] = CreateProtoServiceFunction(META_PROTO,PSR_MESSAGE,Meta_RecvMessage);
+ CreateServiceFunction("MetaContacts/MenuFunc0",MenuFunc0);
+ CreateServiceFunction("MetaContacts/MenuFunc1",MenuFunc1);
+ CreateServiceFunction("MetaContacts/MenuFunc2",MenuFunc2);
+ CreateServiceFunction("MetaContacts/MenuFunc3",MenuFunc3);
+ CreateServiceFunction("MetaContacts/MenuFunc4",MenuFunc4);
+ CreateServiceFunction("MetaContacts/MenuFunc5",MenuFunc5);
+ CreateServiceFunction("MetaContacts/MenuFunc6",MenuFunc6);
+ CreateServiceFunction("MetaContacts/MenuFunc7",MenuFunc7);
+ CreateServiceFunction("MetaContacts/MenuFunc8",MenuFunc8);
+ CreateServiceFunction("MetaContacts/MenuFunc9",MenuFunc9);
+ CreateServiceFunction("MetaContacts/MenuFunc10",MenuFunc10);
+ CreateServiceFunction("MetaContacts/MenuFunc11",MenuFunc11);
+ CreateServiceFunction("MetaContacts/MenuFunc12",MenuFunc12);
+ CreateServiceFunction("MetaContacts/MenuFunc13",MenuFunc13);
+ CreateServiceFunction("MetaContacts/MenuFunc14",MenuFunc14);
+ CreateServiceFunction("MetaContacts/MenuFunc15",MenuFunc15);
+ CreateServiceFunction("MetaContacts/MenuFunc16",MenuFunc16);
+ CreateServiceFunction("MetaContacts/MenuFunc17",MenuFunc17);
+ CreateServiceFunction("MetaContacts/MenuFunc18",MenuFunc18);
+ CreateServiceFunction("MetaContacts/MenuFunc19",MenuFunc19);
+
+ CreateProtoServiceFunction(META_PROTO,PS_GETCAPS,Meta_GetCaps);
+ CreateProtoServiceFunction(META_PROTO,PS_GETNAME,Meta_GetName);
+ CreateProtoServiceFunction(META_PROTO,PS_LOADICON,Meta_LoadIcon);
+
+ CreateProtoServiceFunction(META_PROTO,PS_SETSTATUS,Meta_SetStatus);
+
+ CreateProtoServiceFunction(META_PROTO,PS_GETSTATUS,Meta_GetStatus);
+ CreateProtoServiceFunction(META_PROTO,PSS_MESSAGE,Meta_SendMessage);
+ CreateProtoServiceFunction(META_PROTO,PSS_MESSAGE"W",Meta_SendMessage); // unicode send (same send func as above line, checks for PREF_UNICODE)
+
+ CreateProtoServiceFunction(META_PROTO,PSS_USERISTYPING,Meta_UserIsTyping );
+
+ CreateProtoServiceFunction(META_PROTO,PSR_MESSAGE,Meta_RecvMessage);
// file recv is done by subcontacts
- //hServices[] = CreateProtoServiceFunction(META_PROTO,PS_FILERESUME,Meta_FileResume);
- //hServices[] = CreateProtoServiceFunction(META_PROTO,PSS_FILEALLOW,Meta_FileAllow);
- //hServices[] = CreateProtoServiceFunction(META_PROTO,PSS_FILEDENY,Meta_FileDeny);
- //hServices[] = CreateProtoServiceFunction(META_PROTO,PSS_FILECANCEL,Meta_FileCancel);
- //hServices[] = CreateProtoServiceFunction(META_PROTO,PSR_FILE,Meta_FileRecv);
- hServices[35] = CreateProtoServiceFunction(META_PROTO,PSS_FILE,Meta_FileSend);
+ CreateProtoServiceFunction(META_PROTO,PSS_FILE, Meta_FileSend);
- hServices[36] = CreateProtoServiceFunction(META_PROTO,PSS_GETAWAYMSG,Meta_GetAwayMsg);
+ CreateProtoServiceFunction(META_PROTO,PSS_GETAWAYMSG,Meta_GetAwayMsg);
- hServices[37] = CreateProtoServiceFunction(META_PROTO,PS_GETAVATARINFOT,Meta_GetAvatarInfo);
+ CreateProtoServiceFunction(META_PROTO,PS_GETAVATARINFOT,Meta_GetAvatarInfo);
- hServices[38] = CreateProtoServiceFunction(META_PROTO,PSS_GETINFO,Meta_GetInfo);
+ CreateProtoServiceFunction(META_PROTO,PSS_GETINFO,Meta_GetInfo);
- hServices[39] = CreateProtoServiceFunction(META_FILTER,PSR_MESSAGE,MetaFilter_RecvMessage);
- hServices[40] = CreateProtoServiceFunction(META_FILTER,PSS_MESSAGE,MetaFilter_SendMessage);
- hServices[41] = CreateProtoServiceFunction(META_FILTER,PSS_MESSAGE"W",MetaFilter_SendMessage);
+ CreateProtoServiceFunction(META_FILTER,PSR_MESSAGE,MetaFilter_RecvMessage);
+ CreateProtoServiceFunction(META_FILTER,PSS_MESSAGE,MetaFilter_SendMessage);
+ CreateProtoServiceFunction(META_FILTER,PSS_MESSAGE"W",MetaFilter_SendMessage);
// API services and events
-
- hServices[42] = CreateServiceFunction(MS_MC_GETMETACONTACT, MetaAPI_GetMeta);
- hServices[43] = CreateServiceFunction(MS_MC_GETDEFAULTCONTACT, MetaAPI_GetDefault);
- hServices[44] = CreateServiceFunction(MS_MC_GETDEFAULTCONTACTNUM, MetaAPI_GetDefaultNum);
- hServices[45] = CreateServiceFunction(MS_MC_GETMOSTONLINECONTACT, MetaAPI_GetMostOnline);
- hServices[46] = CreateServiceFunction(MS_MC_GETNUMCONTACTS, MetaAPI_GetNumContacts);
- hServices[47] = CreateServiceFunction(MS_MC_GETSUBCONTACT, MetaAPI_GetContact);
- hServices[48] = CreateServiceFunction(MS_MC_SETDEFAULTCONTACTNUM, MetaAPI_SetDefaultContactNum);
- hServices[49] = CreateServiceFunction(MS_MC_SETDEFAULTCONTACT, MetaAPI_SetDefaultContact);
- hServices[50] = CreateServiceFunction(MS_MC_FORCESENDCONTACTNUM, MetaAPI_ForceSendContactNum);
- hServices[51] = CreateServiceFunction(MS_MC_FORCESENDCONTACT, MetaAPI_ForceSendContact);
- hServices[52] = CreateServiceFunction(MS_MC_UNFORCESENDCONTACT, MetaAPI_UnforceSendContact);
- hServices[53] = CreateServiceFunction(MS_MC_GETPROTOCOLNAME, MetaAPI_GetProtoName);
- hServices[54] = CreateServiceFunction(MS_MC_GETFORCESTATE, MetaAPI_GetForceState);
-
- hServices[55] = CreateServiceFunction(MS_MC_CONVERTTOMETA, MetaAPI_ConvertToMeta);
- hServices[56] = CreateServiceFunction(MS_MC_ADDTOMETA, MetaAPI_AddToMeta);
- hServices[57] = CreateServiceFunction(MS_MC_REMOVEFROMMETA, MetaAPI_RemoveFromMeta);
-
- hServices[58] = CreateServiceFunction(MS_MC_DISABLEHIDDENGROUP, MetaAPI_DisableHiddenGroup);
-
- hServices[59] = CreateServiceFunction("MetaContacts/OnOff", Meta_OnOff);
- hServices[60] = CreateServiceFunction("MetaContacts/CListMessageEvent", Meta_ClistMessageEventClicked);
-
- hServices[61] = CreateProtoServiceFunction(META_PROTO, "/SendNudge", Meta_SendNudge);
+ CreateServiceFunction(MS_MC_GETMETACONTACT, MetaAPI_GetMeta);
+ CreateServiceFunction(MS_MC_GETDEFAULTCONTACT, MetaAPI_GetDefault);
+ CreateServiceFunction(MS_MC_GETDEFAULTCONTACTNUM, MetaAPI_GetDefaultNum);
+ CreateServiceFunction(MS_MC_GETMOSTONLINECONTACT, MetaAPI_GetMostOnline);
+ CreateServiceFunction(MS_MC_GETNUMCONTACTS, MetaAPI_GetNumContacts);
+ CreateServiceFunction(MS_MC_GETSUBCONTACT, MetaAPI_GetContact);
+ CreateServiceFunction(MS_MC_SETDEFAULTCONTACTNUM, MetaAPI_SetDefaultContactNum);
+ CreateServiceFunction(MS_MC_SETDEFAULTCONTACT, MetaAPI_SetDefaultContact);
+ CreateServiceFunction(MS_MC_FORCESENDCONTACTNUM, MetaAPI_ForceSendContactNum);
+ CreateServiceFunction(MS_MC_FORCESENDCONTACT, MetaAPI_ForceSendContact);
+ CreateServiceFunction(MS_MC_UNFORCESENDCONTACT, MetaAPI_UnforceSendContact);
+ CreateServiceFunction(MS_MC_GETPROTOCOLNAME, MetaAPI_GetProtoName);
+ CreateServiceFunction(MS_MC_GETFORCESTATE, MetaAPI_GetForceState);
+
+ CreateServiceFunction(MS_MC_CONVERTTOMETA, MetaAPI_ConvertToMeta);
+ CreateServiceFunction(MS_MC_ADDTOMETA, MetaAPI_AddToMeta);
+ CreateServiceFunction(MS_MC_REMOVEFROMMETA, MetaAPI_RemoveFromMeta);
+
+ CreateServiceFunction(MS_MC_DISABLEHIDDENGROUP, MetaAPI_DisableHiddenGroup);
+
+ CreateServiceFunction("MetaContacts/OnOff", Meta_OnOff);
+ CreateServiceFunction("MetaContacts/CListMessageEvent", Meta_ClistMessageEventClicked);
+
+ CreateProtoServiceFunction(META_PROTO, "/SendNudge", Meta_SendNudge);
// create our hookable events
hEventDefaultChanged = CreateHookableEvent(ME_MC_DEFAULTTCHANGED);
@@ -1933,24 +1710,20 @@ void Meta_InitServices() hSubcontactsChanged = CreateHookableEvent(ME_MC_SUBCONTACTSCHANGED);
// hook other module events we need
- hHooks[0] = (HANDLE)HookEvent(ME_PROTO_ACK, Meta_HandleACK);
- hHooks[1] = (HANDLE)HookEvent(ME_DB_CONTACT_SETTINGCHANGED, Meta_SettingChanged);
- hHooks[2] = (HANDLE)HookEvent(ME_SYSTEM_MODULESLOADED, Meta_ModulesLoaded);
- hHooks[3] = (HANDLE)HookEvent(ME_PROTO_CONTACTISTYPING, Meta_ContactIsTyping);
- hHooks[4] = (HANDLE)HookEvent(ME_DB_CONTACT_DELETED, Meta_ContactDeleted);
- hHooks[5] = (HANDLE)HookEvent(ME_OPT_INITIALISE, Meta_OptInit );
+ HookEvent(ME_PROTO_ACK, Meta_HandleACK);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, Meta_SettingChanged);
+ HookEvent(ME_SYSTEM_MODULESLOADED, Meta_ModulesLoaded);
+ HookEvent(ME_PROTO_CONTACTISTYPING, Meta_ContactIsTyping);
+ HookEvent(ME_DB_CONTACT_DELETED, Meta_ContactDeleted);
+ HookEvent(ME_OPT_INITIALISE, Meta_OptInit );
- hHooks[6] = (HANDLE)HookEvent(ME_SYSTEM_PRESHUTDOWN, Meta_PreShutdown);
- hHooks[7] = (HANDLE)HookEvent(ME_SYSTEM_OKTOEXIT, Meta_OkToExit);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, Meta_PreShutdown);
+ HookEvent(ME_SYSTEM_OKTOEXIT, Meta_OkToExit);
// hook our own events, used to call Meta_GetMostOnline which sets nick for metacontact
- hHooks[8] = (HANDLE)HookEvent(ME_MC_DEFAULTTCHANGED, Meta_CallMostOnline );
- hHooks[9] = (HANDLE)HookEvent(ME_MC_FORCESEND, Meta_CallMostOnline );
- hHooks[10] = (HANDLE)HookEvent(ME_MC_UNFORCESEND, Meta_CallMostOnline );
-
- /// more hooks in modules loaded event handler - for services that are not created
-
- //hHooks[] = (HANDLE)HookEvent(ME_IDLE_CHANGED, Meta_OnIdleChanged); // what can we do with idle?
+ HookEvent(ME_MC_DEFAULTTCHANGED, Meta_CallMostOnline );
+ HookEvent(ME_MC_FORCESEND, Meta_CallMostOnline );
+ HookEvent(ME_MC_UNFORCESEND, Meta_CallMostOnline );
// redirect nudge events
hEventNudge = CreateHookableEvent(META_PROTO "/Nudge");
@@ -1959,30 +1732,10 @@ void Meta_InitServices() //! Unregister all hooks and services from Miranda
void Meta_CloseHandles()
{
- int i;
-
- for (i=0;i<iNudgeProtos;i++) // Idem for the hooks.
- {
- UnhookEvent(hNudgeEvents[i]);
- }
- free(hNudgeEvents);
- iNudgeProtos = 0;
-
- for (i=0;i<NB_HOOKS;i++) // Idem for the hooks.
- if (hHooks[i]) UnhookEvent(hHooks[i]);
-
- if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) {
- proto_count = 0;
- }
-
// destroy our hookable events
DestroyHookableEvent(hEventDefaultChanged);
DestroyHookableEvent(hEventForceSend);
DestroyHookableEvent(hEventUnforceSend);
DestroyHookableEvent(hSubcontactsChanged);
DestroyHookableEvent(hEventNudge);
-
- // lets leave them, hey? (why?)
- for (i=0;i<NB_SERVICES;i++) // Scan each 'HANDLE' and Destroy the service attached to it.
- if (hServices[i]) DestroyServiceFunction(hServices[i]);
}
diff --git a/plugins/MetaContacts/src/metacontacts.h b/plugins/MetaContacts/src/metacontacts.h index b0c896c5f8..00eae31bda 100644 --- a/plugins/MetaContacts/src/metacontacts.h +++ b/plugins/MetaContacts/src/metacontacts.h @@ -237,7 +237,6 @@ extern POINT menuMousePoint; extern BOOL message_window_api_enabled;
#define MAX_PROTOCOLS 20
-extern int proto_count;
extern char proto_names[MAX_PROTOCOLS * 128];
// used for the 'jabber' hack - i.e. hide contacts instead of moving them to the hidden group
diff --git a/plugins/Rate/rate_10.vcxproj b/plugins/Rate/rate_10.vcxproj index 3308db2b17..2eef0a375a 100644 --- a/plugins/Rate/rate_10.vcxproj +++ b/plugins/Rate/rate_10.vcxproj @@ -165,7 +165,6 @@ </ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\main.cpp" />
- <ClCompile Include="src\options.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\commonheaders.h" />
diff --git a/plugins/Rate/rate_10.vcxproj.filters b/plugins/Rate/rate_10.vcxproj.filters index ba69553d11..041ce0edcc 100644 --- a/plugins/Rate/rate_10.vcxproj.filters +++ b/plugins/Rate/rate_10.vcxproj.filters @@ -18,9 +18,6 @@ <ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\options.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\commonheaders.h">
diff --git a/plugins/Rate/res/rate.rc b/plugins/Rate/res/rate.rc index 59a1db4d1f..8682473b93 100644 --- a/plugins/Rate/res/rate.rc +++ b/plugins/Rate/res/rate.rc @@ -50,18 +50,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // TEXTINCLUDE
//
-1 TEXTINCLUDE
+1 TEXTINCLUDE
BEGIN
"..\\src\\resource.h\0"
END
-2 TEXTINCLUDE
+2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
-3 TEXTINCLUDE
+3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
@@ -70,43 +70,6 @@ END #endif // APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_RATE_OPT DIALOGEX 0, 0, 314, 240
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-FONT 8, "MS Shell Dlg", 0, 0, 0x0
-BEGIN
- COMBOBOX IDC_ADVICON,95,102,78,81,CBS_DROPDOWNLIST | WS_VSCROLL |
- WS_TABSTOP,WS_EX_CLIENTEDGE
- GROUPBOX "Plugin settings",IDC_STATIC,46,46,222,118
- RTEXT "Use",IDC_STATIC,56,104,33,12
- LTEXT "slot to draw the icon",IDC_STATIC,179,104,76,17
- LTEXT "Warning: classic contact list plugin doesn`t have ability to use extraicons",
- IDC_NOTMODERN_WARNING,77,126,171,18,NOT WS_VISIBLE
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
- IDD_RATE_OPT, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 307
- TOPMARGIN, 7
- BOTTOMMARGIN, 233
- END
-END
-#endif // APSTUDIO_INVOKED
-
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
@@ -121,4 +84,3 @@ END /////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
-
diff --git a/plugins/Rate/src/commonheaders.h b/plugins/Rate/src/commonheaders.h index 2637e8f42b..bdced5d33b 100644 --- a/plugins/Rate/src/commonheaders.h +++ b/plugins/Rate/src/commonheaders.h @@ -44,28 +44,11 @@ #include "resource.h"
//external SDK headers
-#include <m_cluiframes.h>
#include <m_extraicons.h>
-static const int DefaultSlot = EXTRA_ICON_PROTO;
#define MODULENAME "Rate"
/* 0e2866a8-6f4c-4132-98ae-6afdb8766c48 */
#define MIID_CONTACTSRATE {0x0e2866a8, 0x6f4c, 0x4132, {0x98, 0xae, 0x6a, 0xfd, 0xb8, 0x76, 0x6c, 0x48}}
-static struct
-{
- TCHAR* szDescr;
- char* szName;
- int defIconID;
- HANDLE hIconLibItem;
-} iconList[] =
-{
- { LPGENT( "Rate high" ), "rate_high", IDI_RATEHI },
- { LPGENT( "Rate medium" ), "rate_medium", IDI_RATEME },
- { LPGENT( "Rate low" ), "rate_low", IDI_RATELO },
-};
-
-
-
#endif //COMMHEADERS_H
diff --git a/plugins/Rate/src/main.cpp b/plugins/Rate/src/main.cpp index a430ef0123..586011caca 100644 --- a/plugins/Rate/src/main.cpp +++ b/plugins/Rate/src/main.cpp @@ -32,33 +32,15 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/*--------------------------------------------------------------------------*/
-/*
- FILE ID: $Id$
- CHANGE LOG:
-
- $Log$
-*/
#include "commonheaders.h"
HINSTANCE g_hInst;
-static HANDLE hHookModulesLoaded = NULL, hSystemOKToExit = NULL, hOptInitialise = NULL, hIcoLibIconsChanged = NULL;
-static HANDLE hHookExtraIconsRebuild = NULL, hHookExtraIconsApply = NULL, hContactSettingChanged = NULL;
-static HANDLE hPrebuildContactMenu = NULL;
static HANDLE hExtraIcon = NULL;
-IconExtraColumn g_IECRateHigh = {0};
-IconExtraColumn g_IECRateMedium = {0};
-IconExtraColumn g_IECRateLow = {0};
-IconExtraColumn g_IECClear = {0};
-int clistIcon = 0; //Icon slot to use
byte bRate = 0;
int hLangpack;
-extern int onOptInitialise(WPARAM wParam, LPARAM lParam);
-
-
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
"Contact`s Rate",
@@ -85,84 +67,21 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda return &pluginInfo;
}
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_CONTACTSRATE, MIID_LAST};
-
-int onSystemOKToExit(WPARAM wParam,LPARAM lParam)
-{
- UnhookEvent(hHookModulesLoaded);
- UnhookEvent(hHookExtraIconsRebuild);
- UnhookEvent(hHookExtraIconsApply);
- UnhookEvent(hOptInitialise);
- UnhookEvent(hSystemOKToExit);
- if (hIcoLibIconsChanged) UnhookEvent(hIcoLibIconsChanged);
- if (hContactSettingChanged)
- UnhookEvent(hContactSettingChanged);
-
- return 0;
-}
-
-void setExtaIcon(HANDLE hContact, int bRate = -1, BOOL clear = TRUE)
-{
- if (hContact == NULL)
- return;
-
- if (bRate < 0)
- bRate = DBGetContactSettingByte(hContact, "CList", "Rate", 0);
-
- if (hExtraIcon != NULL)
- {
- const char *icon;
- switch(bRate)
- {
- case 3: icon = "rate_high"; break;
- case 2: icon = "rate_medium"; break;
- case 1: icon = "rate_low"; break;
- default: icon = NULL; break;
- }
-
- if (icon == NULL && !clear)
- return;
-
- ExtraIcon_SetIcon(hExtraIcon, hContact, icon);
- }
- else
- {
- switch(bRate)
- {
- case 3: CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) hContact, (LPARAM) &g_IECRateHigh); break;
- case 2: CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) hContact, (LPARAM) &g_IECRateMedium); break;
- case 1: CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) hContact, (LPARAM) &g_IECRateLow); break;
- default: CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) hContact, (LPARAM) &g_IECClear); break;
- }
- }
-}
-
+///////////////////////////////////////////////////////////////////////////////
-int onExtraImageApplying(WPARAM wParam, LPARAM lParam)
+struct
{
- setExtaIcon((HANDLE) wParam);
- return 0;
+ TCHAR* szDescr;
+ char* szName;
+ int defIconID;
+ HANDLE hIconLibItem;
}
-
-
-int onExtraImageListRebuild(WPARAM wParam, LPARAM lParam)
+static iconList[] =
{
- g_IECRateHigh.cbSize = sizeof(IconExtraColumn);
- g_IECRateHigh.ColumnType = clistIcon;
- g_IECRateMedium.cbSize = sizeof(IconExtraColumn);
- g_IECRateMedium.ColumnType = clistIcon;
- g_IECRateLow.cbSize = sizeof(IconExtraColumn);
- g_IECRateLow.ColumnType = clistIcon;
-
- if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
- {
- g_IECRateHigh.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)Skin_GetIcon("rate_high"), 0);
- g_IECRateMedium.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)Skin_GetIcon("rate_medium"), 0);
- g_IECRateLow.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)Skin_GetIcon("rate_low"), 0);
- }
- return 0;
-}
-
+ { LPGENT( "Rate high" ), "rate_high", IDI_RATEHI },
+ { LPGENT( "Rate medium" ), "rate_medium", IDI_RATEME },
+ { LPGENT( "Rate low" ), "rate_low", IDI_RATELO },
+};
static void init_icolib (void)
{
@@ -183,65 +102,61 @@ static void init_icolib (void) }
}
+///////////////////////////////////////////////////////////////////////////////
+
+static void setExtraIcon(HANDLE hContact, int bRate = -1, BOOL clear = TRUE)
+{
+ if (hContact == NULL)
+ return;
+
+ if (bRate < 0)
+ bRate = DBGetContactSettingByte(hContact, "CList", "Rate", 0);
+
+ const char *icon = NULL;
+ switch(bRate) {
+ case 1: icon = "rate_low"; break;
+ case 2: icon = "rate_medium"; break;
+ case 3: icon = "rate_high"; break;
+ }
+
+ if (icon != NULL || clear)
+ ExtraIcon_SetIcon(hExtraIcon, hContact, icon);
+}
int onModulesLoaded(WPARAM wParam,LPARAM lParam)
{
- //IcoLib support
+ // IcoLib support
init_icolib();
-
// Extra icon support
hExtraIcon = ExtraIcon_Register("contact_rate", "Contact rate", "rate_high");
- if (hExtraIcon != NULL)
- {
- // Set initial value for all contacts
- HANDLE hContact = db_find_first();
- while (hContact != NULL)
- {
- setExtaIcon(hContact, -1, FALSE);
- hContact = db_find_next(hContact);
- }
- }
- else
- {
- hOptInitialise = HookEvent(ME_OPT_INITIALISE, onOptInitialise);
- hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, onExtraImageListRebuild);
- hHookExtraIconsRebuild = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, onExtraImageListRebuild);
- hHookExtraIconsApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, onExtraImageApplying);
- onExtraImageListRebuild(0,0);
+ // Set initial value for all contacts
+ HANDLE hContact = db_find_first();
+ while (hContact != NULL) {
+ setExtraIcon(hContact, -1, FALSE);
+ hContact = db_find_next(hContact);
}
return 0;
}
-
int onContactSettingChanged(WPARAM wParam,LPARAM lParam)
{
DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam;
if (wParam != NULL && !lstrcmpA(cws->szModule,"CList") && !lstrcmpA(cws->szSetting,"Rate"))
- setExtaIcon((HANDLE)wParam, cws->value.type == DBVT_DELETED ? 0 : cws->value.bVal);
+ setExtraIcon((HANDLE)wParam, cws->value.type == DBVT_DELETED ? 0 : cws->value.bVal);
return 0;
}
-
extern "C" int __declspec(dllexport) Load(void)
{
-
mir_getLP(&pluginInfo);
- hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
- hSystemOKToExit = HookEvent(ME_SYSTEM_OKTOEXIT,onSystemOKToExit);
- hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
-
- clistIcon = DBGetContactSettingByte(NULL, MODULENAME, "AdvancedIcon", DefaultSlot);
-
- g_IECClear.cbSize = sizeof(IconExtraColumn);
- g_IECClear.ColumnType = clistIcon;
- g_IECClear.hImage = (HANDLE) -1;
-
+ HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
return 0;
}
diff --git a/plugins/Rate/src/options.cpp b/plugins/Rate/src/options.cpp deleted file mode 100644 index e435e4b215..0000000000 --- a/plugins/Rate/src/options.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/*
- Authorization State plugin for Miranda-IM (www.miranda-im.org)
- (c) 2006 by Thief
- Icons by Faith Healer
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- File name : $URL: svn://svnsrv.mirandaim.ru/mainrepo/authstate/trunk/options.cpp $
- Revision : $Rev: 233 $
- Last change on : $Date: 2006-10-05 15:48:05 +0300 (Thu, 05 Oct 2006) $
- Last change by : $Author: Thief $
-
-*/
-
-#include "commonheaders.h"
-
-extern HINSTANCE g_hInst;
-extern int onExtraImageApplying(WPARAM wParam, LPARAM lParam);
-extern int onExtraImageListRebuild(WPARAM wParam, LPARAM lParam);
-extern IconExtraColumn g_IECAuth, g_IECGrant, g_IECAuthGrant, g_IECClear;
-extern int clistIcon;
-//extern byte bUseAuthIcon, bUseGrantIcon, bContactMenuItem, bIconsForRecentContacts;
-
-//#define EXTRA_ICON_RES0 0 // only used by nicer
-//#define EXTRA_ICON_EMAIL 1
-//#define EXTRA_ICON_WEB 2
-//#define EXTRA_ICON_SMS 3
-//#define EXTRA_ICON_ADV1 4
-//#define EXTRA_ICON_ADV2 5
-//#define EXTRA_ICON_ADV3 6
-//#define EXTRA_ICON_CLIENT 7
-//#define EXTRA_ICON_ADV4 8
-//#define EXTRA_ICON_RES1 9 // only used by nicer
-//#define EXTRA_ICON_PROTO 9 // used by mwclist and modern
-//#define EXTRA_ICON_RES2 10 // only used by nicer
-//#define EXTRA_ICON_VISMODE 10 // only used by modern
-
-#define MS_SKINENG_DRAWICONEXFIX "SkinEngine/DrawIconEx_Fix"
-
-enum {
- clist_none,
- clist_modern,
- clist_nicer
-};
-
-const TCHAR *szAdvancedIconsModern[] = {
- LPGENT("E-mail"),
- LPGENT("Web page"),
- LPGENT("Phone/SMS"),
- LPGENT("Advanced #1"),
- LPGENT("Advanced #2"),
- LPGENT("Advanced #3"),
- LPGENT("Client"),
- LPGENT("Advanced #4"),
- LPGENT("Protocol"),
- LPGENT("Visibility/Chat activity")
-};
-//const int cAdvancedIconsModern = sizeof(szAdvancedIconsModern) / sizeof(szAdvancedIconsModern[0]);
-
-const TCHAR *szAdvancedIconsNicer[] = {
- LPGENT("Reserved"),
- LPGENT("E-mail"),
- LPGENT("Homepage"),
- LPGENT("Telephone"),
- LPGENT("Advanced #1"),
- LPGENT("Advanced #2"),
- LPGENT("Client"),
- LPGENT("Advanced #3"),
- LPGENT("Advanced #4"),
- LPGENT("Reserved #1"),
- LPGENT("Reserved #2")
- };
-//const int cAdvancedIconsNicer = sizeof(szAdvancedIconsNicer) / sizeof(szAdvancedIconsNicer[0]);
-
-INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- static int bInitializing = 0;
- static int usedClist = clist_none;
- int cAdvancedIcons;
-// const char **szAdvancedIcons;
-
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- bInitializing = 1;
- if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
- {
- if (ServiceExists(MS_SKINENG_DRAWICONEXFIX))
- { // modern?
-// SendDlgItemMessage(hwndDlg,IDC_USED_CLIST, WM_SETTEXT,0,(LPARAM)_T("Your clist: modern"));
- cAdvancedIcons = SIZEOF(szAdvancedIconsModern);
- usedClist = clist_modern;
- }
- else
- {
- if (ServiceExists("CLN/About"))
- {
- usedClist = clist_nicer;
-// szAdvancedIcons = szAdvancedIconsNicer;
- cAdvancedIcons = SIZEOF(szAdvancedIconsNicer);
- SendDlgItemMessage(hwndDlg,IDC_USED_CLIST, WM_SETTEXT,0,(LPARAM)TranslateT("Your clist: nicer"));
- }
- else
- {
- usedClist = clist_modern;
- cAdvancedIcons = SIZEOF(szAdvancedIconsModern) - 1; // mw doesn`t have last modern extraicon
-// SendDlgItemMessage(hwndDlg,IDC_USED_CLIST, WM_SETTEXT,0,(LPARAM)_T("Your clist: mw"));
- }
- SendDlgItemMessage(hwndDlg,IDC_NOTMODERN_WARNING, WM_SETTEXT,0,(LPARAM)TranslateT("Warning: your contact list plugin doesn`t have ability to sort contacts by rate."));
- ShowWindow(GetDlgItem(hwndDlg, IDC_NOTMODERN_WARNING), SW_SHOW);
- }
- }
- else
- {
- cAdvancedIcons = 0;
-// SendDlgItemMessage(hwndDlg,IDC_USED_CLIST, WM_SETTEXT,0,(LPARAM)_T("Your clist: classic"));
- SendDlgItemMessage(hwndDlg,IDC_NOTMODERN_WARNING, WM_SETTEXT,0,(LPARAM)TranslateT("Warning: classic contact list plugin doesn`t have ability to use extraicons"));
- ShowWindow(GetDlgItem(hwndDlg, IDC_NOTMODERN_WARNING), SW_SHOW);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADVICON), 0);
- }
-// cAdvancedIcons = sizeof(szAdvancedIcons) / sizeof(szAdvancedIcons[0]);
-// cAdvancedIcons = SIZEOF(szAdvancedIcons);
-
- if (usedClist != clist_none) {
- for (int i = 0; i < cAdvancedIcons; i++)
- {
- SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_ADDSTRING, 0, (LPARAM) TranslateTS( usedClist==clist_modern ? szAdvancedIconsModern[i] : szAdvancedIconsNicer[i]));
- }
-
- if (usedClist == clist_modern )
- SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_SETCURSEL, clistIcon-1, 0);
- else
- SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_SETCURSEL, clistIcon, 0);
- }
- bInitializing = 0;
- return TRUE;
- }
- case WM_COMMAND:
- {
- switch (LOWORD(wParam)) {
- case IDC_ADVICON:
- {
- if ((HIWORD(wParam) == EN_CHANGE) && (!bInitializing) || (HIWORD(wParam) == CBN_SELENDOK))
- {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
- }
- }
- break;
- }
- case WM_NOTIFY:
- {
- if (((LPNMHDR)lParam)->idFrom == 0)
- {
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- if (usedClist==clist_none)
- return TRUE;
-
- clistIcon = SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_GETCURSEL, 0, 0);
- if (usedClist == clist_modern )
- clistIcon++;
-
- HANDLE hContact = db_find_first();
- while (hContact)
- {
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&g_IECClear);
- hContact = db_find_next(hContact);
- }
- g_IECClear.ColumnType = clistIcon;
- onExtraImageListRebuild(0,0);
- hContact = db_find_first();
- while (hContact)
- {
- onExtraImageApplying((WPARAM)hContact,0);
- hContact = db_find_next(hContact);
- }
- //Store options values to DB
- DBWriteContactSettingByte(NULL, MODULENAME, "AdvancedIcon", clistIcon);
- }
- return TRUE;
- }
- }
- }
- case WM_DESTROY:
- break;
- }
- return FALSE;
-}
-
-int onOptInitialise(WPARAM wParam, LPARAM lParam)
-{
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.cbSize = sizeof(odp);
- odp.hInstance = g_hInst;
- odp.ptszGroup = LPGENT("Contact List");
- odp.ptszTitle = LPGENT("Rate");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_RATE_OPT);
- odp.pfnDlgProc = DlgProcOptions;
- odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
- Options_AddPage(wParam, &odp);
-
- return 0;
-}
diff --git a/plugins/Rate/src/resource.h b/plugins/Rate/src/resource.h index 3b27728839..ba0f258319 100644 --- a/plugins/Rate/src/resource.h +++ b/plugins/Rate/src/resource.h @@ -2,16 +2,12 @@ // Microsoft Visual C++ generated include file.
// Used by rate.rc
//
-#define IDD_RATE_OPT 9
#define IDI_RATEHI 101
#define IDI_RATEME 102
#define IDI_RATELO 103
-#define IDC_ADVICON 1001
-#define IDC_NOTMODERN_WARNING 1010
-#define IDC_USED_CLIST 1011
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 104
diff --git a/plugins/SecureIM/res/resource.rc b/plugins/SecureIM/res/resource.rc index 9ff15ed681..45ea911955 100644 --- a/plugins/SecureIM/res/resource.rc +++ b/plugins/SecureIM/res/resource.rc @@ -52,8 +52,6 @@ BEGIN CONTROL "Not secured for NotOnList",IDC_NOL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,212,145,10
CONTROL "Auto accept RSA key (NOT SECURED)",IDC_AAK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,156,142,145,10
CONTROL "Mode in Context Menu",IDC_MCM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,156,152,145,10
- GROUPBOX "",IDC_STATIC,156,158,144,19
- COMBOBOX IDC_ADVICON,160,163,135,81,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP,WS_EX_CLIENTEDGE
GROUPBOX "",IDC_STATIC,156,175,144,32
RTEXT "Key Exchange Timeout :",IDC_STATIC,160,182,80,8
EDITTEXT IDC_KET,241,180,30,12,ES_AUTOHSCROLL | ES_NUMBER
diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index 2c18f51e5d..881e69c38d 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -14,14 +14,14 @@ int iService=0; int iHook=0;
HICON g_hICO[ICO_CNT], g_hPOP[POP_CNT], g_hIEC[1+IEC_CNT*MODE_CNT] = {0};
-IconExtraColumn g_IEC[1+IEC_CNT*MODE_CNT];
+HANDLE g_IEC[1+IEC_CNT*MODE_CNT];
int iBmpDepth;
BOOL bCoreUnicode = false, bMetaContacts = false, bPopupExists = false, bPopupUnicode = false;
BOOL bPGPloaded = false, bPGPkeyrings = false, bUseKeyrings = false, bPGPprivkey = false;
BOOL bGPGloaded = false, bGPGkeyrings = false, bSavePass = false;
BOOL bSFT, bSOM, bASI, bMCD, bSCM, bDGP, bAIP, bNOL, bAAK, bMCM;
-BYTE bADV, bPGP, bGPG;
+BYTE bPGP, bGPG;
DWORD iCoreVersion = 0;
CRITICAL_SECTION localQueueMutex;
@@ -78,7 +78,6 @@ void GetFlags() { bSCM = DBGetContactSettingByte(0,szModuleName,"scm",0);
bDGP = DBGetContactSettingByte(0,szModuleName,"dgp",0);
bAIP = DBGetContactSettingByte(0,szModuleName,"aip",0);
- bADV = DBGetContactSettingByte(0,szModuleName,"adv",0);
bNOL = DBGetContactSettingByte(0,szModuleName,"nol",0);
bAAK = DBGetContactSettingByte(0,szModuleName,"aak",0);
bMCM = DBGetContactSettingByte(0,szModuleName,"mcm",0);
@@ -93,7 +92,6 @@ void SetFlags() { DBWriteContactSettingByte(0,szModuleName,"scm",bSCM);
DBWriteContactSettingByte(0,szModuleName,"dgp",bDGP);
DBWriteContactSettingByte(0,szModuleName,"aip",bAIP);
- DBWriteContactSettingByte(0,szModuleName,"adv",bADV);
DBWriteContactSettingByte(0,szModuleName,"nol",bNOL);
DBWriteContactSettingByte(0,szModuleName,"aak",bAAK);
DBWriteContactSettingByte(0,szModuleName,"mcm",bMCM);
diff --git a/plugins/SecureIM/src/commonheaders.h b/plugins/SecureIM/src/commonheaders.h index c848d43484..1f4e94b8e8 100644 --- a/plugins/SecureIM/src/commonheaders.h +++ b/plugins/SecureIM/src/commonheaders.h @@ -141,13 +141,13 @@ extern HANDLE *g_hService; extern HANDLE *g_hHook;
extern int iService, iHook;
extern HICON g_hICO[ICO_CNT], g_hIEC[1+IEC_CNT*MODE_CNT], g_hPOP[POP_CNT];
-extern IconExtraColumn g_IEC[1+IEC_CNT*MODE_CNT];
+extern HANDLE g_IEC[1+IEC_CNT*MODE_CNT];
extern int iBmpDepth;
extern BOOL bCoreUnicode, bMetaContacts, bPopupExists, bPopupUnicode;
extern BOOL bPGPloaded, bPGPkeyrings, bUseKeyrings, bPGPprivkey;
extern BOOL bGPGloaded, bGPGkeyrings, bSavePass;
extern BOOL bSFT, bSOM, bASI, bMCD, bSCM, bDGP, bAIP, bNOL, bAAK, bMCM;
-extern BYTE bADV, bPGP, bGPG;
+extern BYTE bPGP, bGPG;
extern DWORD iCoreVersion;
extern CRITICAL_SECTION localQueueMutex;
diff --git a/plugins/SecureIM/src/crypt.h b/plugins/SecureIM/src/crypt.h index e626570f9e..be936d420f 100644 --- a/plugins/SecureIM/src/crypt.h +++ b/plugins/SecureIM/src/crypt.h @@ -139,8 +139,6 @@ BOOL isSecureIM(HANDLE hContact, BOOL emptyMirverAsSecureIM=FALSE); // crypt_icons.cpp
HICON mode2icon(int,int);
-HICON mode2icon2(int,int); // создает КОПИЮ иконки, которую надо разрушить
-IconExtraColumn mode2iec(int);
void RefreshContactListIcons(void);
void ShowStatusIcon(HANDLE,UINT);
void ShowStatusIcon(HANDLE);
diff --git a/plugins/SecureIM/src/crypt_icons.cpp b/plugins/SecureIM/src/crypt_icons.cpp index f48e94278e..ed0b68d15a 100644 --- a/plugins/SecureIM/src/crypt_icons.cpp +++ b/plugins/SecureIM/src/crypt_icons.cpp @@ -1,6 +1,5 @@ #include "commonheaders.h"
-
typedef struct {
HICON icon;
SHORT mode;
@@ -47,52 +46,19 @@ HICON mode2icon(int mode,int type) { return icon;
}
-
-// преобразует mode в HICON который НУЖНО разрушить в конце
-HICON mode2icon2(int mode,int type) {
- return CopyIcon(mode2icon(mode,type));
-}
-
-
-// преобразует mode в IconExtraColumn который НЕ нужно разрушать в конце
-IconExtraColumn mode2iec(int mode) {
-
- int m=mode&0x0f,s=(mode&SECURED)>>4; // разобрали на части - режим и состояние
-
- if ( mode==-1 || (!s && !bASI && m!=MODE_PGP && m!=MODE_GPG)) {
- return g_IEC[0]; // вернем пустое место
- }
-
- int i=1+m*IEC_CNT+IEC_CL_DIS+s;
- if ( g_IEC[i].hImage==(HANDLE)-1 ) {
-/* g_hIEC[i] = mode2icon(mode,1);
- g_IEC[i].hImage = (HANDLE) CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)g_hIEC[i], 0);*/
- HICON icon = mode2icon(mode,1);
- g_IEC[i].hImage = (HANDLE) CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)icon, 0);
- }
- return g_IEC[i];
-}
-
-
// обновляет иконки в clist и в messagew
-void ShowStatusIcon(HANDLE hContact,int mode) {
-
+void ShowStatusIcon(HANDLE hContact,int mode)
+{
HANDLE hMC = getMetaContact(hContact);
- if ( bADV || g_hCLIcon ) { // обновить иконки в clist
- if ( mode!= -1 ) {
- IconExtraColumn iec=mode2iec(mode);
- if ( g_hCLIcon ) {
- ExtraIcon_SetIcon(g_hCLIcon, hContact, iec.hImage);
- if ( hMC )
- ExtraIcon_SetIcon(g_hCLIcon, hMC, iec.hImage);
- }
- else {
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
- if ( hMC )
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hMC, (LPARAM)&iec);
- }
- }
+
+ // обновить иконки в clist
+ if (mode != -1) {
+ HICON hIcon = mode2icon(mode, 1);
+ ExtraIcon_SetIcon(g_hCLIcon, hContact, hIcon);
+ if ( hMC )
+ ExtraIcon_SetIcon(g_hCLIcon, hMC, hIcon);
}
+
if ( ServiceExists(MS_MSG_MODIFYICON)) { // обновить иконки в srmm
StatusIconData sid;
memset(&sid,0,sizeof(sid));
@@ -100,52 +66,36 @@ void ShowStatusIcon(HANDLE hContact,int mode) { sid.szModule = (char*)szModuleName;
for(int i=MODE_NATIVE; i<MODE_CNT;i++) {
sid.dwId = i;
- sid.flags = (mode&SECURED)?0:MBF_DISABLED;
- if ( mode==-1 || (mode&0x0f)!=i || isChatRoom(hContact))
+ sid.flags = (mode & SECURED) ? 0 : MBF_DISABLED;
+ if (mode == -1 || (mode & 0x0f) != i || isChatRoom(hContact))
sid.flags |= MBF_HIDDEN; // отключаем все ненужные иконки
CallService(MS_MSG_MODIFYICON, (WPARAM)hContact, (LPARAM)&sid);
if ( hMC )
- CallService(MS_MSG_MODIFYICON, (WPARAM)hMC, (LPARAM)&sid);
+ CallService(MS_MSG_MODIFYICON, (WPARAM)hMC, (LPARAM)&sid);
}
}
}
-
-void ShowStatusIcon(HANDLE hContact) {
+void ShowStatusIcon(HANDLE hContact)
+{
ShowStatusIcon(hContact,isContactSecured(hContact));
}
-
-void ShowStatusIconNotify(HANDLE hContact) {
+void ShowStatusIconNotify(HANDLE hContact)
+{
int mode = isContactSecured(hContact);
NotifyEventHooks(g_hEvent[(mode&SECURED)!=0], (WPARAM)hContact, 0);
ShowStatusIcon(hContact,mode);
}
-
-void RefreshContactListIcons(void) {
-
- HANDLE hContact;
-// CallService(MS_CLUI_LISTBEGINREBUILD,0,0);
- if ( !g_hCLIcon ) {
- hContact = db_find_first();
- while (hContact) { // сначала все выключаем
- ShowStatusIcon(hContact,-1);
- hContact = db_find_next(hContact);
- }
- // менем местоположение иконки
- for(int i=0;i<1+MODE_CNT*IEC_CNT;i++) {
- g_IEC[i].ColumnType = bADV;
- }
- }
- hContact = db_find_first();
+void RefreshContactListIcons(void)
+{
+ HANDLE hContact = db_find_first();
while (hContact) { // и снова зажигаем иконку
if ( isSecureProtocol(hContact))
ShowStatusIcon(hContact);
hContact = db_find_next(hContact);
}
-// CallService(MS_CLUI_LISTENDREBUILD,0,0);
}
-
// EOF
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 5d2a27215d..23ee788a76 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -355,35 +355,20 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { Sent_NetLog("init extra icons");
#endif
// init extra icons
- for(int i=0;i<1+MODE_CNT*IEC_CNT;i++) {
- g_IEC[i].cbSize = sizeof(g_IEC[i]);
- g_IEC[i].ColumnType = bADV;
- g_IEC[i].hImage = (HANDLE)-1;
- }
-
- // build extra imagelist
- //onExtraImageListRebuilding(0,0);
+ for(int i=0;i<1+MODE_CNT*IEC_CNT;i++)
+ g_IEC[i] = (HANDLE)-1;
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("hook events");
#endif
AddHookFunction(ME_CLIST_PREBUILDCONTACTMENU, onRebuildContactMenu);
-// g_hMC = HookEvent(ME_MC_SUBCONTACTSCHANGED, onMC);
- if ( ServiceExists(MS_EXTRAICON_REGISTER)) {
- g_hCLIcon = ExtraIcon_Register(szModuleName, Translate("SecureIM status"), "sim_cm_est",
- onExtraImageListRebuilding,
- onExtraImageApplying);
- }
- else {
- AddHookFunction(ME_CLIST_EXTRA_LIST_REBUILD, onExtraImageListRebuilding);
- AddHookFunction(ME_CLIST_EXTRA_IMAGE_APPLY, onExtraImageApplying);
- }
+ g_hCLIcon = ExtraIcon_Register(szModuleName, Translate("SecureIM status"), "sim_cm_est", onExtraImageListRebuilding, onExtraImageApplying);
// hook init options
AddHookFunction(ME_OPT_INITIALISE, onRegisterOptions);
if(bPopupExists)
- AddHookFunction(ME_OPT_INITIALISE, onRegisterPopOptions);
+ AddHookFunction(ME_OPT_INITIALISE, onRegisterPopOptions);
AddHookFunction(ME_PROTO_ACK, onProtoAck);
AddHookFunction(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
AddHookFunction(ME_DB_CONTACT_ADDED, onContactAdded);
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index eba769f9ca..a8ac1c72bf 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -4,8 +4,6 @@ #define RSASIZE (4096+1)
BOOL bChangeSortOrder = false;
-const char *szAdvancedIcons[] = {"None", "Email", "Protocol", "SMS", "Advanced 1", "Advanced 2", "Web", "Client", "VisMode", "Advanced 6", "Advanced 7", 0};
-
BOOL hasKey(pUinKey ptr) {
BOOL ret = 0;
@@ -25,7 +23,6 @@ BOOL hasKey(pUinKey ptr) { return ret;
}
-
void TC_InsertItem(HWND hwnd, WPARAM wparam, TCITEM *tci) {
if ( bCoreUnicode ) {
LPWSTR tmp = mir_a2u(tci->pszText);
@@ -268,9 +265,6 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR lvc.cx = iColWidth[i];
LV_InsertColumn(hLV, i, &lvc);
}
- for (i = 0; szAdvancedIcons[i]; i++) {
- SendMessage(GetDlgItem(hDlg, IDC_ADVICON), CB_ADDSTRING, 0, (LPARAM) Translate(szAdvancedIcons[i]));
- }
RefreshGeneralDlg(hDlg,TRUE);
EnableWindow(hLV, true);
@@ -442,7 +436,6 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR case IDC_SCM:
case IDC_DGP:
case IDC_OKT:
- case IDC_ADVICON:
break;
default:
@@ -1131,12 +1124,6 @@ void RefreshGeneralDlg(HWND hDlg, BOOL iInit) { SendMessage(GetDlgItem(hDlg,IDC_AAK),BM_SETCHECK,(bAAK)?BST_CHECKED:BST_UNCHECKED,0L);
SendMessage(GetDlgItem(hDlg,IDC_MCM),BM_SETCHECK,(bMCM)?BST_CHECKED:BST_UNCHECKED,0L);
- // Advanced
- SendMessage(GetDlgItem(hDlg, IDC_ADVICON), CB_SETCURSEL, bADV, 0);
- if ( g_hCLIcon ) {
- EnableWindow(GetDlgItem(hDlg, IDC_ADVICON), false);
- }
-
// Select {OFF,PGP,GPG}
SendMessage(GetDlgItem(hDlg,IDC_PGP),BM_SETCHECK,bPGP?BST_CHECKED:BST_UNCHECKED,0L);
SendMessage(GetDlgItem(hDlg,IDC_GPG),BM_SETCHECK,bGPG?BST_CHECKED:BST_UNCHECKED,0L);
@@ -1376,10 +1363,6 @@ void ResetGeneralDlg(HWND hDlg) { SendMessage(GetDlgItem(hDlg,IDC_AIP),BM_SETCHECK,BST_UNCHECKED,0L);
SendMessage(GetDlgItem(hDlg,IDC_MCM),BM_SETCHECK,BST_UNCHECKED,0L);
-// for(int i=0;i<ADV_CNT;i++)
-// SendMessage(GetDlgItem(hDlg,IDC_ADV1+i),BM_SETCHECK,(i==0)?BST_CHECKED:BST_UNCHECKED,0L);
- SendMessage(GetDlgItem(hDlg, IDC_ADVICON), CB_SETCURSEL, 0, 0);
-
// rebuild list of contacts
HWND hLV = GetDlgItem(hDlg,IDC_STD_USERLIST);
ListView_DeleteAllItems(hLV);
@@ -1461,7 +1444,6 @@ void ApplyGeneralSettings(HWND hDlg) { bNOL = (SendMessage(GetDlgItem(hDlg, IDC_NOL),BM_GETCHECK,0L,0L)==BST_CHECKED);
bAAK = (SendMessage(GetDlgItem(hDlg, IDC_AAK),BM_GETCHECK,0L,0L)==BST_CHECKED);
bMCM = (SendMessage(GetDlgItem(hDlg, IDC_MCM),BM_GETCHECK,0L,0L)==BST_CHECKED);
- bADV = (BYTE)SendMessage(GetDlgItem(hDlg, IDC_ADVICON), CB_GETCURSEL, 0, 0);
SetFlags();
diff --git a/plugins/SecureIM/src/resource.h b/plugins/SecureIM/src/resource.h index f8a753773d..fc800bdd56 100644 --- a/plugins/SecureIM/src/resource.h +++ b/plugins/SecureIM/src/resource.h @@ -106,7 +106,6 @@ #define IDC_DGP 1044
#define IDC_OKT 1045
#define IDC_AIP 1046
-#define IDC_ADVICON 1047
#define IDC_SPLITON 1048
#define IDC_SPLITOFF 1049
#define IDC_RSA_SHA 1050
diff --git a/plugins/SecureIM/src/svcs_clist.cpp b/plugins/SecureIM/src/svcs_clist.cpp index 12402a58be..4a3d657097 100644 --- a/plugins/SecureIM/src/svcs_clist.cpp +++ b/plugins/SecureIM/src/svcs_clist.cpp @@ -71,39 +71,27 @@ int __cdecl onContactAdded(WPARAM wParam,LPARAM lParam) { // wParam=(WPARAM)(HANDLE)hContact
// lParam=0
-int __cdecl onContactDeleted(WPARAM wParam,LPARAM lParam) {
+int __cdecl onContactDeleted(WPARAM wParam,LPARAM lParam)
+{
delContact((HANDLE)wParam);
return 0;
}
-int __cdecl onExtraImageListRebuilding(WPARAM, LPARAM) {
-
-#if defined(_DEBUG) || defined(NETLIB_LOG)
- Sent_NetLog("onExtraImageListRebuilding");
-#endif
- if ( (bADV || g_hCLIcon) && ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) {
- RefreshContactListIcons();
- }
+int __cdecl onExtraImageListRebuilding(WPARAM, LPARAM)
+{
+ RefreshContactListIcons();
return 0;
}
+int __cdecl onExtraImageApplying(WPARAM wParam, LPARAM)
+{
+ if ( isSecureProtocol((HANDLE)wParam))
+ ExtraIcon_SetIcon(g_hCLIcon, (HANDLE)wParam, mode2icon( isContactSecured((HANDLE)wParam), 1));
-int __cdecl onExtraImageApplying(WPARAM wParam, LPARAM) {
-
- if ( (bADV || g_hCLIcon) && ServiceExists(MS_CLIST_EXTRA_SET_ICON) && isSecureProtocol((HANDLE)wParam)) {
- IconExtraColumn iec = mode2iec(isContactSecured((HANDLE)wParam));
- if ( g_hCLIcon ) {
- ExtraIcon_SetIcon(g_hCLIcon, (HANDLE)wParam, iec.hImage);
- }
- else {
- CallService(MS_CLIST_EXTRA_SET_ICON, wParam, (LPARAM)&iec);
- }
- }
return 0;
}
-
int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
diff --git a/plugins/UserInfoEx/res/resource.rc b/plugins/UserInfoEx/res/resource.rc index 24e0fe94ae..bfabd39d7a 100644 --- a/plugins/UserInfoEx/res/resource.rc +++ b/plugins/UserInfoEx/res/resource.rc @@ -7,7 +7,8 @@ //
// Generated from the TEXTINCLUDE 2 resource.
//
-#include "afxres.h"
+#include "afxres.h"
+
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -190,8 +191,6 @@ BEGIN EDITTEXT EDIT_REMIND2,144,154,44,13,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
CONTROL "",SPIN_REMIND2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,186,152,11,14
LTEXT "hours",TXT_REMIND4,198,155,92,8
- LTEXT "CList extra icon:",TXT_REMIND5,16,190,120,8,0,WS_EX_RIGHT
- COMBOBOX EDIT_EXTRAICON,144,189,132,123,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Icon flashing on event",CHECK_REMIND_FLASHICON,"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,18,41,273,10
COMBOBOX EDIT_REMIND_ENABLED,90,18,98,108,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Enabled",IDC_STATIC,38,20,47,8,0,WS_EX_RIGHT
@@ -445,10 +444,7 @@ BEGIN CONTROL "Off",RADIO_OPT_MI_ACCOUNT_NONE,"Button",BS_AUTORADIOBUTTON,161,84,31,10
CONTROL "Ex-/Import items",RADIO_OPT_MI_ACCOUNT_EXIMPORT,"Button",BS_AUTORADIOBUTTON,222,84,80,10
GROUPBOX "Extra Icons",GROUP_OPT_EXTRAICONS,6,105,144,117
- LTEXT "This options require a contact list which supports extra icons.",TXT_OPT_DEFAULTICONS2,12,117,131,24
- LTEXT "Note: Miranda NG will have to be restarted for changes to take effect.",TXT_OPT_EXTRAICONS,12,148,131,24,NOT WS_VISIBLE
LTEXT "Gender:",TXT_OPT_GENDER,12,148,40,8
- COMBOBOX COMBO_OPT_GENDER,12,158,131,137,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Replace the following default icons:",TXT_OPT_DEFAULTICONS,12,180,132,8
CONTROL "Homepage",CHECK_OPT_HOMEPAGEICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,192,68,10
CONTROL "Phone",CHECK_OPT_PHONEICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,84,192,59,10
@@ -458,7 +454,6 @@ BEGIN CONTROL "Show 'Restart' menu item",CHECK_OPT_MI_RESTART,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,161,117,131,10
CONTROL "Use Zodiac as default avatar",CHECK_OPT_ZODIACAVATAR,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,129,131,10
- COMBOBOX COMBO_OPT_FLAGS,161,158,131,137,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Country Flags",TXT_OPT_FLAGS,161,148,131,8
CONTROL "Use &unknown flag if country can not be determined",CHECK_OPT_FLAGSUNKNOWN,
"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_GROUP | WS_TABSTOP,161,180,131,15
@@ -632,6 +627,7 @@ IDB_FLAGSPNG PNG "flags.png" //
// Generated from the TEXTINCLUDE 3 resource.
//
-
+
+
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index 8999df2cca..359d574b30 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -52,7 +52,6 @@ static HANDLE hMsgWndEventHook = NULL; static HANDLE hIconsChangedHook = NULL;
static HANDLE hSettingChangedHook = NULL;
-static HANDLE hExtraIconSvcHook = NULL;
static HANDLE hOptInitHook = NULL;
static int OnContactSettingChanged(WPARAM wParam,LPARAM lParam);
@@ -233,136 +232,58 @@ static INT_PTR ServiceDetectContactOriginCountry(WPARAM wParam,LPARAM lParam) * Clist Extra Image functions
***********************************************************************************************************/
-static void CALLBACK SetExtraImage(LPARAM lParam) {
+static void CALLBACK SetExtraImage(LPARAM lParam)
+{
/* get contact's country */
int countryNumber = ServiceDetectContactOriginCountry((WPARAM)lParam,0);;
- //use ExtraIconsService ?
- if (myGlobals.ExtraIconsServiceExist) {
- EXTRAICON ico;
- ico.cbSize = sizeof(ico);
- ico.hContact = (HANDLE)lParam;
- ico.hExtraIcon = hExtraIconSvc;
- ico.icoName = (char*)0; //preset
- if(countryNumber!=0xFFFF || gFlagsOpts.bUseUnknownFlag) {
- char szId[20];
- mir_snprintf(szId, SIZEOF(szId), (countryNumber==0xFFFF)?"%s_0x%X":"%s_%i","flags",countryNumber); /* buffer safe */
- ico.icoName = szId;
- }
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
- }
- //use Clist ExtraImageService
- else if(gFlagsOpts.bShowExtraImgFlag) {
- int index;
- IconExtraColumn iec;
- iec.cbSize = sizeof(iec);
- iec.ColumnType = gFlagsOpts.idExtraColumn;
- iec.hImage = INVALID_HANDLE_VALUE; //preset
- /* get icon for contact */
- if(phExtraImageList!=NULL) { /* too early? */
- if(countryNumber!=0xFFFF || gFlagsOpts.bUseUnknownFlag) {
- index = CountryNumberToIndex(countryNumber);
- /* icon not add to clist extra image list? */
- if(phExtraImageList[index]==INVALID_HANDLE_VALUE) {
- HICON hIcon=LoadFlag(countryNumber); // Returned HICON SHOULDN'T be destroyed, it is managed by IcoLib
- if(hIcon!=NULL) {
- phExtraImageList[index]=(HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON,(WPARAM)hIcon,0);
- Skin_ReleaseIcon(hIcon); /* does NULL check */
- }
- }
- iec.hImage=phExtraImageList[index];
- }
- }
- //Set icon for contact at needed column
- CallService(MS_CLIST_EXTRA_SET_ICON,(WPARAM)lParam,(LPARAM)&iec);
+
+ EXTRAICON ico = { sizeof(ico) };
+ ico.hContact = (HANDLE)lParam;
+ ico.hExtraIcon = hExtraIconSvc;
+ ico.icoName = (char*)0; //preset
+ if (countryNumber != 0xFFFF || gFlagsOpts.bUseUnknownFlag) {
+ char szId[20];
+ mir_snprintf(szId, SIZEOF(szId), (countryNumber==0xFFFF)?"%s_0x%X":"%s_%i","flags",countryNumber); /* buffer safe */
+ ico.icoName = szId;
}
+ CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
}
-static void CALLBACK RemoveExtraImages(LPARAM lParam) {
- register HANDLE hContact;
- //use ExtraIconsService ?
- if (myGlobals.ExtraIconsServiceExist) {
- EXTRAICON ico;
- ico.cbSize = sizeof(ico);
- ico.hExtraIcon = hExtraIconSvc;
- ico.icoName = (char *)0; /* invalidate icon for contact*/
- /* enum all contacts */
- for (hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact)) {
- ico.hContact = hContact;
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
- }
- }
- //use Clist ExtraImageService
- else {
- IconExtraColumn iec;
- iec.cbSize = sizeof(iec);
- iec.ColumnType = gFlagsOpts.idExtraColumn;
- iec.hImage = INVALID_HANDLE_VALUE;
- /* enum all contacts */
- for (hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact)) {
- /* invalidate icon for contact*/
- CallService(MS_CLIST_EXTRA_SET_ICON,(WPARAM)hContact,(LPARAM)&iec);
- }
+static void CALLBACK RemoveExtraImages(LPARAM lParam)
+{
+ EXTRAICON ico = { sizeof(ico) };
+ ico.hExtraIcon = hExtraIconSvc;
+ ico.icoName = 0; /* invalidate icon for contact*/
+ /* enum all contacts */
+ for (HANDLE hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact)) {
+ ico.hContact = hContact;
+ CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
}
}
// always call in context of main thread
-void EnsureExtraImages() //garantieren - sicherstellen - updaten
+void EnsureExtraImages()
{
- register HANDLE hContact;
- //use Clist ExtraImageService?
- if (!myGlobals.ExtraIconsServiceExist) {
- BYTE idExtraColumnNew = DB::Setting::GetByte(MODNAMEFLAGS,"ExtraImgFlagColumn",SETTING_EXTRAIMGFLAGCOLUMN_DEFAULT);
- if(idExtraColumnNew != gFlagsOpts.idExtraColumn) {
- /* clear previous column */
- RemoveExtraImages(0);
- gFlagsOpts.idExtraColumn = idExtraColumnNew;
- /* clear new column */
- RemoveExtraImages(0);
- }
- }
- /* enum all contacts */
- for (hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact)) {
- /* update icon */
+ for (HANDLE hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact))
CallFunctionBuffered(SetExtraImage,(LPARAM)hContact,TRUE,EXTRAIMAGE_REFRESHDELAY);
- }
}
static void CALLBACK UpdateExtraImages(LPARAM lParam) {
if (!lParam)
- RemoveExtraImages(0);
- else EnsureExtraImages();
-
-/* if (!myGlobals.ExtraIconsServiceExist && !gFlagsOpts.bShowExtraImgFlag)
- RemoveExtraImages();
- else EnsureExtraImages(); */
-}
-
-//hookProc ME_CLIST_EXTRA_LIST_REBUILD
-static int OnCListRebuildIcons(WPARAM wParam,LPARAM lParam) {
- OutputDebugStringA("REBUILD EXTRA\n");
- //use ExtraIconsService ?
- if(myGlobals.ExtraIconsServiceExist) return 0; //delete ?
- //use Clist ExtraImageService
- if(phExtraImageList!=NULL) {
- /* invalidate icons */
- for(int i=0;i<nCountriesCount;++i)
- phExtraImageList[i]=INVALID_HANDLE_VALUE;
- }
- /* update column */
- gFlagsOpts.idExtraColumn = DB::Setting::GetByte(MODNAMEFLAGS,"ExtraImgFlagColumn",SETTING_EXTRAIMGFLAGCOLUMN_DEFAULT);
- return 0;
+ RemoveExtraImages(0);
+ else
+ EnsureExtraImages();
}
-//hookProc ME_CLIST_EXTRA_IMAGE_APPLY
-static int OnCListApplyIcons(WPARAM wParam,LPARAM lParam) {
- //OutputDebugStringA("APPLY EXTRA\n");
- if(myGlobals.ExtraIconsServiceExist || gFlagsOpts.bShowExtraImgFlag)
- SetExtraImage((LPARAM)wParam); /* unbuffered */
+static int OnCListApplyIcons(WPARAM wParam,LPARAM lParam)
+{
+ SetExtraImage((LPARAM)wParam); /* unbuffered */
return 0;
}
//hookProc (ME_DB_CONTACT_SETTINGCHANGED) - workaround for missing event from ExtraIconSvc
-static int OnExtraIconSvcChanged(WPARAM wParam,LPARAM lParam) {
+static int OnExtraIconSvcChanged(WPARAM wParam,LPARAM lParam)
+{
DBCONTACTWRITESETTING *dbcws=(DBCONTACTWRITESETTING*)lParam;
if ((HANDLE)wParam!=NULL)return 0;
if (!lstrcmpA(dbcws->szModule, "ExtraIcons") &&
@@ -396,8 +317,8 @@ static int OnExtraIconSvcChanged(WPARAM wParam,LPARAM lParam) { return 0;
}
-VOID SvcFlagsEnableExtraIcons(BYTE bColumn, BOOLEAN bUpdateDB) {
- if (!myGlobals.HaveCListExtraIcons) return;
+VOID SvcFlagsEnableExtraIcons(BYTE bColumn, BOOLEAN bUpdateDB)
+{
gFlagsOpts.bShowExtraImgFlag = (bColumn!=((BYTE)-1));
if (bUpdateDB) {
if(gFlagsOpts.bShowExtraImgFlag) DB::Setting::WriteByte(MODNAMEFLAGS,"ExtraImgFlagColumn", bColumn);
@@ -406,73 +327,33 @@ VOID SvcFlagsEnableExtraIcons(BYTE bColumn, BOOLEAN bUpdateDB) { // Flags is on
if (gFlagsOpts.bShowExtraImgFlag) {
- //use ExtraIconsService ?
- if(myGlobals.ExtraIconsServiceExist) {
- if(hExtraIconSvc == INVALID_HANDLE_VALUE) {
- char szId[20];
- //get local langID for descIcon (try to use user local Flag as icon)
- DWORD langid = 0;
- int r = GetLocaleInfo(
- LOCALE_USER_DEFAULT,
- LOCALE_ICOUNTRY | LOCALE_RETURN_NUMBER ,
- (LPTSTR)&langid, sizeof(langid)/sizeof(TCHAR));
- if (!CallService(MS_UTILS_GETCOUNTRYBYNUMBER,langid,0)) langid = 1;
-
- EXTRAICON_INFO ico = {0};
- ico.cbSize = sizeof(ico);
- ico.type = EXTRAICON_TYPE_ICOLIB;
- ico.name = "Flags";
- ico.description = "Flags (uinfoex)";
- mir_snprintf(szId, SIZEOF(szId), (langid==0xFFFF)?"%s_0x%X":"%s_%i","flags",langid); /* buffer safe */
- ico.descIcon = szId;
- hExtraIconSvc=(HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0);
- if(hExtraIconSvc)
- hExtraIconSvcHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnExtraIconSvcChanged);
-
- }
- }
- //use Clist ExtraImageService
- else {
- if(phExtraImageList == NULL){
- phExtraImageList = (HANDLE*)mir_alloc(nCountriesCount*sizeof(HANDLE));
- /* invalidate icons */
- if(phExtraImageList!=NULL)
- for(int i=0;i<nCountriesCount;++i)
- phExtraImageList[i]=INVALID_HANDLE_VALUE;
- }
- if (!hRebuildIconsHook) {
- hRebuildIconsHook = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, OnCListRebuildIcons);
- }
+ if(hExtraIconSvc == INVALID_HANDLE_VALUE) {
+ char szId[20];
+ //get local langID for descIcon (try to use user local Flag as icon)
+ DWORD langid = 0;
+ int r = GetLocaleInfo(
+ LOCALE_USER_DEFAULT,
+ LOCALE_ICOUNTRY | LOCALE_RETURN_NUMBER ,
+ (LPTSTR)&langid, sizeof(langid)/sizeof(TCHAR));
+ if (!CallService(MS_UTILS_GETCOUNTRYBYNUMBER,langid,0)) langid = 1;
+
+ EXTRAICON_INFO ico = { sizeof(ico) };
+ ico.type = EXTRAICON_TYPE_ICOLIB;
+ ico.name = "Flags";
+ ico.description = "Flags (uinfoex)";
+ mir_snprintf(szId, SIZEOF(szId), (langid==0xFFFF)?"%s_0x%X":"%s_%i","flags",langid); /* buffer safe */
+ ico.descIcon = szId;
+ hExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0);
+ if(hExtraIconSvc)
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnExtraIconSvcChanged);
}
+
//init hooks
- if (!hApplyIconHook) {
- hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnCListApplyIcons);
- }
- if (!hSettingChangedHook) {
- hSettingChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged);
- }
- }
- // Flags is off
- else {
- //use ExtraIconsService ?
- if (myGlobals.ExtraIconsServiceExist) {
- //nothing to do, until plugin has a hookable event for status
- return;
- }
- //use Clist ExtraImageService
- //unhook
- if (hRebuildIconsHook) {
- UnhookEvent(hRebuildIconsHook); hRebuildIconsHook = NULL;
- }
- if (hApplyIconHook) {
- UnhookEvent(hApplyIconHook); hApplyIconHook = NULL;
- }
- if (hSettingChangedHook && !gFlagsOpts.bShowStatusIconFlag) {
- UnhookEvent(hSettingChangedHook); hSettingChangedHook = NULL;
- }
- //SvcFlagsApplyCListIcons();
- //RemoveExtraImages();
- CallFunctionBuffered(RemoveExtraImages,0,FALSE,EXTRAIMAGE_REFRESHDELAY);
+ if (!hApplyIconHook)
+ hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnCListApplyIcons);
+
+ if (!hSettingChangedHook)
+ hSettingChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged);
}
}
@@ -717,15 +598,10 @@ void SvcFlagsLoadModule() *
* @return nothing
**/
-void SvcFlagsOnModulesLoaded() {
- //use ExtraIconsService ?
- if ( myGlobals.ExtraIconsServiceExist) {
- SvcFlagsEnableExtraIcons(DB::Setting::GetByte(SET_CLIST_EXTRAICON_FLAGS2, 0), FALSE);
- }
- //use Clist ExtraImageService
- else {
- SvcFlagsEnableExtraIcons(gFlagsOpts.bShowExtraImgFlag? gFlagsOpts.idExtraColumn : -1, FALSE);
- }
+void SvcFlagsOnModulesLoaded()
+{
+ SvcFlagsEnableExtraIcons(DB::Setting::GetByte(SET_CLIST_EXTRAICON_FLAGS2, 0), FALSE);
+
/* Status Icon */
if(myGlobals.MsgAddIconExist)
hMsgWndEventHook = HookEvent(ME_MSG_WINDOWEVENT, OnMsgWndEvent);
@@ -744,7 +620,6 @@ void SvcFlagsUnloadModule() { UnhookEvent(hRebuildIconsHook);
UnhookEvent(hApplyIconHook);
UnhookEvent(hIconsChangedHook);
- UnhookEvent(hExtraIconSvcHook);
mir_free(phExtraImageList); /* does NULL check */
//Uninit message winsow
UnhookEvent(hMsgWndEventHook);
diff --git a/plugins/UserInfoEx/src/commonheaders.h b/plugins/UserInfoEx/src/commonheaders.h index fa820867fd..30597a9f48 100644 --- a/plugins/UserInfoEx/src/commonheaders.h +++ b/plugins/UserInfoEx/src/commonheaders.h @@ -160,7 +160,6 @@ typedef struct _MGLOBAL DWORD mirandaVersion; // mirandaVersion
BOOLEAN CanChangeDetails : 1; // is service to upload own contact information for icq present?
BOOLEAN HaveCListExtraIcons : 1; // are extra icons supported by current clist
- BOOLEAN ExtraIconsServiceExist : 1; // Extra Icon plugin / service exist
BOOLEAN MsgAddIconExist : 1; // Messsage Window support status Icon
BOOLEAN TzIndexExist : 1; // Win Reg has Timzone Index Info
BOOLEAN PopUpActionsExist : 1; // Popup++ or MS_POPUP_REGISTERACTIONS exist
diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index 876ed97fa3..73327f1cea 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -507,7 +507,6 @@ class CAnnivList EnableWindow(GetDlgItem(hDlg, EDIT_REMIND), checkState == BST_CHECKED);
EnableWindow(GetDlgItem(hDlg, SPIN_REMIND), checkState == BST_CHECKED);
- EnableWindow(GetDlgItem(hDlg, TXT_REMIND5), checkState == BST_CHECKED);
if (pid && pid->_wReminderState != checkState) {
pid->_wReminderState = checkState;
}
diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp index 6b321181fd..2762e67a32 100644 --- a/plugins/UserInfoEx/src/init.cpp +++ b/plugins/UserInfoEx/src/init.cpp @@ -103,10 +103,9 @@ static INT OnTopToolBarLoaded(WPARAM wParam, LPARAM lParam) **/
static INT OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- myGlobals.HaveCListExtraIcons = ServiceExists(MS_CLIST_EXTRA_SET_ICON);
- myGlobals.ExtraIconsServiceExist = ServiceExists(MS_EXTRAICON_REGISTER);
- myGlobals.PopUpActionsExist = ServiceExists(MS_POPUP_REGISTERACTIONS);
- myGlobals.MsgAddIconExist = ServiceExists(MS_MSG_ADDICON);
+ myGlobals.HaveCListExtraIcons = ServiceExists(MS_CLIST_EXTRA_SET_ICON);
+ myGlobals.PopUpActionsExist = ServiceExists(MS_POPUP_REGISTERACTIONS);
+ myGlobals.MsgAddIconExist = ServiceExists(MS_MSG_ADDICON);
// init meta contacts
INT_PTR ptr = CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index 5fbb32f94c..c8c9ada146 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -138,92 +138,6 @@ static VOID FORCEINLINE ComboBox_AddItemWithData(HWND hCombo, LPTSTR ptszText, L }
/**
- * This function fills a combobox with the advanced column names for clist extra icons.
- *
- * @param hCombo - the combobox's window handle
- *
- * @return nothing
- **/
-static VOID ComboBox_FillExtraIcons(HWND hCombo)
-{
- if (hCombo)
- {
- ComboBox_AddItemWithData(hCombo, LPGENT("<none>"), -1);
-
- /* check if Clist Nicer */
- if (ServiceExists("CListFrame/SetSkinnedFrame"))
- {
- const struct CComboList {
- INT nColumn;
- LPTSTR ptszName;
- } ExtraIcons[] = {
- { EXTRA_ICON_ADV1, LPGENT("Advanced #1 (ICQ X-Status)")},
- { EXTRA_ICON_ADV2, LPGENT("Advanced #2")},
- { EXTRA_ICON_ADV3, LPGENT("Advanced #3")},
- { EXTRA_ICON_ADV4, LPGENT("Advanced #4")},
- { EXTRA_ICON_RES0, LPGENT("Reserved, unused")},
- { EXTRA_ICON_RES1, LPGENT("Reserved #1")},
- { EXTRA_ICON_RES2, LPGENT("Reserved #2")},
- { EXTRA_ICON_CLIENT, LPGENT("Client (fingerprint required)")},
- };
-
- for (BYTE i = 0; i < SIZEOF(ExtraIcons); i++)
- {
- ComboBox_AddItemWithData(hCombo,
- TranslateTS(ExtraIcons[i].ptszName),
- ExtraIcons[i].nColumn );
- }
- }
- /* check if Clist modern*/
- else if (ServiceExists("CList/HideContactAvatar"))
- {
- const struct CComboList {
- INT nColumn;
- LPTSTR ptszName;
- } ExtraIcons[] = {
- { EXTRA_ICON_ADV1, LPGENT("Advanced #1")},
- { EXTRA_ICON_ADV2, LPGENT("Advanced #2")},
- { EXTRA_ICON_ADV3, LPGENT("Advanced #3")},
- { EXTRA_ICON_ADV4, LPGENT("Advanced #4")},
- { EXTRA_ICON_CLIENT, LPGENT("Client (fingerprint required)")},
- { EXTRA_ICON_PROTO, LPGENT("Protocol")},
- { EXTRA_ICON_VISMODE, LPGENT("Visibility/Chat activity")},
- };
-
- for (BYTE i = 0; i < SIZEOF(ExtraIcons); i++)
- {
- ComboBox_AddItemWithData(hCombo,
- TranslateTS(ExtraIcons[i].ptszName),
- ExtraIcons[i].nColumn );
- }
- }
- /*check if Clist MW*/
- else if (ServiceExists("CLUI/GetConnectingIconForProtocol"))
- {
- const struct CComboList {
- INT nColumn;
- LPTSTR ptszName;
- } ExtraIcons[] = {
- { EXTRA_ICON_ADV1, LPGENT("Advanced #1")},
- { EXTRA_ICON_ADV2, LPGENT("Advanced #2")},
- { EXTRA_ICON_ADV3, LPGENT("Advanced #3")},
- { EXTRA_ICON_ADV4, LPGENT("Advanced #4")},
- { EXTRA_ICON_CLIENT, LPGENT("Client (fingerprint required)")},
- { EXTRA_ICON_PROTO, LPGENT("Protocol Type")},
- };
-
- for (BYTE i = 0; i < SIZEOF(ExtraIcons); i++)
- {
- ComboBox_AddItemWithData(hCombo,
- TranslateTS(ExtraIcons[i].ptszName),
- ExtraIcons[i].nColumn );
- }
- }
- ComboBox_SetCurSel(hCombo, NULL);
- }
-}
-
-/**
* This function enables a dialog item
*
* @param hWnd - the dialog's window handle
@@ -435,9 +349,7 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, //enable control if myGlobals.ExtraIconsServiceExist else disable
const int idExtraIcons[] = {
GROUP_OPT_EXTRAICONS,
- TXT_OPT_GENDER, COMBO_OPT_GENDER,
- /*TXT_OPT_FLAGS,*/ COMBO_OPT_FLAGS,
-// CHECK_OPT_FLAGSUNKNOWN, CHECK_OPT_FLAGSMSGSTATUS,
+ TXT_OPT_GENDER,
TXT_OPT_DEFAULTICONS,
CHECK_OPT_HOMEPAGEICON, CHECK_OPT_PHONEICON, CHECK_OPT_EMAILICON,
CHECK_OPT_ZODIACAVATAR
@@ -450,20 +362,6 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, #else
ShowWindow(GetDlgItem(hDlg, CHECK_OPT_ZODIACAVATAR),SW_HIDE);
#endif
-
- // init extra icons options
- ShowWindow(GetDlgItem(hDlg, TXT_OPT_EXTRAICONS),myGlobals.ExtraIconsServiceExist?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hDlg, TXT_OPT_GENDER), myGlobals.ExtraIconsServiceExist?SW_HIDE:SW_SHOW);
- ShowWindow(GetDlgItem(hDlg, COMBO_OPT_GENDER), myGlobals.ExtraIconsServiceExist?SW_HIDE:SW_SHOW);
- ShowWindow(GetDlgItem(hDlg, CHECK_OPT_GENDER), myGlobals.ExtraIconsServiceExist?SW_SHOW:SW_HIDE);
- ShowWindow(GetDlgItem(hDlg, TXT_OPT_FLAGS), myGlobals.ExtraIconsServiceExist?SW_HIDE:SW_SHOW);
- ShowWindow(GetDlgItem(hDlg, COMBO_OPT_FLAGS), myGlobals.ExtraIconsServiceExist?SW_HIDE:SW_SHOW);
- if (InitialEnableControls(hDlg, idExtraIcons, SIZEOF(idExtraIcons), myGlobals.HaveCListExtraIcons) && !myGlobals.ExtraIconsServiceExist)
- {
- ComboBox_FillExtraIcons(GetDlgItem(hDlg, COMBO_OPT_GENDER));
- ComboBox_FillExtraIcons(GetDlgItem(hDlg, COMBO_OPT_FLAGS));
- }
-
SendNotify_InfoChanged(hDlg);
}
return TRUE;
@@ -489,20 +387,10 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, }
// extra icon settings
- if (!myGlobals.ExtraIconsServiceExist)
- {
- ComboBox_SetCurSelByItemDataPtr(GetDlgItem(hDlg, COMBO_OPT_GENDER),
- (LPARAM)DB::Setting::GetByte(SET_CLIST_EXTRAICON_GENDER, DEFVAL_CLIST_EXTRAICON_GENDER));
- ComboBox_SetCurSelByItemDataPtr(GetDlgItem(hDlg, COMBO_OPT_FLAGS),
- (LPARAM)DB::Setting::GetByte(MODNAMEFLAGS,"ExtraImgFlagColumn", SETTING_EXTRAIMGFLAGCOLUMN_DEFAULT));
- }
- else
- {
- DBGetCheckBtn(hDlg, CHECK_OPT_GENDER, SET_CLIST_EXTRAICON_GENDER2, 0);
- }
- DBGetCheckBtn (hDlg, CHECK_OPT_HOMEPAGEICON, SET_CLIST_EXTRAICON_HOMEPAGE, DEFVAL_CLIST_EXTRAICON_HOMEPAGE);
- DBGetCheckBtn (hDlg, CHECK_OPT_EMAILICON, SET_CLIST_EXTRAICON_EMAIL, DEFVAL_CLIST_EXTRAICON_EMAIL);
- DBGetCheckBtn (hDlg, CHECK_OPT_PHONEICON, SET_CLIST_EXTRAICON_PHONE, DEFVAL_CLIST_EXTRAICON_PHONE);
+ DBGetCheckBtn(hDlg, CHECK_OPT_GENDER, SET_CLIST_EXTRAICON_GENDER2, 0);
+ DBGetCheckBtn(hDlg, CHECK_OPT_HOMEPAGEICON, SET_CLIST_EXTRAICON_HOMEPAGE, DEFVAL_CLIST_EXTRAICON_HOMEPAGE);
+ DBGetCheckBtn(hDlg, CHECK_OPT_EMAILICON, SET_CLIST_EXTRAICON_EMAIL, DEFVAL_CLIST_EXTRAICON_EMAIL);
+ DBGetCheckBtn(hDlg, CHECK_OPT_PHONEICON, SET_CLIST_EXTRAICON_PHONE, DEFVAL_CLIST_EXTRAICON_PHONE);
CheckDlgButton(hDlg, CHECK_OPT_FLAGSUNKNOWN, gFlagsOpts.bUseUnknownFlag);
CheckDlgButton(hDlg, CHECK_OPT_FLAGSMSGSTATUS, gFlagsOpts.bShowStatusIconFlag);
@@ -546,32 +434,7 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, FlagsMsgWndChange++;
}
- if (!myGlobals.ExtraIconsServiceExist)
- {
- // Enable/Disable extra icon gender modules and write new values to database
- BYTE bOldColumn = DB::Setting::GetByte(SET_CLIST_EXTRAICON_GENDER, DEFVAL_CLIST_EXTRAICON_GENDER);
- BYTE bNewColumn = (BYTE)ComboBox_GetItemData(
- GetDlgItem(hDlg,COMBO_OPT_GENDER),
- SendDlgItemMessage(hDlg, COMBO_OPT_GENDER, CB_GETCURSEL, NULL, NULL));
- if (bOldColumn != bNewColumn) {
- ClearAllExtraIcons(bOldColumn);
- SvcGenderEnableExtraIcons(bNewColumn, TRUE);
- }
-
- // Enable/Disable extra icon Flags and write new values to database
- bNewColumn = (BYTE)ComboBox_GetItemData(
- GetDlgItem(hDlg,COMBO_OPT_FLAGS),
- SendDlgItemMessage(hDlg, COMBO_OPT_FLAGS, CB_GETCURSEL, NULL, NULL));
- if (gFlagsOpts.idExtraColumn != bNewColumn ||
- gFlagsOpts.bShowExtraImgFlag!=(bNewColumn!=((BYTE)-1))) {
- SvcFlagsEnableExtraIcons(bNewColumn, TRUE);
- FlagsClistChange++;
- }
- }
- else
- {
- SvcGenderEnableExtraIcons(IsDlgButtonChecked(hDlg, CHECK_OPT_GENDER)? 1:-1, TRUE);
- }
+ SvcGenderEnableExtraIcons(IsDlgButtonChecked(hDlg, CHECK_OPT_GENDER)? 1:-1, TRUE);
if(FlagsClistChange) EnsureExtraImages();
if(FlagsMsgWndChange) UpdateStatusIcons(NULL);
@@ -593,15 +456,6 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, {
switch (LOWORD(wParam))
{
- case COMBO_OPT_GENDER:
- case COMBO_OPT_FLAGS:
- {
- if (HIWORD(wParam) == CBN_SELCHANGE && bInitialized)
- {
- NotifyParentOfChange(hDlg);
- }
- }
- break;
case CHECK_OPT_MI_MAIN:
case CHECK_OPT_MI_CONTACT:
case CHECK_OPT_MI_GROUP:
@@ -900,8 +754,6 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam TranslateDialogDefault(hDlg);
- ShowWindow(GetDlgItem(hDlg, TXT_REMIND5), myGlobals.ExtraIconsServiceExist?SW_HIDE:SW_SHOW);
- ShowWindow(GetDlgItem(hDlg, EDIT_EXTRAICON), myGlobals.ExtraIconsServiceExist?SW_HIDE:SW_SHOW);
ShowWindow(GetDlgItem(hDlg, CHECK_REMIND_SECURED), myGlobals.UseDbxTree?SW_HIDE:SW_SHOW);
SendDlgItemMessage(hDlg, ICO_BIRTHDAY, STM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_DLG_ANNIVERSARY));
@@ -914,8 +766,6 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam SendDlgItemMessage(hDlg, EDIT_REMIND_SOUNDOFFSET, EM_LIMITTEXT, 2, 0);
SendDlgItemMessage(hDlg, SPIN_REMIND_SOUNDOFFSET, UDM_SETRANGE32, 0, 50);
- ComboBox_FillExtraIcons(GetDlgItem(hDlg, EDIT_EXTRAICON));
-
if (hCtrl = GetDlgItem(hDlg, EDIT_REMIND_ENABLED))
{
ComboBox_AddString(hCtrl, TranslateT("Reminder disabled"));
@@ -955,16 +805,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam SetDlgItemInt(hDlg, EDIT_REMIND, DB::Setting::GetWord(NULL, MODNAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), FALSE);
SetDlgItemInt(hDlg, EDIT_REMIND_SOUNDOFFSET, DB::Setting::GetByte(SET_REMIND_SOUNDOFFSET, DEFVAL_REMIND_SOUNDOFFSET), FALSE);
SetDlgItemInt(hDlg, EDIT_REMIND2, DB::Setting::GetWord(NULL, MODNAME, SET_REMIND_NOTIFYINTERVAL, DEFVAL_REMIND_NOTIFYINTERVAL), FALSE);
- if (!myGlobals.ExtraIconsServiceExist) {
- for (int i = 0; i < ComboBox_GetCount(GetDlgItem(hDlg, EDIT_EXTRAICON)); i++)
- {
- if ((BYTE)ComboBox_GetItemData(GetDlgItem(hDlg,EDIT_EXTRAICON),i) == DB::Setting::GetByte(SET_REMIND_EXTRAICON, 1))
- {
- SendDlgItemMessage(hDlg, EDIT_EXTRAICON, CB_SETCURSEL, i, NULL);
- break;
- }
- }
- }
+
SendDlgItemMessage(hDlg, EDIT_BIRTHMODULE, CB_SETCURSEL, DB::Setting::GetByte(SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE), NULL);
{
MTime mtLast;
@@ -983,7 +824,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam case PSN_APPLY:
{
- BYTE bColumn, bNewVal;
+ BYTE bNewVal;
BOOLEAN bReminderCheck = FALSE;
// save checkbox options
@@ -1014,18 +855,6 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam }
}
- // save new clist extra icon
- bColumn = DB::Setting::GetByte(SET_REMIND_EXTRAICON, 1);
- bNewVal = (BYTE)ComboBox_GetItemData(
- GetDlgItem(hDlg,EDIT_EXTRAICON),
- SendDlgItemMessage(hDlg, EDIT_EXTRAICON, CB_GETCURSEL, NULL, NULL));
- if (bColumn != bNewVal)
- {
- ClearAllExtraIcons(bColumn);
- DB::Setting::WriteByte(SET_REMIND_EXTRAICON, bNewVal);
- bReminderCheck = TRUE;
- }
-
// update current reminder state
bNewVal = (BYTE)SendDlgItemMessage(hDlg, EDIT_REMIND_ENABLED, CB_GETCURSEL, NULL, NULL);
if (DB::Setting::GetByte(SET_REMIND_ENABLED, 1) != bNewVal)
@@ -1033,7 +862,6 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam DB::Setting::WriteByte(SET_REMIND_ENABLED, bNewVal);
if (bNewVal == REMIND_OFF)
{
- ClearAllExtraIcons(bColumn);
SvcReminderEnable(FALSE);
bReminderCheck = FALSE;
}
@@ -1070,20 +898,12 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam EnableControls(hDlg, idCtrl, SIZEOF(idCtrl), bEnabled);
bEnabled &= myGlobals.HaveCListExtraIcons;
-
- EnableDlgItem(hDlg, TXT_REMIND5, bEnabled);
- EnableDlgItem(hDlg, EDIT_EXTRAICON, bEnabled);
}
}
- case EDIT_EXTRAICON:
case EDIT_BIRTHMODULE:
- {
- if (bInitialized && HIWORD(wParam) == CBN_SELCHANGE)
- {
- NotifyParentOfChange(hDlg);
- }
- }
+ if (bInitialized && HIWORD(wParam) == CBN_SELCHANGE)
+ NotifyParentOfChange(hDlg);
break;
case CHECK_REMIND_MI:
@@ -1091,12 +911,8 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam case CHECK_REMIND_VISIBLEONLY:
case CHECK_REMIND_STARTUP:
case CHECK_REMIND_SECURED:
- {
- if (bInitialized && HIWORD(wParam) == BN_CLICKED)
- {
- NotifyParentOfChange(hDlg);
- }
- }
+ if (bInitialized && HIWORD(wParam) == BN_CLICKED)
+ NotifyParentOfChange(hDlg);
break;
/*
diff --git a/plugins/UserInfoEx/src/resource.h b/plugins/UserInfoEx/src/resource.h index 1419fcc501..854031ebf5 100644 --- a/plugins/UserInfoEx/src/resource.h +++ b/plugins/UserInfoEx/src/resource.h @@ -71,7 +71,6 @@ #define TXT_NUMCONTACT 1124
#define TXT_NUMBIRTH 1125
#define TXT_REMIND4 1125
-#define TXT_REMIND5 1126
#define TXT_MESSAGE 1126
#define TXT_OPT_CLR_NORMAL 1127
#define TXT_REMIND6 1127
@@ -154,7 +153,6 @@ #define IDC_TREE 1504
#define IDC_COMBO1 1506
#define EDIT_SORT 1506
-#define EDIT_EXTRAICON 1506
#define EDIT_METASUBCONTACTS 1506
#define EDIT_HISTORY_GROUPING 1506
#define COMBO_VIEW 1506
@@ -201,8 +199,6 @@ #define CHECK_POPUP 1572
#define GROUP_FILTER 1573
#define GROUP_REMINDER 1574
-#define COMBO_OPT_GENDER 1575
-#define COMBO_OPT_FLAGS 1576
#define TXT_OPT_GENDER 1577
#define GROUP_OPT_EXTRAICONS 1578
#define TXT_OPT_DEFAULTICONS 1579
diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp index a581dfe2d2..27b7532551 100644 --- a/plugins/UserInfoEx/src/svc_email.cpp +++ b/plugins/UserInfoEx/src/svc_email.cpp @@ -137,14 +137,6 @@ static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam) * Event Handler functions
***********************************************************************************************************/
-static INT OnCListRebuildIcons(WPARAM wParam, LPARAM lParam)
-{
- HICON hIcon = IcoLib_GetIcon(ICO_BTN_EMAIL);
- ghExtraIconDef = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0);
- Skin_ReleaseIcon(hIcon);
- return 0;
-}
-
/**
* Notification handler for clist extra icons to be applied for a contact.
*
@@ -155,34 +147,12 @@ static INT OnCListApplyIcons(WPARAM wParam, LPARAM lParam) {
LPSTR val = Get((HANDLE)wParam);
- if (!myGlobals.ExtraIconsServiceExist)
- {
- IconExtraColumn iec;
-
- iec.cbSize = sizeof(IconExtraColumn);
- iec.ColumnType = EXTRA_ICON_EMAIL;
- if (val)
- {
- iec.hImage = ghExtraIconDef;
- mir_free(val);
- }
- else
- {
- iec.hImage = INVALID_HANDLE_VALUE;
- mir_free(val);
- }
- CallService(MS_CLIST_EXTRA_SET_ICON, wParam, (LPARAM)&iec);
- }
- else
- {
- EXTRAICON ico;
- ico.cbSize=sizeof(ico);
- ico.hContact=(HANDLE)wParam;
- ico.hExtraIcon=ghExtraIconSvc;
- ico.icoName=val?ICO_BTN_EMAIL:(char *)0;
- mir_free(val);
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
- }
+ EXTRAICON ico = { sizeof(ico) };
+ ico.hContact=(HANDLE)wParam;
+ ico.hExtraIcon=ghExtraIconSvc;
+ ico.icoName=val?ICO_BTN_EMAIL:(char *)0;
+ mir_free(val);
+ CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
return 0;
}
@@ -325,26 +295,15 @@ VOID SvcEMailEnableExtraIcons(BOOLEAN bEnable, BOOLEAN bUpdateDB) {
hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnCListApplyIcons);
}
- if (myGlobals.ExtraIconsServiceExist)
- {
- if (ghExtraIconSvc == INVALID_HANDLE_VALUE)
- {
- EXTRAICON_INFO ico;
-
- ZeroMemory(&ico, sizeof(ico));
- ico.cbSize = sizeof(ico);
- ico.type = EXTRAICON_TYPE_ICOLIB;
- ico.name = "email"; //must be the same as the group name in extraicon
- ico.description= "E-mail (uinfoex)";
- ico.descIcon = ICO_BTN_EMAIL;
- ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0);
- ZeroMemory(&ico,sizeof(ico));
- }
- }
- else if (hRebuildIconsHook == NULL)
- {
- hRebuildIconsHook = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, OnCListRebuildIcons);
- OnCListRebuildIcons(0, 0);
+
+ if (ghExtraIconSvc == INVALID_HANDLE_VALUE) {
+ EXTRAICON_INFO ico = { sizeof(ico) };
+ ico.type = EXTRAICON_TYPE_ICOLIB;
+ ico.name = "email"; //must be the same as the group name in extraicon
+ ico.description= "E-mail (uinfoex)";
+ ico.descIcon = ICO_BTN_EMAIL;
+ ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0);
+ ZeroMemory(&ico,sizeof(ico));
}
}
else // E-mail uncheckt
@@ -375,7 +334,6 @@ VOID SvcEMailEnableExtraIcons(BOOLEAN bEnable, BOOLEAN bUpdateDB) VOID SvcEMailOnModulesLoaded()
{
SvcEMailEnableExtraIcons(
- myGlobals.ExtraIconsServiceExist ||
DB::Setting::GetByte(SET_CLIST_EXTRAICON_EMAIL,
DEFVAL_CLIST_EXTRAICON_EMAIL), FALSE);
}
diff --git a/plugins/UserInfoEx/src/svc_gender.cpp b/plugins/UserInfoEx/src/svc_gender.cpp index e48ff7a22f..d8f542b374 100644 --- a/plugins/UserInfoEx/src/svc_gender.cpp +++ b/plugins/UserInfoEx/src/svc_gender.cpp @@ -71,35 +71,20 @@ BYTE GenderOf(HANDLE hContact) * Event Handler functions
***********************************************************************************************************/
-static INT OnCListRebuildIcons(WPARAM wParam, LPARAM lParam)
-{
- HICON hIcon = IcoLib_GetIcon(ICO_COMMON_FEMALE);
- ghExtraIconF = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0);
- Skin_ReleaseIcon(hIcon);
- hIcon = IcoLib_GetIcon(ICO_COMMON_MALE);
- ghExtraIconM = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0);
- Skin_ReleaseIcon(hIcon);
- return 0;
-}
-
/**
* Notification handler for clist extra icons to be applied for a contact.
*
* @param wParam - handle to the contact whose extra icon is to apply
* @param lParam - not used
**/
+
static INT OnCListApplyIcons(HANDLE hContact, LPARAM)
{
- if (myGlobals.ExtraIconsServiceExist && (ghExtraIconSvc != INVALID_HANDLE_VALUE))
- {
- EXTRAICON ico;
-
- ZeroMemory(&ico, sizeof(ico));
- ico.cbSize = sizeof(ico);
+ if (ghExtraIconSvc != INVALID_HANDLE_VALUE) {
+ EXTRAICON ico = { sizeof(ico) };
ico.hContact = hContact;
ico.hExtraIcon = ghExtraIconSvc;
- switch (GenderOf(hContact))
- {
+ switch (GenderOf(hContact)) {
case 'M':
ico.icoName = ICO_COMMON_MALE;
break;
@@ -111,28 +96,6 @@ static INT OnCListApplyIcons(HANDLE hContact, LPARAM) }
CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
}
- else
- {
- IconExtraColumn iec;
-
- iec.ColumnType = DB::Setting::GetByte(SET_CLIST_EXTRAICON_GENDER, DEFVAL_CLIST_EXTRAICON_GENDER);
- if ((BYTE)iec.ColumnType != -1)
- {
- iec.cbSize = sizeof(IconExtraColumn);
- switch (GenderOf(hContact))
- {
- case 'M':
- iec.hImage = ghExtraIconM;
- break;
- case 'F':
- iec.hImage = ghExtraIconF;
- break;
- default:
- iec.hImage = INVALID_HANDLE_VALUE;
- }
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
- }
- }
return 0;
}
@@ -184,51 +147,25 @@ VOID SvcGenderEnableExtraIcons(BYTE bColumn, BOOLEAN bUpdateDB) if (myGlobals.HaveCListExtraIcons)
{
if (bUpdateDB)
- {
- if (myGlobals.ExtraIconsServiceExist)
- {
- DB::Setting::WriteByte(SET_CLIST_EXTRAICON_GENDER2, bColumn);
- }
- else
- {
- DB::Setting::WriteByte(SET_CLIST_EXTRAICON_GENDER, bColumn);
- }
- }
+ DB::Setting::WriteByte(SET_CLIST_EXTRAICON_GENDER2, bColumn);
if (bEnable) // Gender checkt or dropdown select
{
- if (myGlobals.ExtraIconsServiceExist)
- {
- if (ghExtraIconSvc == INVALID_HANDLE_VALUE)
- {
- EXTRAICON_INFO ico;
-
- ZeroMemory(&ico, sizeof(ico));
- ico.cbSize = sizeof(ico);
- ico.type = EXTRAICON_TYPE_ICOLIB;
- ico.name = "gender"; //must be the same as the group name in extraicon
- ico.description="Gender (uinfoex)";
- ico.descIcon = ICO_COMMON_MALE;
- ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0);
- }
- }
- else
- {
- if (hRebuildIconsHook == NULL)
- {
- hRebuildIconsHook = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, OnCListRebuildIcons);
- OnCListRebuildIcons(0, 0);
- }
+ if (ghExtraIconSvc == INVALID_HANDLE_VALUE) {
+ EXTRAICON_INFO ico = { sizeof(ico) };
+ ico.type = EXTRAICON_TYPE_ICOLIB;
+ ico.name = "gender"; //must be the same as the group name in extraicon
+ ico.description="Gender (uinfoex)";
+ ico.descIcon = ICO_COMMON_MALE;
+ ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0);
}
+
// hook events
if (hChangedHook == NULL)
- {
hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged);
- }
+
if (hApplyIconHook == NULL)
- {
hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons);
- }
}
else
{
@@ -257,14 +194,7 @@ VOID SvcGenderEnableExtraIcons(BYTE bColumn, BOOLEAN bUpdateDB) **/
VOID SvcGenderLoadModule()
{
- if ( myGlobals.ExtraIconsServiceExist)
- {
- SvcGenderEnableExtraIcons(DB::Setting::GetByte(SET_CLIST_EXTRAICON_GENDER2, 0), FALSE);
- }
- else
- {
- SvcGenderEnableExtraIcons(DB::Setting::GetByte(SET_CLIST_EXTRAICON_GENDER, DEFVAL_CLIST_EXTRAICON_GENDER), FALSE);
- }
+ SvcGenderEnableExtraIcons(DB::Setting::GetByte(SET_CLIST_EXTRAICON_GENDER2, 0), FALSE);
}
/**
diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp index 77248960ac..cb9533ada2 100644 --- a/plugins/UserInfoEx/src/svc_homepage.cpp +++ b/plugins/UserInfoEx/src/svc_homepage.cpp @@ -100,14 +100,6 @@ static INT_PTR MenuCommand(WPARAM wParam, LPARAM lParam) * Event Handler functions
***********************************************************************************************************/
-static INT OnCListRebuildIcons(WPARAM wParam, LPARAM lParam)
-{
- HICON hIcon = IcoLib_GetIcon(ICO_BTN_GOTO);
- ghExtraIconDef = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0);
- Skin_ReleaseIcon(hIcon);
- return 0;
-}
-
/**
* Notification handler for clist extra icons to be applied for a contact.
*
@@ -117,28 +109,13 @@ static INT OnCListRebuildIcons(WPARAM wParam, LPARAM lParam) static INT OnCListApplyIcons(HANDLE hContact, LPARAM)
{
LPSTR val = Get(hContact);
-
- if (myGlobals.ExtraIconsServiceExist && (ghExtraIconSvc != INVALID_HANDLE_VALUE))
- {
- EXTRAICON ico;
-
- ZeroMemory(&ico, sizeof(ico));
- ico.cbSize = sizeof(ico);
+ if (ghExtraIconSvc != INVALID_HANDLE_VALUE) {
+ EXTRAICON ico = { sizeof(ico) };
ico.hContact = hContact;
ico.hExtraIcon = ghExtraIconSvc;
ico.icoName = (val) ? ICO_BTN_GOTO : NULL;
CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
}
- else
- {
- IconExtraColumn iec;
-
- ZeroMemory(&iec, sizeof(iec));
- iec.cbSize = sizeof(IconExtraColumn);
- iec.ColumnType = EXTRA_ICON_WEB;
- iec.hImage = (val) ? ghExtraIconDef : INVALID_HANDLE_VALUE;
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
- }
MIR_FREE(val);
return 0;
}
@@ -257,32 +234,18 @@ VOID SvcHomepageEnableExtraIcons(BOOLEAN bEnable, BOOLEAN bUpdateDB) {
// hook events
if (hChangedHook == NULL)
- {
hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged);
- }
+
if (hApplyIconHook == NULL)
- {
hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons);
- }
- if (myGlobals.ExtraIconsServiceExist)
- {
- if (ghExtraIconSvc == INVALID_HANDLE_VALUE)
- {
- EXTRAICON_INFO ico;
-
- ZeroMemory(&ico, sizeof(ico));
- ico.cbSize = sizeof(ico);
- ico.type = EXTRAICON_TYPE_ICOLIB;
- ico.name = "homepage"; //must be the same as the group name in extraicon
- ico.description = "Homepage (uinfoex)";
- ico.descIcon = ICO_BTN_GOTO;
- ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0);
- }
- }
- else if (hRebuildIconsHook == NULL)
- {
- hRebuildIconsHook = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, OnCListRebuildIcons);
- OnCListRebuildIcons(0, 0);
+
+ if (ghExtraIconSvc == INVALID_HANDLE_VALUE) {
+ EXTRAICON_INFO ico = { sizeof(ico) };
+ ico.type = EXTRAICON_TYPE_ICOLIB;
+ ico.name = "homepage"; //must be the same as the group name in extraicon
+ ico.description = "Homepage (uinfoex)";
+ ico.descIcon = ICO_BTN_GOTO;
+ ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0);
}
}
else
@@ -317,7 +280,6 @@ VOID SvcHomepageLoadModule() {
CreateServiceFunction(MS_USERINFO_HOMEPAGE_OPENURL, MenuCommand);
SvcHomepageEnableExtraIcons(
- myGlobals.ExtraIconsServiceExist ||
DB::Setting::GetByte(SET_CLIST_EXTRAICON_HOMEPAGE, DEFVAL_CLIST_EXTRAICON_HOMEPAGE), FALSE);
}
diff --git a/plugins/UserInfoEx/src/svc_phone.cpp b/plugins/UserInfoEx/src/svc_phone.cpp index 05d1e8f821..7ccdc576b4 100644 --- a/plugins/UserInfoEx/src/svc_phone.cpp +++ b/plugins/UserInfoEx/src/svc_phone.cpp @@ -93,80 +93,29 @@ static INT_PTR Get(HANDLE hContact) * Event Handler functions
***********************************************************************************************************/
-static INT OnCListRebuildIcons(WPARAM wParam, LPARAM lParam)
-{
- HICON hIcon = IcoLib_GetIcon(ICO_BTN_PHONE);
- ghExtraIconDef[0] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0);
- Skin_ReleaseIcon(hIcon);
- hIcon = IcoLib_GetIcon(ICO_BTN_CELLULAR);
- ghExtraIconDef[1] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0);
- Skin_ReleaseIcon(hIcon);
- return 0;
-}
-
/**
* Notification handler for clist extra icons to be applied for a contact.
*
* @param wParam - handle to the contact whose extra icon is to apply
* @param lParam - not used
**/
+
static INT OnCListApplyIcons(HANDLE hContact, LPARAM)
{
- if (!myGlobals.ExtraIconsServiceExist)
- {
- IconExtraColumn iec;
- iec.cbSize = sizeof(IconExtraColumn);
- iec.ColumnType = EXTRA_ICON_SMS;
- switch (Get(hContact))
- {
- case PHONE_NORMAL:
- {
- iec.hImage = ghExtraIconDef[0];
- }
- break;
-
- case PHONE_SMS:
- {
- iec.hImage = ghExtraIconDef[1];
- }
- break;
-
- default:
- {
- iec.hImage = INVALID_HANDLE_VALUE;
- }
- }
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
- }
- else
- {
- EXTRAICON ico;
-
- ZeroMemory(&ico, sizeof(ico));
- ico.cbSize = sizeof(ico);
- ico.hContact = hContact;
- ico.hExtraIcon = ghExtraIconSvc;
- switch (Get(hContact))
- {
- case PHONE_NORMAL:
- {
- ico.icoName = ICO_BTN_PHONE;
- }
- break;
-
- case PHONE_SMS:
- {
- ico.icoName = ICO_BTN_CELLULAR;
- }
- break;
-
- default:
- {
- ico.icoName = (char *)0;
- }
- }
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
+ EXTRAICON ico = { sizeof(ico) };
+ ico.hContact = hContact;
+ ico.hExtraIcon = ghExtraIconSvc;
+ switch (Get(hContact)) {
+ case PHONE_NORMAL:
+ ico.icoName = ICO_BTN_PHONE;
+ break;
+ case PHONE_SMS:
+ ico.icoName = ICO_BTN_CELLULAR;
+ break;
+ default:
+ ico.icoName = NULL;
}
+ CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
return 0;
}
@@ -232,32 +181,18 @@ VOID SvcPhoneEnableExtraIcons(BOOLEAN bEnable, BOOLEAN bUpdateDB) {
// hook events
if (hChangedHook == NULL)
- {
hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged);
- }
+
if (hApplyIconHook == NULL)
- {
hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons);
- }
- if (myGlobals.ExtraIconsServiceExist)
- {
- if (ghExtraIconSvc == INVALID_HANDLE_VALUE)
- {
- EXTRAICON_INFO ico;
-
- ZeroMemory(&ico, sizeof(ico));
- ico.cbSize = sizeof(ico);
- ico.type = EXTRAICON_TYPE_ICOLIB;
- ico.name = "sms"; //must be the same as the group name in extraicon
- ico.description = "(uinfoex)";
- ico.descIcon = ICO_BTN_CELLULAR;
- ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0);
- }
- }
- else if (hRebuildIconsHook == NULL)
- {
- hRebuildIconsHook = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, (MIRANDAHOOK)OnCListRebuildIcons);
- OnCListRebuildIcons(0, 0);
+
+ if (ghExtraIconSvc == INVALID_HANDLE_VALUE) {
+ EXTRAICON_INFO ico = { sizeof(ico) };
+ ico.type = EXTRAICON_TYPE_ICOLIB;
+ ico.name = "sms"; //must be the same as the group name in extraicon
+ ico.description = "(uinfoex)";
+ ico.descIcon = ICO_BTN_CELLULAR;
+ ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0);
}
}
else
@@ -288,7 +223,6 @@ VOID SvcPhoneEnableExtraIcons(BOOLEAN bEnable, BOOLEAN bUpdateDB) VOID SvcPhoneLoadModule()
{
SvcPhoneEnableExtraIcons(
- myGlobals.ExtraIconsServiceExist ||
DB::Setting::GetByte(SET_CLIST_EXTRAICON_PHONE, DEFVAL_CLIST_EXTRAICON_PHONE), FALSE);
}
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index c26e2027e6..bfde666a9b 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -268,58 +268,32 @@ static HANDLE GetCListExtraIcon(const CEvent &evt) **/
static VOID NotifyWithExtraIcon(HANDLE hContact, const CEvent &evt)
{
- if (myGlobals.HaveCListExtraIcons && gRemindOpts.bCListExtraIcon)
- {
- if (!myGlobals.ExtraIconsServiceExist)
- {
- IconExtraColumn iec;
+ if (gRemindOpts.bCListExtraIcon) {
+ CHAR szIcon[MAXSETTING];
- iec.cbSize = sizeof(IconExtraColumn);
- iec.ColumnType = gRemindOpts.bCListExtraIcon;
- iec.hImage = GetCListExtraIcon(evt);
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
- }
- else
- {
- CHAR szIcon[MAXSETTING];
- EXTRAICON ico;
+ EXTRAICON ico = { sizeof(ico) };
+ ico.hContact = hContact;
+ ico.hExtraIcon = ExtraIcon;
+ switch (evt._eType) {
+ case CEvent::BIRTHDAY:
+ if (evt._wDaysLeft > 9)
+ ico.icoName = ICO_RMD_DTAX;
+ else {
+ mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dtb%u", evt._wDaysLeft);
+ ico.icoName = szIcon;
+ }
+ break;
- ico.cbSize=sizeof(ico);
- ico.hContact=hContact;
- ico.hExtraIcon=ExtraIcon;
- switch (evt._eType)
- {
- case CEvent::BIRTHDAY:
- {
- if (evt._wDaysLeft > 9)
- {
- ico.icoName=ICO_RMD_DTAX;
- }
- else
- {
- mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dtb%u", evt._wDaysLeft);
- ico.icoName=szIcon;
- }
- break;
- }
- case CEvent::ANNIVERSARY:
- {
- if (evt._wDaysLeft > 9)
- {
- ico.icoName=ICO_RMD_DTAX;
- }
- else
- {
- mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dta%u", evt._wDaysLeft);
- ico.icoName=szIcon;
- }
- break;
- }
- default:
- ico.icoName=(char *)0;
+ case CEvent::ANNIVERSARY:
+ if (evt._wDaysLeft > 9)
+ ico.icoName = ICO_RMD_DTAX;
+ else {
+ mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dta%u", evt._wDaysLeft);
+ ico.icoName = szIcon;
}
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
+ break;
}
+ CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
}
}
@@ -1081,15 +1055,13 @@ VOID SvcReminderEnable(BOOLEAN bEnable) {
if (bEnable) // Reminder is on
{
- if (myGlobals.ExtraIconsServiceExist && (ExtraIcon == INVALID_HANDLE_VALUE))
- {
- EXTRAICON_INFO ico = {0};
+ if (ExtraIcon == INVALID_HANDLE_VALUE) {
+ EXTRAICON_INFO ico = { sizeof(ico) };
ico.type = EXTRAICON_TYPE_ICOLIB;
- ico.cbSize=sizeof(ico);
- ico.name="Reminder";
- ico.description="Reminder (uinfoex)";
- ico.descIcon=ICO_COMMON_ANNIVERSARY;
- ExtraIcon=(HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0);
+ ico.name = "Reminder";
+ ico.description = "Reminder (uinfoex)";
+ ico.descIcon = ICO_COMMON_ANNIVERSARY;
+ ExtraIcon = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0);
ZeroMemory(&ico,sizeof(ico));
}
// init hooks
|