diff options
Diffstat (limited to 'buddyexpectator')
28 files changed, 3947 insertions, 0 deletions
diff --git a/buddyexpectator/BuddyExpectator.cpp b/buddyexpectator/BuddyExpectator.cpp new file mode 100644 index 0000000..bd0a9c5 --- /dev/null +++ b/buddyexpectator/BuddyExpectator.cpp @@ -0,0 +1,968 @@ +/*
+ Buddy Expectator+ plugin for Miranda-IM (www.miranda-im.org)
+ (c)2005 Anar Ibragimoff (ai91@mail.ru)
+ (c)2006 Scott Ellis (mail@scottellis.com.au)
+ (c)2007,2008 Alexander Turyak (thief@miranda-im.org.ua)
+
+ 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: http://svn.miranda.im/mainrepo/buddyexpectator/trunk/BuddyExpectator.cpp $
+ Revision : $Rev: 1392 $
+ Last change on : $Date: 2009-04-22 17:46:08 +0300 (Ср, 22 апр 2009) $
+ Last change by : $Author: Thief $
+*/
+
+#include "common.h"
+#include "options.h"
+
+HINSTANCE hInst;
+PLUGINLINK *pluginLink;
+
+DWORD timer_id = 0;
+
+HANDLE hEventContactSetting = NULL;
+HANDLE hEventContactAdded = NULL;
+HANDLE hEventUserInfoInit = NULL;
+HANDLE hPrebuildContactMenu = NULL;
+HANDLE hContactMenu = NULL;
+HANDLE hIcoLibIconsChanged = NULL;
+HANDLE hContactReturnedAction = NULL;
+HANDLE hContactStillAbsentAction = NULL;
+HANDLE hMissYouAction = NULL;
+HANDLE hMenuMissYouClick = NULL;
+HANDLE hModulesLoaded = NULL;
+HANDLE hModulesLoaded2 = NULL;
+HANDLE hSystemOKToExit = NULL;
+HANDLE hHookExtraIconsRebuild = NULL;
+HANDLE hHookExtraIconsApply = NULL;
+
+HICON hIcon;
+HANDLE hEnabledIcon = NULL, hDisabledIcon = NULL;
+
+IconExtraColumn g_IECMissYou = {0};
+IconExtraColumn g_IECClear = {0};
+
+// Popup Actions
+POPUPACTION missyouactions[1];
+POPUPACTION hideactions[2];
+
+extern int UserinfoInit(WPARAM wparam, LPARAM lparam);
+
+PLUGININFOEX pluginInfo = {
+ sizeof(PLUGININFOEX),
+ "Buddy Expectator+",
+ PLUGIN_MAKE_VERSION(0,1,2,3),
+ "Reacts to the return of contacts, or the the extended absence of contacts, with notifications and other actions",
+ "Anar Ibragimoff, sje, Thief",
+ "thief@miranda.im",
+ " 2005 Anar Ibragimoff, 2006 Scott Ellis, 2007-2009 Alexander Turyak",
+ "http://thief.miranda.im",
+ 0,
+ 0,
+ {0xddf8aec9, 0x7d37, 0x49af, {0x9d, 0x22, 0xbb, 0xbc, 0x92, 0x0e, 0x6f, 0x05}} //{DDF8AEC9-7D37-49AF-9D22-BBBC920E6F05}
+};
+
+PLUGININFO oldpluginInfo = {
+ sizeof(PLUGININFO),
+ pluginInfo.shortName,
+ pluginInfo.version,
+ pluginInfo.description,
+ pluginInfo.author,
+ pluginInfo.authorEmail,
+ pluginInfo.copyright,
+ pluginInfo.homepage,
+ pluginInfo.flags,
+ pluginInfo.replacesDefaultModule
+};
+
+/* 2D84F403-91F3-4E60-BF02-16C2F1716D86 */
+#define MIID_BUDDYEXPECTATOR {0x2d84f403, 0x91f3, 0x4e60, {0xbf, 0x02, 0x16, 0xc2, 0xf1, 0x71, 0x6d, 0x86}}
+
+extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
+{
+ static const MUUID interfaces[] = {MIID_BUDDYEXPECTATOR, MIID_LAST};
+ return interfaces;
+}
+
+extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+{
+ hInst = hinstDLL;
+ return TRUE;
+}
+
+time_t getLastSeen(HANDLE hContact)
+{
+ return DBGetContactSettingDword(hContact, MODULE_NAME, "LastSeen", DBGetContactSettingDword(hContact, MODULE_NAME, "CreationTime", (DWORD)-1));
+}
+
+void setLastSeen(HANDLE hContact)
+{
+ DBWriteContactSettingDword(hContact, MODULE_NAME, "LastSeen", (DWORD)time(NULL));
+ if (DBGetContactSettingByte(hContact, MODULE_NAME, "StillAbsentNotified", 0))
+ DBWriteContactSettingByte(hContact, MODULE_NAME, "StillAbsentNotified", 0);
+}
+
+time_t getLastInputMsg(HANDLE hContact)
+{
+ HANDLE hDbEvent;
+ DBEVENTINFO dbei = {0};
+
+ hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hContact, 0);
+ while (hDbEvent)
+ {
+ dbei.cbSize = sizeof(dbei);
+ dbei.pBlob = 0;
+ dbei.cbBlob = 0;
+ CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
+ if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT))
+ return dbei.timestamp;
+ hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDPREV, (WPARAM)hDbEvent, 0);
+ }
+ return -1;
+}
+
+/**
+ * PopUp window procedures
+ */
+
+int CALLBACK HidePopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch (message)
+ {
+ case WM_COMMAND:
+ if (HIWORD(wParam) == STN_CLICKED)
+ {
+ DBWriteContactSettingByte(PUGetContact(hWnd), "CList", "Hidden", 1);
+ PUDeletePopUp(hWnd);
+ }
+ break;
+ case WM_CONTEXTMENU:
+ DBWriteContactSettingByte(PUGetContact(hWnd), MODULE_NAME, "NeverHide", 1);
+ PUDeletePopUp(hWnd);
+ break;
+ case UM_POPUPACTION:
+ if (wParam == 2)
+ {
+ DBWriteContactSettingByte(PUGetContact(hWnd), "CList", "Hidden", 1);
+ PUDeletePopUp(hWnd);
+ }
+ if (wParam == 3)
+ {
+ DBWriteContactSettingByte(PUGetContact(hWnd), MODULE_NAME, "NeverHide", 1);
+ PUDeletePopUp(hWnd);
+ }
+ break;
+ case UM_FREEPLUGINDATA:
+ return TRUE;
+ default:
+ break;
+ }
+ return DefWindowProc(hWnd, message, wParam, lParam);
+}
+
+int CALLBACK MissYouPopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch (message)
+ {
+ case WM_COMMAND:
+ if (HIWORD(wParam) == STN_CLICKED)
+ {
+ CallServiceSync("BuddyExpectator/actionMissYou", (WPARAM)PUGetContact(hWnd), 0);
+ if (!DBGetContactSettingByte(PUGetContact(hWnd), MODULE_NAME, "MissYouNotifyAlways", 0))
+ {
+ DBWriteContactSettingByte(PUGetContact(hWnd), MODULE_NAME, "MissYou", 0);
+ if (options.MissYouIcon) CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) PUGetContact(hWnd), (LPARAM) &g_IECClear);
+ }
+ PUDeletePopUp(hWnd);
+ }
+ break;
+ case WM_CONTEXTMENU:
+ PUDeletePopUp(hWnd);
+ break;
+ case UM_POPUPACTION:
+ if (wParam == 1)
+ {
+ DBWriteContactSettingByte(PUGetContact(hWnd), MODULE_NAME, "MissYou", 0);
+ if (options.MissYouIcon) CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) PUGetContact(hWnd), (LPARAM) &g_IECClear);
+ PUDeletePopUp(hWnd);
+ }
+ break;
+ case UM_FREEPLUGINDATA:
+ return TRUE;
+ default:
+ break;
+ }
+ return DefWindowProc(hWnd, message, wParam, lParam);
+}
+
+int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch (message)
+ {
+ case WM_COMMAND:
+ if (HIWORD(wParam) == STN_CLICKED)
+ {
+ CallServiceSync(MS_CLIST_REMOVEEVENT, (WPARAM)PUGetContact(hWnd), 0);
+ CallServiceSync("BuddyExpectator/actionReturned", (WPARAM)PUGetContact(hWnd), 0);
+ PUDeletePopUp(hWnd);
+ }
+ break;
+ case WM_CONTEXTMENU:
+ CallServiceSync(MS_CLIST_REMOVEEVENT, (WPARAM)PUGetContact(hWnd), 0);
+ setLastSeen(PUGetContact(hWnd));
+ PUDeletePopUp(hWnd);
+ break;
+ case UM_FREEPLUGINDATA:
+ if (options.iShowEvent == 0)
+ {
+ setLastSeen(PUGetContact(hWnd));
+ }
+ return TRUE;
+ default:
+ break;
+ }
+ return DefWindowProc(hWnd, message, wParam, lParam);
+}
+
+int CALLBACK PopupDlgProcNoSet(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch (message)
+ {
+ case WM_COMMAND:
+ if (HIWORD(wParam) == STN_CLICKED)
+ {
+ CallServiceSync(MS_CLIST_REMOVEEVENT, (WPARAM)PUGetContact(hWnd), 0);
+ CallServiceSync("BuddyExpectator/actionStillAbsent", (WPARAM)PUGetContact(hWnd), 0);
+ PUDeletePopUp(hWnd);
+ }
+ break;
+ case WM_CONTEXTMENU:
+ CallServiceSync(MS_CLIST_REMOVEEVENT, (WPARAM)PUGetContact(hWnd), 0);
+ PUDeletePopUp(hWnd);
+ break;
+ case UM_FREEPLUGINDATA:
+ return TRUE;
+ default:
+ break;
+ }
+ return DefWindowProc(hWnd, message, wParam, lParam);
+}
+
+/**
+ * Checks - whether user has been gone for specified number of days
+ */
+bool isContactGoneFor(HANDLE hContact, int days)
+{
+ time_t lastSeen = getLastSeen(hContact);
+ time_t lastInputMsg = getLastInputMsg(hContact);
+ time_t currentTime = time(NULL);
+
+ int daysSinceOnline = -1;
+ if (lastSeen != -1) daysSinceOnline = (int)((currentTime - lastSeen)/(60*60*24));
+
+ int daysSinceMessage = -1;
+ if (lastInputMsg != -1) daysSinceMessage = (int)((currentTime - lastInputMsg)/(60*60*24));
+
+ if (options.hideInactive)
+ {
+ if (daysSinceMessage >= options.iSilencePeriod)
+ if (!DBGetContactSettingByte(hContact, "CList", "Hidden", 0) && !DBGetContactSettingByte(hContact, MODULE_NAME, "NeverHide", 0))
+ {
+ char szInfo[200];
+
+ POPUPDATAEX ppd = {0};
+ ppd.cbSize = sizeof(POPUPDATAEX);
+
+ ppd.lchContact = hContact;
+ ppd.lchIcon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"enabled_icon");
+
+ mir_snprintf(szInfo, 200, Translate("Hiding %s (%s)"), (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0), (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0));
+ strncpy(ppd.lpzContactName, szInfo, MAX_CONTACTNAME);
+ mir_snprintf(szInfo, 200, Translate("%d days since last message"), daysSinceMessage);
+ strncpy(ppd.lpzText, szInfo, MAX_SECONDLINE);
+ if (!options.iUsePopupColors)
+ {
+ ppd.colorBack = options.iPopUpColorBack;
+ ppd.colorText = options.iPopUpColorFore;
+ }
+ ppd.PluginWindowProc = (WNDPROC)HidePopupDlgProc;
+ ppd.PluginData = NULL;
+ ppd.iSeconds = -1;
+
+ hideactions[0].flags = hideactions[1].flags = PAF_ENABLED;
+ ppd.lpActions = hideactions;
+ ppd.actionCount = 2;
+
+ CallService(MS_POPUP_ADDPOPUPEX, (WPARAM) &ppd, APF_NEWDATA);
+
+ SkinPlaySound("buddyExpectatorHide");
+ }
+ }
+
+ return (daysSinceOnline >= days && (daysSinceMessage == -1 || daysSinceMessage >= days));
+}
+
+void ReturnNotify(HANDLE hContact, char *message)
+{
+ if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 1 || DBGetContactSettingByte(hContact, "CList", "Hidden", 0) == 1)
+ return;
+
+ SkinPlaySound("buddyExpectatorReturn");
+
+ if (options.iShowPopUp > 0)
+ {
+ // Display PopUp
+ POPUPDATAEX ppd = {0};
+ ppd.cbSize = sizeof(POPUPDATAEX);
+
+ ppd.lchContact = hContact;
+ ppd.lchIcon = hIcon;
+ strncpy(ppd.lpzContactName, (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0), MAX_CONTACTNAME);
+ strncpy(ppd.lpzText, message, MAX_SECONDLINE);
+ if (!options.iUsePopupColors)
+ {
+ ppd.colorBack = options.iPopUpColorBack;
+ ppd.colorText = options.iPopUpColorFore;
+ }
+ ppd.PluginWindowProc = (WNDPROC)PopupDlgProc;
+ ppd.PluginData = NULL;
+ ppd.iSeconds = options.iPopUpDelay;
+
+ CallService(MS_POPUP_ADDPOPUPEX, (WPARAM) &ppd, 0);
+
+ }
+
+ if (options.iShowEvent > 0)
+ {
+ CLISTEVENT cle = {0};
+
+ cle.cbSize = sizeof(cle);
+ cle.hContact = hContact;
+ cle.hIcon = hIcon;
+ cle.pszService = (char *)"BuddyExpectator/actionReturned";
+
+ char* nick = (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0);
+ char tmpMsg[512];
+ mir_snprintf(tmpMsg, 512, "%s %s", nick, message);
+ cle.pszTooltip = tmpMsg;
+
+ CallServiceSync(MS_CLIST_ADDEVENT, 0, (LPARAM) &cle);
+ }
+}
+
+void GoneNotify(HANDLE hContact, char *message)
+{
+ if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 1 || DBGetContactSettingByte(hContact, "CList", "Hidden", 0) == 1)
+ return;
+
+ if (options.iShowPopUp2 > 0)
+ {
+ // Display PopUp
+ POPUPDATAEX ppd = {0};
+ ppd.cbSize = sizeof(POPUPDATAEX);
+
+ ppd.lchContact = hContact;
+ ppd.lchIcon = hIcon;
+ strncpy(ppd.lpzContactName, (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0), MAX_CONTACTNAME);
+ strncpy(ppd.lpzText, message, MAX_SECONDLINE);
+ if (!options.iUsePopupColors)
+ {
+ ppd.colorBack = options.iPopUpColorBack;
+ ppd.colorText = options.iPopUpColorFore;
+ }
+ ppd.PluginWindowProc = (WNDPROC)PopupDlgProcNoSet;
+ ppd.PluginData = NULL;
+ ppd.iSeconds = options.iPopUpDelay;
+
+ CallService(MS_POPUP_ADDPOPUPEX, (WPARAM) &ppd, 0);
+ }
+
+ if (options.iShowEvent2 > 0)
+ {
+ CLISTEVENT cle = {0};
+
+ cle.cbSize = sizeof(cle);
+ cle.hContact = hContact;
+ cle.hIcon = hIcon;
+ cle.pszService = (char *)"BuddyExpectator/actionStillAbsent";
+
+ char* nick = (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0);
+ char tmpMsg[512];
+ mir_snprintf(tmpMsg, 512, "%s %s", nick, message);
+ cle.pszTooltip = tmpMsg;
+
+ CallServiceSync(MS_CLIST_ADDEVENT, 0, (LPARAM) &cle);
+ }
+}
+
+/**
+ * Miss you action (clist event click)
+ * when called from popup, wParam = (HANDLE)hContact and lParam == 0,
+ * when called from clist event, wParam = hWndCList, lParam = &CLISTEVENT
+ */
+int MissYouAction(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact;
+ if (lParam)
+ {
+ CLISTEVENT* cle = (CLISTEVENT*)lParam;
+ hContact = cle->hContact;
+ } else
+ hContact = (HANDLE)wParam;
+
+ CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
+
+ return 0;
+}
+
+/**
+ * Contact returned action (clist event click)
+ * when called from popup, wParam = (HANDLE)hContact and lParam == 0,
+ * when called from clist event, wParam = hWndCList, lParam = &CLISTEVENT
+ */
+int ContactReturnedAction(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact;
+ if (lParam)
+ {
+ CLISTEVENT* cle = (CLISTEVENT*)lParam;
+ hContact = cle->hContact;
+ } else
+ hContact = (HANDLE)wParam;
+
+ if (options.iShowMessageWindow>0)
+ {
+ CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
+ }
+
+ if (options.iShowUDetails>0)
+ {
+ CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0);
+ }
+
+ setLastSeen(hContact);
+
+ return 0;
+}
+
+/**
+ * Contact not returned action (clist event click)
+ * when called from popup, wParam = (HANDLE)hContact and lParam == 0,
+ * when called from clist event, wParam = hWndCList, lParam = &CLISTEVENT
+ */
+int ContactStillAbsentAction(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact;
+ if (lParam)
+ {
+ CLISTEVENT* cle = (CLISTEVENT*)lParam;
+ hContact = cle->hContact;
+ } else
+ hContact = (HANDLE)wParam;
+
+ switch (options.action2)
+ {
+ case GCA_DELETE:
+ CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
+ break;
+ case GCA_UDETAILS:
+ CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0);
+ break;
+ case GCA_MESSAGE:
+ CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
+ break;
+ case GCA_NOACTION:
+ break;
+ }
+
+ return 0;
+}
+
+/**
+ * Load icons either from icolib or built in
+ */
+int onIconsChanged(WPARAM wParam, LPARAM lParam)
+{
+ if (ServiceExists(MS_SKIN2_ADDICON))
+ {
+ hIcon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"main_icon");
+ }
+ else
+ {
+ hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MAINICON), IMAGE_ICON, 16, 16, 0);
+ }
+
+ return 0;
+}
+
+/**
+ * Menu item click action
+ */
+int MenuMissYouClick(WPARAM wParam, LPARAM lParam)
+{
+ if (DBGetContactSettingByte((HANDLE)wParam, MODULE_NAME, "MissYou", 0))
+ {
+ DBWriteContactSettingByte((HANDLE)wParam, MODULE_NAME, "MissYou", 0);
+ if (options.MissYouIcon) CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) wParam, (LPARAM) &g_IECClear);
+ }
+ else
+ {
+ DBWriteContactSettingByte((HANDLE)wParam, MODULE_NAME, "MissYou", 1);
+ if (options.MissYouIcon) CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) wParam, (LPARAM) &g_IECMissYou);
+ }
+
+ return 0;
+}
+
+/**
+ * Menu is about to appear
+ */
+int onPrebuildContactMenu(WPARAM wParam, LPARAM lParam)
+{
+ char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ if (!proto) return 0;
+
+ CLISTMENUITEM mi = {0};
+ mi.cbSize = sizeof(CLISTMENUITEM);
+
+ if (DBGetContactSettingByte((HANDLE)wParam, proto, "ChatRoom", 0) || !(CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
+ mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
+ else
+ mi.flags = CMIM_FLAGS;
+
+ if (DBGetContactSettingByte((HANDLE)wParam, MODULE_NAME, "MissYou", 0))
+ {
+ mi.flags |= CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB;
+ mi.pszName = Translate("Disable Miss You");
+ mi.icolibItem = hEnabledIcon;
+ }
+ else
+ {
+ mi.flags |= CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB;
+ mi.pszName = Translate("Enable Miss You");
+ mi.icolibItem = hDisabledIcon;
+ }
+
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenu, (LPARAM)&mi);
+
+ return 0;
+}
+
+int onExtraImageApplying(WPARAM wParam, LPARAM lParam)
+{
+ if (DBGetContactSettingByte((HANDLE)wParam,MODULE_NAME,"MissYou",0))
+ CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) wParam, (LPARAM) &g_IECMissYou);
+
+ return 0;
+}
+
+int onExtraImageListRebuild(WPARAM wParam, LPARAM lParam)
+{
+ g_IECMissYou.cbSize = sizeof(IconExtraColumn);
+ g_IECMissYou.ColumnType = options.MissYouIcon;
+
+ if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
+ {
+ if (ServiceExists(MS_SKIN2_ADDICON))
+ {
+ g_IECMissYou.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)(HICON) CallService(MS_SKIN2_GETICON, 0, (LPARAM)"enabled_icon"), (LPARAM)0);
+ }
+ else
+ {
+ g_IECMissYou.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_ENABLED), IMAGE_ICON, 16, 16, LR_SHARED), (LPARAM)0);
+ }
+ }
+
+ return 0;
+}
+
+/**
+ * ContactSettingChanged callback
+ */
+int SettingChanged(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact = (HANDLE) wParam;
+ DBCONTACTWRITESETTING *inf = (DBCONTACTWRITESETTING *) lParam;
+
+ if (hContact == NULL || inf->value.type == DBVT_DELETED || strcmp(inf->szSetting, "Status") != 0)
+ return 0;
+
+ if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 1)
+ 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))
+ return 0;
+
+ int currentStatus = inf->value.wVal;
+ int prevStatus = DBGetContactSettingWord(hContact, "UserOnline", "OldStatus", ID_STATUS_OFFLINE);
+
+ if (currentStatus == prevStatus)
+ {
+ return 0;
+ }
+
+ // Last status
+ DBWriteContactSettingDword(hContact, MODULE_NAME, "LastStatus", prevStatus);
+
+ if (prevStatus == ID_STATUS_OFFLINE)
+ {
+ if (DBGetContactSettingByte(hContact, MODULE_NAME, "MissYou", 0))
+ {
+ // Display PopUp
+ POPUPDATAEX ppd = {0};
+ ppd.cbSize = sizeof(POPUPDATAEX);
+
+ ppd.lchContact = hContact;
+ ppd.lchIcon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"enabled_icon");
+ strncpy(ppd.lpzContactName, (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0), MAX_CONTACTNAME);
+ strncpy(ppd.lpzText, Translate("You awaited this contact!"), MAX_SECONDLINE);
+ if (!options.iUsePopupColors)
+ {
+ ppd.colorBack = options.iPopUpColorBack;
+ ppd.colorText = options.iPopUpColorFore;
+ }
+ ppd.PluginWindowProc = (WNDPROC)MissYouPopupDlgProc;
+ ppd.PluginData = NULL;
+ ppd.iSeconds = -1;
+
+ missyouactions[0].flags = PAF_ENABLED;
+ ppd.lpActions = missyouactions;
+ ppd.actionCount = 1;
+
+ CallService(MS_POPUP_ADDPOPUPEX, (WPARAM) &ppd, APF_NEWDATA);
+
+ SkinPlaySound("buddyExpectatorMissYou");
+ }
+ }
+
+ if (currentStatus == ID_STATUS_OFFLINE)
+ {
+ setLastSeen(hContact);
+ return 0;
+ }
+
+ /*
+ if (CallService(MS_IGNORE_ISIGNORED, (WPARAM) hContact, (LPARAM) IGNOREEVENT_USERONLINE))
+ {
+ setLastSeen(hContact);
+ return 0;
+ }
+ */
+
+ if (DBGetContactSettingDword(hContact, MODULE_NAME, "LastSeen", (DWORD)-1) == (DWORD)-1 && options.notifyFirstOnline)
+ {
+ ReturnNotify(hContact, Translate("has gone online for the first time."));
+
+ setLastSeen(hContact);
+ }
+
+ unsigned int AbsencePeriod = DBGetContactSettingDword(hContact, MODULE_NAME, "iAbsencePeriod", options.iAbsencePeriod);
+ if (isContactGoneFor(hContact, AbsencePeriod))
+ {
+ char* message = Translate("has returned after a long absence.");
+ time_t tmpTime;
+ char tmpBuf[251] = {0};
+ tmpTime = getLastSeen(hContact);
+ if (tmpTime != -1)
+ {
+ strftime(tmpBuf, 250, Translate("has returned after being absent since %#x"), gmtime(&tmpTime));
+ message = tmpBuf;
+ }
+ else
+ {
+ tmpTime = getLastInputMsg(hContact);
+ if (tmpTime != -1)
+ {
+ strftime(tmpBuf, 250, Translate("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))
+ {
+ setLastSeen(hContact);
+ }
+ } else
+ setLastSeen(hContact);
+
+ return 0;
+}
+
+void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
+{
+ HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ char *proto;
+ while (hContact != 0)
+ {
+ proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ if (proto && (DBGetContactSettingByte(hContact, proto, "ChatRoom", 0) == 0) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) && isContactGoneFor(hContact, options.iAbsencePeriod2) && (DBGetContactSettingByte(hContact, MODULE_NAME, "StillAbsentNotified", 0) == 0))
+ {
+ DBWriteContactSettingByte(hContact, MODULE_NAME, "StillAbsentNotified", 1);
+ SkinPlaySound("buddyExpectatorStillAbsent");
+
+ char* message = Translate("has not returned after a long absence.");
+ time_t tmpTime;
+ char tmpBuf[251] = {0};
+ tmpTime = getLastSeen(hContact);
+ if (tmpTime != -1)
+ {
+ strftime(tmpBuf, 250, Translate("has not returned after being absent since %#x"), gmtime(&tmpTime));
+ message = tmpBuf;
+ }
+ else
+ {
+ tmpTime = getLastInputMsg(hContact);
+ if (tmpTime != -1)
+ {
+ strftime(tmpBuf, 250, Translate("has not returned after being absent since %#x"), gmtime(&tmpTime));
+ message = tmpBuf;
+ }
+ }
+
+ GoneNotify(hContact, message);
+ }
+
+ hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ }
+}
+/**
+ * Called when all the modules have had their modules loaded event handlers called (dependence of popups on fontservice :( )
+ */
+int ModulesLoaded2(WPARAM wParam, LPARAM lParam)
+{
+ // check for 'still absent' contacts on startup
+ TimerProc(0, 0, 0, 0);
+
+ return 0;
+}
+
+/**
+ * Called when all the modules are loaded
+ */
+int ModulesLoaded(WPARAM wParam, LPARAM lParam)
+{
+ hEventUserInfoInit = HookEvent(ME_USERINFO_INITIALISE, UserinfoInit);
+
+ // add sounds support
+ SkinAddNewSoundEx("buddyExpectatorReturn", Translate("BuddyExpectator"), Translate("Contact returned"));
+ SkinAddNewSoundEx("buddyExpectatorStillAbsent", Translate("BuddyExpectator"), Translate("Contact still absent"));
+ SkinAddNewSoundEx("buddyExpectatorMissYou", Translate("BuddyExpectator"), Translate("Miss you event"));
+ SkinAddNewSoundEx("buddyExpectatorHide", Translate("BuddyExpectator"), Translate("Hide contact event"));
+
+ timer_id = SetTimer(0, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours
+
+ hModulesLoaded2 = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded2);
+ if (options.MissYouIcon)
+ {
+ hHookExtraIconsRebuild = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, onExtraImageListRebuild);
+ hHookExtraIconsApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, onExtraImageApplying);
+ g_IECClear.cbSize = sizeof(IconExtraColumn);
+ g_IECClear.ColumnType = options.MissYouIcon;
+ g_IECClear.hImage = (HANDLE) -1;
+ }
+
+ // IcoLib support
+ if (ServiceExists(MS_SKIN2_ADDICON))
+ {
+ SKINICONDESC sid = {0};
+ char szFile[MAX_PATH];
+ GetModuleFileNameA(hInst, szFile, MAX_PATH);
+ sid.pszDefaultFile = szFile;
+ sid.cbSize = SKINICONDESC_SIZE_V1;
+
+ sid.pszSection = Translate("BuddyExpectator");
+
+ sid.pszDescription = Translate("Tray/popup icon");
+ sid.pszName = "main_icon";
+ sid.iDefaultIndex = -IDI_MAINICON;
+ CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+
+ sid.pszDescription = Translate("Enabled");
+ sid.pszName = "enabled_icon";
+ sid.iDefaultIndex = -IDI_ENABLED;
+ hEnabledIcon = (HANDLE)CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+
+ sid.pszDescription = Translate("Disabled");
+ sid.pszName = "disabled_icon";
+ sid.iDefaultIndex = -IDI_DISABLED;
+ hDisabledIcon = (HANDLE)CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+
+ sid.pszDescription = Translate("Hide");
+ sid.pszName = "hide_icon";
+ sid.iDefaultIndex = -IDI_HIDE;
+ CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+
+ sid.pszDescription = Translate("NeverHide");
+ sid.pszName = "neverhide_icon";
+ sid.iDefaultIndex = -IDI_NEVERHIDE;
+ CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+
+ hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, onIconsChanged);
+ }
+
+ onIconsChanged(0,0);
+
+ if (options.enableMissYou)
+ {
+ hPrebuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onPrebuildContactMenu);
+
+ CLISTMENUITEM mi = {0};
+ mi.cbSize = sizeof(CLISTMENUITEM);
+ mi.flags = CMIF_ICONFROMICOLIB;
+ mi.icolibItem = hDisabledIcon;
+ mi.position = 200000;
+ mi.pszName = Translate("Enable Miss You");
+ mi.pszService = "BuddyExpectator/actionMissYouClick";
+ hContactMenu = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
+ }
+
+ // Updater plugin support
+ if (ServiceExists(MS_UPDATE_REGISTER))
+ {
+ // register with updater
+ Update update = {0};
+ char szVersion[16];
+
+ update.cbSize = sizeof(Update);
+
+ update.szComponentName = pluginInfo.shortName;
+ update.pbVersion = (BYTE *)CreateVersionString(pluginInfo.version, szVersion);
+ update.cpbVersion = strlen((char *)update.pbVersion);
+
+ update.szUpdateURL = UPDATER_AUTOREGISTER;
+
+ // these are the three lines that matter - the archive, the page containing the version string, and the text (or data)
+ // before the version that we use to locate it on the page
+ // (note that if the update URL and the version URL point to standard file listing entries, the backend xml
+ // data will be used to check for updates rather than the actual web page - this is not true for beta urls)
+ update.szBetaUpdateURL = "http://thief.miranda.im/BuddyExpectator.zip";
+ update.szBetaVersionURL = "http://thief.miranda.im/updater/buddyexpectator_version.txt";
+ update.szBetaChangelogURL = "http://thief.miranda.im";
+ update.pbBetaVersionPrefix = (BYTE *)"Buddy Expectator ";
+
+ update.cpbBetaVersionPrefix = strlen((char *)update.pbBetaVersionPrefix);
+
+ CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
+ }
+
+ missyouactions[0].cbSize = sizeof(POPUPACTION);
+ missyouactions[0].lchIcon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"disabled_icon");
+ lstrcpy(missyouactions[0].lpzTitle, Translate("Disable Miss You"));
+ missyouactions[0].wParam = missyouactions[0].lParam = 1;
+
+ hideactions[0].cbSize = sizeof(POPUPACTION);
+ hideactions[0].lchIcon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"hide_icon");
+ lstrcpy(hideactions[0].lpzTitle, Translate("Hide contact"));
+ hideactions[0].wParam = hideactions[0].lParam = 2;
+
+ hideactions[1].cbSize = sizeof(POPUPACTION);
+ hideactions[1].lchIcon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"neverhide_icon");
+ lstrcpy(hideactions[1].lpzTitle, Translate("Never hide this contact"));
+ hideactions[1].wParam = hideactions[1].lParam = 3;
+
+ return 0;
+}
+
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+{
+ return &pluginInfo;
+}
+
+extern "C" __declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion)
+{
+ return &oldpluginInfo;
+}
+
+int ContactAdded(WPARAM wParam, LPARAM lParam)
+{
+ DBWriteContactSettingDword((HANDLE)wParam, MODULE_NAME, "CreationTime", (DWORD)time(0));
+ return 0;
+}
+
+int onSystemOKToExit(WPARAM wParam,LPARAM lParam)
+{
+ UnhookEvent(hEventContactSetting);
+ UnhookEvent(hEventContactAdded);
+ UnhookEvent(hEventUserInfoInit);
+ if (hPrebuildContactMenu) UnhookEvent(hPrebuildContactMenu);
+ UnhookEvent(hIcoLibIconsChanged);
+ UnhookEvent(hModulesLoaded);
+ UnhookEvent(hModulesLoaded2);
+ UnhookEvent(hSystemOKToExit);
+ UnhookEvent(hHookExtraIconsRebuild);
+ UnhookEvent(hHookExtraIconsApply);
+
+ DestroyServiceFunction(hContactReturnedAction);
+ DestroyServiceFunction(hContactStillAbsentAction);
+ DestroyServiceFunction(hMissYouAction);
+ DestroyServiceFunction(hMenuMissYouClick);
+
+ DeinitOptions();
+
+ if (hIcoLibIconsChanged)
+ CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0);
+ else
+ DestroyIcon(hIcon);
+
+ return 0;
+}
+
+extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
+{
+ pluginLink = link;
+
+ setlocale(LC_ALL, "English"); // Set English locale
+
+ InitOptions();
+
+ hContactReturnedAction = CreateServiceFunction("BuddyExpectator/actionReturned", ContactReturnedAction);
+ hContactStillAbsentAction = CreateServiceFunction("BuddyExpectator/actionStillAbsent", ContactStillAbsentAction);
+ hMissYouAction = CreateServiceFunction("BuddyExpectator/actionMissYou", MissYouAction);
+ hMenuMissYouClick = CreateServiceFunction("BuddyExpectator/actionMissYouClick", MenuMissYouClick);
+
+ hEventContactSetting = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SettingChanged);
+ hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ hSystemOKToExit = HookEvent(ME_SYSTEM_OKTOEXIT,onSystemOKToExit);
+
+ hEventContactAdded = HookEvent(ME_DB_CONTACT_ADDED, ContactAdded);
+
+ // ensure all contacts are timestamped
+ DBVARIANT dbv;
+ HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ DWORD current_time = (DWORD)time(0);
+ while (hContact != 0)
+ {
+ if (!DBGetContactSetting(hContact, MODULE_NAME, "CreationTime", &dbv))
+ DBFreeVariant(&dbv);
+ else
+ DBWriteContactSettingDword(hContact, MODULE_NAME, "CreationTime", current_time);
+
+ hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ }
+
+ return 0;
+}
+
+extern "C" int __declspec(dllexport) Unload(void)
+{
+ KillTimer(0, timer_id);
+
+ return 0;
+}
+
diff --git a/buddyexpectator/BuddyExpectator.dsp b/buddyexpectator/BuddyExpectator.dsp new file mode 100644 index 0000000..b8a0eca --- /dev/null +++ b/buddyexpectator/BuddyExpectator.dsp @@ -0,0 +1,119 @@ +# Microsoft Developer Studio Project File - Name="BuddyExpectator" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=BuddyExpectator - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "BuddyExpectator.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "BuddyExpectator.mak" CFG="BuddyExpectator - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "BuddyExpectator - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "BuddyExpectator - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "BuddyExpectator - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BUDDYEXPECTATOR_EXPORTS" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BUDDYEXPECTATOR_EXPORTS" /FD /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+
+!ELSEIF "$(CFG)" == "BuddyExpectator - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BUDDYEXPECTATOR_EXPORTS" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BUDDYEXPECTATOR_EXPORTS" /FD /GZ /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "BuddyExpectator - Win32 Release"
+# Name "BuddyExpectator - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\BuddyExpectator.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\BuddyExpectator.rc
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\icon1.ico
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\ReadMe.txt
+# End Source File
+# End Target
+# End Project
diff --git a/buddyexpectator/BuddyExpectator.dsw b/buddyexpectator/BuddyExpectator.dsw new file mode 100644 index 0000000..64425ef --- /dev/null +++ b/buddyexpectator/BuddyExpectator.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "BuddyExpectator"=.\BuddyExpectator.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/buddyexpectator/BuddyExpectator.mdsp b/buddyexpectator/BuddyExpectator.mdsp new file mode 100644 index 0000000..35eb1ee --- /dev/null +++ b/buddyexpectator/BuddyExpectator.mdsp @@ -0,0 +1,101 @@ +[Project]
+name=BuddyExpectator
+type=2
+defaultConfig=1
+
+
+[Debug]
+// compiler
+workingDirectory=
+arguments=
+intermediateFilesDirectory=Debug
+outputFilesDirectory=Debug
+compilerPreprocessor=
+extraCompilerOptions=
+compilerIncludeDirectory=..\..\include
+noWarning=0
+defaultWarning=0
+allWarning=1
+extraWarning=0
+isoWarning=0
+warningsAsErrors=0
+debugType=1
+debugLevel=2
+exceptionEnabled=1
+runtimeTypeEnabled=1
+optimizeLevel=0
+
+// linker
+libraryPath=
+outputFilename=Debug\BuddyExpectator.dll
+libraries=
+extraLinkerOptions=
+ignoreStartupFile=0
+ignoreDefaultLibs=0
+stripExecutableFile=0
+
+// archive
+extraArchiveOptions=
+
+//resource
+resourcePreprocessor=
+resourceIncludeDirectory=
+extraResourceOptions=
+
+[Release]
+// compiler
+workingDirectory=
+arguments=
+intermediateFilesDirectory=Release
+outputFilesDirectory=Release
+compilerPreprocessor=
+extraCompilerOptions=
+compilerIncludeDirectory=..\..\include
+noWarning=0
+defaultWarning=0
+allWarning=1
+extraWarning=0
+isoWarning=0
+warningAsErrors=0
+debugType=0
+debugLevel=1
+exceptionEnabled=1
+runtimeTypeEnabled=1
+optimizeLevel=4
+
+// linker
+libraryPath=
+outputFilename=Release\BuddyExpectator.dll
+libraries=
+extraLinkerOptions=
+ignoreStartupFile=0
+ignoreDefaultLibs=0
+stripExecutableFile=1
+
+// archive
+extraArchiveOptions=
+
+//resource
+resourcePreprocessor=
+resourceIncludeDirectory=
+extraResourceOptions=
+
+[Source]
+1=BuddyExpectator.cpp
+2=options.cpp
+[Header]
+1=common.h
+2=options.h
+3=resource.h
+[Resource]
+1=BuddyExpectator.rc
+[Other]
+1=docs\BuddyExpectator-Readme.txt
+2=docs\BuddyExpectator-Translate.txt
+[History]
+options.cpp,3318
+common.h,1734
+options.h,1513
+docs\BuddyExpectator-Readme.txt,325
+docs\BuddyExpectator-Translate.txt,0
+BuddyExpectator.cpp,22589
diff --git a/buddyexpectator/BuddyExpectator.rc b/buddyexpectator/BuddyExpectator.rc new file mode 100644 index 0000000..39584af --- /dev/null +++ b/buddyexpectator/BuddyExpectator.rc @@ -0,0 +1,216 @@ +// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_OPTIONSPANEL DIALOGEX 0, 0, 227, 219
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0xCC
+BEGIN
+ LTEXT "When a contact returns after ",IDC_STATIC,21,16,112,8
+ EDITTEXT IDC_EDIT_ABSENCE,137,13,22,13,ES_AUTOHSCROLL
+ COMBOBOX IDC_COMBO_PERIOD,161,13,49,51,CBS_DROPDOWNLIST |
+ WS_TABSTOP
+ CONTROL "Show a popup",IDC_CHECK_POPUP,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,21,38,189,10
+ CONTROL "Add an event (flashing icon) to the contact",
+ IDC_CHECK_FLASHICON,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,21,51,187,10
+ LTEXT "On event action (double click) or popup click:",
+ IDC_STATIC,21,63,187,8
+ CONTROL "Open User Details",IDC_CHECK_UDETAILS,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,32,75,176,10
+ CONTROL "Open message window",IDC_CHECK_MSGWINDOW,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,32,86,176,10
+ GROUPBOX "Return notification",IDC_STATIC,14,3,199,95
+ LTEXT "When a contact is absent for",IDC_STATIC,20,114,112,8
+ EDITTEXT IDC_EDIT_ABSENCE2,136,111,22,13,ES_AUTOHSCROLL
+ COMBOBOX IDC_COMBO_PERIOD2,160,111,49,51,CBS_DROPDOWNLIST |
+ WS_TABSTOP
+ GROUPBOX "Long time no see",IDC_STATIC,13,102,199,94
+ CONTROL "or comes online for the first time",
+ IDC_CHECK_FIRSTSIGHT,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,32,27,176,10
+ CONTROL "Show a popup",IDC_CHECK_POPUP2,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,20,127,189,10
+ CONTROL "Add an event (flashing icon) to the contact",
+ IDC_CHECK_FLASHICON2,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,20,140,187,10
+ LTEXT "On event action (double click) or popup click:",
+ IDC_STATIC,20,152,187,8
+ CONTROL "Enable ""Miss you"" feature",IDC_CHECK_MISSYOU,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,20,201,186,9
+ EDITTEXT IDC_EDIT_SILENTFOR,135,179,22,13,ES_AUTOHSCROLL
+ COMBOBOX IDC_COMBO_PERIOD3,159,179,49,51,CBS_DROPDOWNLIST |
+ WS_TABSTOP
+ CONTROL "Hide when no messages for",IDC_CHECK_NOMSGS,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,20,180,113,11
+ COMBOBOX IDC_COMBO_ACTIONS,32,163,100,57,CBS_DROPDOWNLIST |
+ WS_TABSTOP
+END
+
+IDD_POPUPPANEL DIALOGEX 0, 0, 190, 134
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+BEGIN
+ GROUPBOX "Colors",IDC_STATIC,7,7,176,42
+ LTEXT "Background",IDC_STATIC,17,19,46,8
+ LTEXT "Text",IDC_STATIC,17,34,46,8
+ CONTROL "",IDC_COLOR_BGR,"ColourPicker",WS_TABSTOP,61,17,26,12
+ CONTROL "",IDC_COLOR_FRG,"ColourPicker",WS_TABSTOP,61,32,26,12
+ CONTROL "Use Popups colors",IDC_COLORS_POPUP,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,94,17,82,12
+ CONTROL "Use Windows colors",IDC_COLORS_WIN,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,94,33,82,9
+ GROUPBOX "Delay",IDC_STATIC,7,50,176,52
+ CONTROL "Default",IDC_DELAY_DEF,"Button",BS_AUTORADIOBUTTON |
+ WS_GROUP | WS_TABSTOP,18,61,120,10
+ CONTROL "Custom",IDC_DELAY_CUST,"Button",BS_AUTORADIOBUTTON,18,
+ 74,62,10
+ CONTROL "Permanent",IDC_DELAY_PERM,"Button",BS_AUTORADIOBUTTON,
+ 18,87,119,10
+ EDITTEXT IDC_EDIT_POPUPDELAY,81,72,30,14,ES_AUTOHSCROLL
+ LTEXT "sec",IDC_STATIC,116,75,34,8
+ PUSHBUTTON "Preview",IDC_PREVIEW,58,106,75,17
+END
+
+IDD_USERINFO DIALOGEX 0, 0, 222, 132
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+BEGIN
+ LTEXT "Last seen online:",IDC_STATIC,7,7,85,8
+ EDITTEXT IDC_EDIT_LASTSEEN,99,7,116,12,ES_AUTOHSCROLL |
+ ES_READONLY | NOT WS_BORDER
+ LTEXT "Last input message:",IDC_STATIC,7,22,85,8
+ EDITTEXT IDC_EDIT_LASTINPUT,99,22,116,12,ES_AUTOHSCROLL |
+ ES_READONLY | NOT WS_BORDER
+ LTEXT "Custom absence period:",IDC_STATIC,7,36,85,12
+ EDITTEXT IDC_EDITABSENCE,101,35,31,12,ES_AUTOHSCROLL
+ CONTROL "",IDC_SPINABSENCE,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS,163,14,8,13
+ LTEXT "days",IDC_STATIC,138,36,77,10
+ EDITTEXT IDC_EDIT_WILLNOTICE,7,93,208,30,ES_MULTILINE |
+ ES_READONLY | NOT WS_BORDER
+ CONTROL "Never hide this contact",IDC_CHECK_NEVERHIDE,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,75,180,12
+ CONTROL "Enable Miss You",IDC_CHECK_MISSYOU,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,47,200,19
+ CONTROL "Notify always",IDC_CHECK_NOTIFYALWAYS,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,27,64,188,10
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_OPTIONSPANEL, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 220
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 217
+ END
+
+ IDD_POPUPPANEL, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 183
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 127
+ END
+
+ IDD_USERINFO, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 215
+ VERTGUIDE, 92
+ VERTGUIDE, 99
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 125
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_MAINICON ICON "icons\\main.ico"
+IDI_ENABLED ICON "icons\\enabled.ico"
+IDI_DISABLED ICON "icons\\disabled.ico"
+IDI_HIDE ICON "icons\\hide.ico"
+IDI_NEVERHIDE ICON "icons\\neverhide.ico"
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/buddyexpectator/BuddyExpectator10.sln b/buddyexpectator/BuddyExpectator10.sln new file mode 100644 index 0000000..cf4b219 --- /dev/null +++ b/buddyexpectator/BuddyExpectator10.sln @@ -0,0 +1,20 @@ +
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BuddyExpectator", "BuddyExpectator10.vcxproj", "{8CEBD7AC-CD02-4BEC-B889-A7243F3E5DD8}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8CEBD7AC-CD02-4BEC-B889-A7243F3E5DD8}.Debug|Win32.ActiveCfg = Release|Win32
+ {8CEBD7AC-CD02-4BEC-B889-A7243F3E5DD8}.Debug|Win32.Build.0 = Release|Win32
+ {8CEBD7AC-CD02-4BEC-B889-A7243F3E5DD8}.Release|Win32.ActiveCfg = Release|Win32
+ {8CEBD7AC-CD02-4BEC-B889-A7243F3E5DD8}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/buddyexpectator/BuddyExpectator10.suo b/buddyexpectator/BuddyExpectator10.suo Binary files differnew file mode 100644 index 0000000..c54e02b --- /dev/null +++ b/buddyexpectator/BuddyExpectator10.suo diff --git a/buddyexpectator/BuddyExpectator10.vcxproj b/buddyexpectator/BuddyExpectator10.vcxproj new file mode 100644 index 0000000..9a4c4d6 --- /dev/null +++ b/buddyexpectator/BuddyExpectator10.vcxproj @@ -0,0 +1,167 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>BuddyExpectator</ProjectName>
+ <ProjectGuid>{8CEBD7AC-CD02-4BEC-B889-A7243F3E5DD8}</ProjectGuid>
+ <RootNamespace>BuddyExpectator</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">D:\Sources\miranda9_trunk\miranda\include;$(IncludePath)</IncludePath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Debug/BuddyExpectator.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;BUDDYEXPECTATOR_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeaderOutputFile>.\Debug/BuddyExpectator.pch</PrecompiledHeaderOutputFile>
+ <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
+ <ObjectFileName>.\Debug/</ObjectFileName>
+ <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <OutputFile>../../bin/$(Configuration)/plugins/BuddyExpectator.dll</OutputFile>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>.\Debug/BuddyExpectator.pdb</ProgramDatabaseFile>
+ <ImportLibrary>.\Debug/BuddyExpectator.lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <Bscmake>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <OutputFile>.\Debug/BuddyExpectator.bsc</OutputFile>
+ </Bscmake>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Release/BuddyExpectator.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;BUDDYEXPECTATOR_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeaderOutputFile>.\Release/BuddyExpectator.pch</PrecompiledHeaderOutputFile>
+ <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
+ <ObjectFileName>.\Release/</ObjectFileName>
+ <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>.\Release/BuddyExpectator.pdb</ProgramDatabaseFile>
+ <ImportLibrary>.\Release/BuddyExpectator.lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <Bscmake>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <OutputFile>.\Release/BuddyExpectator.bsc</OutputFile>
+ </Bscmake>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="BuddyExpectator.cpp">
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="options.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="BuddyExpectator.rc">
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="icon1.ico" />
+ <None Include="ReadMe.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="common.h" />
+ <ClInclude Include="options.h" />
+ <ClInclude Include="resource.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/buddyexpectator/BuddyExpectator10.vcxproj.user b/buddyexpectator/BuddyExpectator10.vcxproj.user new file mode 100644 index 0000000..695b5c7 --- /dev/null +++ b/buddyexpectator/BuddyExpectator10.vcxproj.user @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+</Project>
\ No newline at end of file diff --git a/buddyexpectator/BuddyExpectator8.sln b/buddyexpectator/BuddyExpectator8.sln new file mode 100644 index 0000000..008ccbe --- /dev/null +++ b/buddyexpectator/BuddyExpectator8.sln @@ -0,0 +1,20 @@ +
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BuddyExpectator", "BuddyExpectator.vcproj", "{8CEBD7AC-CD02-4BEC-B889-A7243F3E5DD8}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8CEBD7AC-CD02-4BEC-B889-A7243F3E5DD8}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8CEBD7AC-CD02-4BEC-B889-A7243F3E5DD8}.Debug|Win32.Build.0 = Debug|Win32
+ {8CEBD7AC-CD02-4BEC-B889-A7243F3E5DD8}.Release|Win32.ActiveCfg = Release|Win32
+ {8CEBD7AC-CD02-4BEC-B889-A7243F3E5DD8}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/buddyexpectator/BuddyExpectator8.vcproj b/buddyexpectator/BuddyExpectator8.vcproj new file mode 100644 index 0000000..c9f2883 --- /dev/null +++ b/buddyexpectator/BuddyExpectator8.vcproj @@ -0,0 +1,295 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="BuddyExpectator"
+ ProjectGUID="{8CEBD7AC-CD02-4BEC-B889-A7243F3E5DD8}"
+ RootNamespace="BuddyExpectator"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/BuddyExpectator.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BUDDYEXPECTATOR_EXPORTS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile=".\Debug/BuddyExpectator.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="../../bin/$(ConfigurationName)/plugins/BuddyExpectator.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/BuddyExpectator.pdb"
+ ImportLibrary=".\Debug/BuddyExpectator.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/BuddyExpectator.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/BuddyExpectator.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="../../include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BUDDYEXPECTATOR_EXPORTS"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release/BuddyExpectator.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DisableSpecificWarnings="4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="../../bin/$(ConfigurationName)/plugins/BuddyExpectator.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Release/BuddyExpectator.pdb"
+ ImportLibrary=".\Release/BuddyExpectator.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/BuddyExpectator.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="BuddyExpectator.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="BuddyExpectator.rc"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\options.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath="icon1.ico"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath=".\common.h"
+ >
+ </File>
+ <File
+ RelativePath=".\options.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath="ReadMe.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/buddyexpectator/buddyexpectator.sln b/buddyexpectator/buddyexpectator.sln new file mode 100644 index 0000000..058e392 --- /dev/null +++ b/buddyexpectator/buddyexpectator.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "buddyexpectator", "buddyexpectator.vcproj", "{29FC6E79-39E6-469F-9899-158770B87F30}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {29FC6E79-39E6-469F-9899-158770B87F30}.Debug.ActiveCfg = Debug|Win32
+ {29FC6E79-39E6-469F-9899-158770B87F30}.Debug.Build.0 = Debug|Win32
+ {29FC6E79-39E6-469F-9899-158770B87F30}.Release.ActiveCfg = Release|Win32
+ {29FC6E79-39E6-469F-9899-158770B87F30}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/buddyexpectator/buddyexpectator.vcproj b/buddyexpectator/buddyexpectator.vcproj new file mode 100644 index 0000000..9317393 --- /dev/null +++ b/buddyexpectator/buddyexpectator.vcproj @@ -0,0 +1,185 @@ +<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="buddyexpectator"
+ ProjectGUID="{29FC6E79-39E6-469F-9899-158770B87F30}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BUDDYEXPECTATOR_EXPORTS"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/buddyexpectator.dll"
+ LinkIncremental="2"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/buddyexpectator.pdb"
+ SubSystem="2"
+ ImportLibrary="$(OutDir)/buddyexpectator.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BUDDYEXPECTATOR_EXPORTS"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/buddyexpectator.dll"
+ LinkIncremental="1"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ ImportLibrary="$(OutDir)/buddyexpectator.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\BuddyExpectator.cpp">
+ </File>
+ <File
+ RelativePath=".\options.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ <File
+ RelativePath=".\common.h">
+ </File>
+ <File
+ RelativePath=".\m_popup.h">
+ </File>
+ <File
+ RelativePath=".\m_updater.h">
+ </File>
+ <File
+ RelativePath=".\options.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ <File
+ RelativePath=".\BuddyExpectator.rc">
+ </File>
+ <File
+ RelativePath=".\icons\disabled.ico">
+ </File>
+ <File
+ RelativePath=".\icons\enabled.ico">
+ </File>
+ <File
+ RelativePath=".\icons\hide.ico">
+ </File>
+ <File
+ RelativePath=".\icons\main.ico">
+ </File>
+ <File
+ RelativePath=".\icons\neverhide.ico">
+ </File>
+ </Filter>
+ <Filter
+ Name="Docs"
+ Filter="">
+ <File
+ RelativePath=".\docs\BuddyExpectator-Readme.txt">
+ </File>
+ <File
+ RelativePath=".\docs\BuddyExpectator-Translate.txt">
+ </File>
+ <File
+ RelativePath=".\buddyexpectator_version.txt">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/buddyexpectator/buddyexpectator_version.txt b/buddyexpectator/buddyexpectator_version.txt new file mode 100644 index 0000000..f867b26 --- /dev/null +++ b/buddyexpectator/buddyexpectator_version.txt @@ -0,0 +1 @@ +Buddy Expectator 0.1.2.3
\ No newline at end of file diff --git a/buddyexpectator/common.h b/buddyexpectator/common.h new file mode 100644 index 0000000..6c9b635 --- /dev/null +++ b/buddyexpectator/common.h @@ -0,0 +1,63 @@ +/*
+ Buddy Expectator+ plugin for Miranda-IM (www.miranda-im.org)
+ (c)2005 Anar Ibragimoff (ai91@mail.ru)
+ (c)2006 Scott Ellis (mail@scottellis.com.au)
+ (c)2007 Alexander Turyak (thief@miranda-im.org.ua)
+
+ 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: http://svn.miranda.im/mainrepo/buddyexpectator/trunk/common.h $
+ Revision : $Rev: 1392 $
+ Last change on : $Date: 2009-04-22 17:46:08 +0300 (Ср, 22 апр 2009) $
+ Last change by : $Author: Thief $
+*/
+
+#ifndef _COMMON_INC
+#define _COMMON_INC
+
+#include <stddef.h> // needed by m_icolib.h > r9256
+#include <windows.h>
+#include <commctrl.h>
+#include <time.h>
+#include <stdio.h>
+#include <locale.h>
+#include "resource.h"
+#include <newpluginapi.h>
+#include <m_skin.h>
+#include <m_clist.h>
+#include <m_database.h>
+#include <m_system.h>
+#include <m_langpack.h>
+#include <m_contacts.h>
+#include <m_options.h>
+#include <m_protosvc.h>
+#include <m_utils.h>
+#include <m_ignore.h>
+#include <m_message.h>
+#include <m_userinfo.h>
+#include <m_icolib.h>
+#include "m_popup.h"
+#include "m_updater.h"
+#include "m_cluiframes.h"
+
+#define MODULE_NAME "BuddyExpectator"
+
+extern HINSTANCE hInst;
+extern PLUGINLINK *pluginLink;
+
+void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD);
+extern DWORD timer_id;
+
+#endif
diff --git a/buddyexpectator/docs/BuddyExpectator-Readme.txt b/buddyexpectator/docs/BuddyExpectator-Readme.txt new file mode 100644 index 0000000..ea4f526 --- /dev/null +++ b/buddyexpectator/docs/BuddyExpectator-Readme.txt @@ -0,0 +1,63 @@ +BuddyExpectator+ plugin v0.1.2.3
+This plugin notifies about contacts who has returned after an absence of long period.
+
+Features:
+ - Supports Popups module
+ - You may specify a sound for its' event
+ - Logs 'last seen' statistics (use User Details dialog)
+ - Uses built-in 'Ignore' list
+
+Version history:
+
+0.1.2.3
+- added extraicons for MissYou via hidden key (byte)bMissYouIcon - icon slot number
+- added MissYou options to UserInfo page
+- some fixes
+
+0.1.2.2
+- key BuddyExpectator/LastStatus is written to contact's module
+- fixes to unload code
+
+0.1.2.1
+- bugfixes
+
+0.1.2.0
+- added an option to hide inactive contacts
+- added an option to set custom absence perion for a contact
+- addded support for Popup+ actions
+- removed ignore online check
+- changed icons (thanks to a0x and induction)
+- implemended IcoLib API for menu icons (requires Miranda 0.7)
+- implemented new plugin API
+- implemented Updater support for beta versions
+
+0.0.0.7-0.0.1.2 (by Thief)
+- percontact notification period setting
+- IcoLib support
+- implemented "Miss You" feature
+- more popups colors options
+- disabled notifications for non-IM protocols
+
+0.0.0.3-0.0.0.6 (by sje)
+- "long time no see" feature
+- first time online notification
+- storing contact creation date in db
+- other fixes including memleaks clearing
+
+0.0.0.1-0.0.0.2
+- initial version by Anar Ibragimoff
+
+Why
+'Status notifyer'-like plugins are preety good... while your contactlist contains just 5, 10, 20 buddies.
+Mine includes over 100 persons (family, friends, colleagues, messmates...). And every moment somebody goes offline,
+others come back... So my left side of screen is always flickering with green/red popups ;-)
+Sure, I can turn them off... But I want to be notified when somebody comes back after a vacation, business
+trip, maternity leave ;-)
+I found 'Contacts Notifier', but it's really inconveniently to watch for all buddies and their activity... and setup
+a notifyer for everyone who has gone...
+So I have thought out to notify just about contacts who were offline for a long time.
+In other words, it works like 'Last seen' plugin, but with notification ;-)
+
+(c) 2007-2008, Alexander Turyak (turyak@gmail.com)
+(c) 2006, Scott Ellis (mail@scottellis.com.au)
+(c) 2005, Anar Ibragimoff, Minsk, Belarus (ai91@mail.ru)
\ No newline at end of file diff --git a/buddyexpectator/docs/BuddyExpectator-Translate.txt b/buddyexpectator/docs/BuddyExpectator-Translate.txt new file mode 100644 index 0000000..a140810 --- /dev/null +++ b/buddyexpectator/docs/BuddyExpectator-Translate.txt @@ -0,0 +1,42 @@ +;Translation template for BuddyExpectator+ plugin v0.1.2.x
+;please do NOT change %#x and %d in your translation
+[Buddy Expectator]
+[has gone online for the first time.]
+[has returned after a long absence.]
+[has returned after being absent since %#x]
+[has not returned after being absent since %#x]
+[has not returned after a long absence.]
+[not detected]
+[not found]
+[This contact has been absent for an extended period of time.]
+[has returned after being absent since %d days]
+[Contact returned]
+[Contact still absent]
+[Miss you event]
+[Hide contact event]
+[You awaited this contact!]
+[Contact name]
+[Hide contact]
+[Enable Miss You]
+[Disable Miss You]
+[Tray/popup icon]
+
+;dialogs
+[Last seen online:]
+[Last input message:]
+[Custom absence period:]
+[Never hide this contact]
+[Notify always]
+[Return notification]
+[When a contact returns after]
+[or comes online for the first time]
+[Show a popup]
+[Add an event (flashing icon) to the contact]
+[On event action (double click) or popup click:]
+[Open User Details]
+[Open message window]
+[Long time no see]
+[When a contact is absent for]
+[Do nothing]
+[Delete the contact]
+[Enable "Miss you" feature]
\ No newline at end of file diff --git a/buddyexpectator/icons/disabled.ico b/buddyexpectator/icons/disabled.ico Binary files differnew file mode 100644 index 0000000..5280ef1 --- /dev/null +++ b/buddyexpectator/icons/disabled.ico diff --git a/buddyexpectator/icons/enabled.ico b/buddyexpectator/icons/enabled.ico Binary files differnew file mode 100644 index 0000000..316b22b --- /dev/null +++ b/buddyexpectator/icons/enabled.ico diff --git a/buddyexpectator/icons/hide.ico b/buddyexpectator/icons/hide.ico Binary files differnew file mode 100644 index 0000000..deff488 --- /dev/null +++ b/buddyexpectator/icons/hide.ico diff --git a/buddyexpectator/icons/main.ico b/buddyexpectator/icons/main.ico Binary files differnew file mode 100644 index 0000000..e7e514f --- /dev/null +++ b/buddyexpectator/icons/main.ico diff --git a/buddyexpectator/icons/neverhide.ico b/buddyexpectator/icons/neverhide.ico Binary files differnew file mode 100644 index 0000000..8a6347b --- /dev/null +++ b/buddyexpectator/icons/neverhide.ico diff --git a/buddyexpectator/m_cluiframes.h b/buddyexpectator/m_cluiframes.h new file mode 100644 index 0000000..dbed148 --- /dev/null +++ b/buddyexpectator/m_cluiframes.h @@ -0,0 +1,318 @@ +/*
+Miranda ICQ: the free icq client for MS Windows
+Copyright (C) 2000-2 Richard Hughes, Roland Rabien & Tristan Van de Vreede
+
+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.
+*/
+
+//Extra columns type.
+//column arranged in this way
+//
+// [statusicon] ContactName [WEB][ADV1][ADV2][SMS][EMAIL][PROTO][CLIENT]
+//
+#define EXTRA_ICON_RES0 0 // only used by nicer
+#define EXTRA_ICON_EMAIL 1
+#define EXTRA_ICON_PROTO 2 // used by mwclist and modern
+#define EXTRA_ICON_RES1 2 // only used by nicer
+#define EXTRA_ICON_SMS 3
+#define EXTRA_ICON_ADV1 4
+#define EXTRA_ICON_ADV2 5
+#define EXTRA_ICON_WEB 6
+#define EXTRA_ICON_CLIENT 7
+#define EXTRA_ICON_VISMODE 8 // only used by modern
+#define EXTRA_ICON_RES2 8 // only used by nicer
+#define EXTRA_ICON_ADV3 9
+#define EXTRA_ICON_ADV4 10
+
+#ifndef EXTRA_ICON_COUNT
+#define EXTRA_ICON_COUNT 10 // define this inside clist-plugin depending on used icon slots
+#endif
+
+typedef struct
+{
+ int cbSize; //must be sizeof(IconExtraColumn)
+ int ColumnType;
+ HANDLE hImage; //return value from MS_CLIST_EXTRA_ADD_ICON
+}IconExtraColumn,*pIconExtraColumn;
+
+//Set icon for contact at needed column
+//wparam=hContact
+//lparam=pIconExtraColumn
+//return 0 on success,-1 on failure
+//
+//See above for supported columns
+#define MS_CLIST_EXTRA_SET_ICON "CListFrames/SetIconForExraColumn"
+
+//Adding icon to extra image list.
+//Call this in ME_CLIST_EXTRA_LIST_REBUILD event
+//
+//wparam=hIcon
+//lparam=0
+//return hImage on success,-1 on failure
+#define MS_CLIST_EXTRA_ADD_ICON "CListFrames/AddIconToExtraImageList"
+
+#define ME_CLIST_EXTRA_LIST_REBUILD "CListFrames/OnExtraListRebuild"
+
+//called with wparam=hContact
+#define ME_CLIST_EXTRA_IMAGE_APPLY "CListFrames/OnExtraImageApply"
+
+//called with wparam=hContact lparam=extra
+#define ME_CLIST_EXTRA_CLICK "CListFrames/OnExtraClick"
+
+//End of extra images header. TODO move it to separate m_extraimages.h file
+//Cause it has not any relationship to cluiframes engine
+
+
+/************************************************************************/
+/* CLUI Frames Support */
+/************************************************************************/
+
+
+// Constants used below
+typedef struct tagCLISTFrame {
+ DWORD cbSize;
+ HWND hWnd ;
+ HICON hIcon;
+ int align; //al flags below
+ union {
+ int height;
+ int minSize; //the actual meaning depends from type of frame
+ };
+ int Flags; //F_flags below
+ union {
+ char *name; //frame window name indentifier (DO NOT TRANSLATE)
+ wchar_t *wname;
+ LPTSTR tname;
+ };
+ union {
+ char *TBname; //titlebar & menu caption
+ wchar_t *TBwname;
+ LPTSTR TBtname;
+ };
+} CLISTFrame;
+
+#define F_VISIBLE 1 //Frame visible
+#define F_SHOWTB 2 //Show TitleBar
+#define F_UNCOLLAPSED 4 //UnCollapse frame
+#define F_LOCKED 8 //Lock Frame
+#define F_NOBORDER 16 //Dont apply WS_BORDER style for window
+#define F_SHOWTBTIP 32 //Show titlebar tooltip
+#define F_CANBEVERTICAL 64 //frames can be vertical
+#define F_CANNOTBEHORIZONTAL 128 //frames can NOT be horizontal F_CANBEVERTICAL have to be set
+#define F_NO_SUBCONTAINER 1024 //Support skining no subcontainer needed
+#define F_SKINNED 2048 // skinned frame (for owned subframe only)
+#define F_UNICODE 32768 //Use unicode text
+#ifdef _UNICODE
+# define F_TCHAR F_UNICODE
+#else
+# define F_TCHAR 0
+#endif
+
+// frame alignment
+#define alTop 0x00000001
+#define alBottom 0x00000002
+#define alClient 0x00000004 //only one alClient frame
+
+// since 0.7.0.20
+#define alLeft 0x00000011 // frame is vertical
+#define alRight 0x00000012
+
+#define alVertFrameMask 0x00000010
+
+#define FU_TBREDRAW 1 //redraw titlebar
+#define FU_FMREDRAW 2 //redraw Frame
+#define FU_FMPOS 4 //update Frame position
+
+#define FO_FLAGS 0x0001 //return set of F_VISIBLE,F_SHOWTB,F_UNCOLLAPSED,F_LOCKED,F_NOBORDER,F_SHOWTBTIP
+#define FO_NAME 0x0002 //Change m_cacheTName
+#define FO_TBNAME 0x0003 //Change TB caption
+#define FO_TBSTYLE 0x0004 //Change TB style
+#define FO_TBEXSTYLE 0x0005 //Change TB exstyle
+#define FO_ICON 0x0006 //Change icon
+#define FO_HEIGHT 0x0007 //Change height
+#define FO_ALIGN 0x0008 //Change align
+#define FO_TBTIPNAME 0x0009 //Change TB tooltip
+#define FO_FLOATING 0x000a //Change floating mode
+
+#define FO_UNICODETEXT 0x8000 // flag for FO_NAME,FO_TBNAME, FO_TBTIPNAME set/get lPAram as unicode wchar_t
+#ifdef _UNICODE
+ #define FO_TCHAR FO_UNICODETEXT
+#else
+ #define FO_TCHAR 0x0000
+#endif
+
+
+//////////////////////////////////////////////////////////////////////////
+//want show tooltip for statusbar
+//wparam=(char *)protocolname
+//lparam=0
+#define ME_CLIST_FRAMES_SB_SHOW_TOOLTIP "CListFrames/StatusBarShowToolTip"
+
+//////////////////////////////////////////////////////////////////////////
+//want hide tooltip for statusbar
+//wparam=lparam=0
+#define ME_CLIST_FRAMES_SB_HIDE_TOOLTIP "CListFrames/StatusBarHideToolTip"
+
+//////////////////////////////////////////////////////////////////////////
+//adds a frame window
+//wParam=(CLISTFrame*)
+//lParam=0
+//returns an integer, the frame id.
+#define MS_CLIST_FRAMES_ADDFRAME "CListFrames/AddFrame"
+
+//////////////////////////////////////////////////////////////////////////
+// remove frame. It destroy your window
+//
+#define MS_CLIST_FRAMES_REMOVEFRAME "CListFrames/RemoveFrame"
+
+//////////////////////////////////////////////////////////////////////////
+//shows all frames
+//wParam=lParam=0
+//returns 0 on success, -1 on failure
+#define MS_CLIST_FRAMES_SHOWALLFRAMES "CListFrames/ShowALLFrames"
+
+//////////////////////////////////////////////////////////////////////////
+//shows the titlebars of all frames
+//wParam=lParam=0
+//returns 0 on success, -1 on failure
+#define MS_CLIST_FRAMES_SHOWALLFRAMESTB "CListFrames/ShowALLFramesTB"
+
+//////////////////////////////////////////////////////////////////////////
+//hides the titlebars of all frames
+//wParam=lParam=0
+//returns 0 on success, -1 on failure
+#define MS_CLIST_FRAMES_HIDEALLFRAMESTB "CListFrames/HideALLFramesTB"
+
+//////////////////////////////////////////////////////////////////////////
+//shows the frame if it is hidden,
+//hides the frame if it is shown
+//wParam = FrameId
+//lParam = Frame number (can be shown in profile in CLUIFrames key)
+//returns 0 on success, -1 on failure
+//note that Frame number will be taken only if wParam == 0
+#define MS_CLIST_FRAMES_SHFRAME "CListFrames/SHFrame"
+
+//////////////////////////////////////////////////////////////////////////
+//shows the frame titlebar if it is hidden,
+//hides the frame titlebar if it is shown
+//wParam=FrameId
+//lParam = Frame number (can be shown in profile in CLUIFrames key)
+//returns 0 on success, -1 on failure
+//note that Frame number will be taken only if wParam == 0
+#define MS_CLIST_FRAMES_SHFRAMETITLEBAR "CListFrame/SHFrameTitleBar"
+
+//////////////////////////////////////////////////////////////////////////
+//locks the frame if it is unlocked,
+//unlock the frame if it is locked
+//wParam=FrameId
+//lParam = Frame number (can be shown in profile in CLUIFrames key)
+//returns 0 on success, -1 on failure
+//note that Frame number will be taken only if wParam == 0
+#define MS_CLIST_FRAMES_ULFRAME "CListFrame/ULFrame"
+
+//////////////////////////////////////////////////////////////////////////
+//collapses the frame if it is uncollapsed,
+//uncollapses the frame if it is collapsed
+//wParam=FrameId
+//lParam = Frame number (can be shown in profile in CLUIFrames key)
+//returns 0 on success, -1 on failure
+//note that Frame number will be taken only if wParam == 0
+#define MS_CLIST_FRAMES_UCOLLFRAME "CListFrame/UCOLLFrame"
+
+//////////////////////////////////////////////////////////////////////////
+//trigger border flags
+//wparam=frameid
+//lParam = Frame number (can be shown in profile in CLUIFrames key)
+//returns 0 on success, -1 on failure
+//note that Frame number will be taken only if wParam == 0
+#define MS_CLIST_FRAMES_SETUNBORDER "CListFrame/SetUnBorder"
+
+//////////////////////////////////////////////////////////////////////////
+//trigger skinned flags
+//wparam=frameid
+//lparam=0
+#define MS_CLIST_FRAMES_SETSKINNED "CListFrame/SetSkinnedFrame"
+
+//////////////////////////////////////////////////////////////////////////
+//redraws the frame
+//wParam=FrameId, -1 for all frames
+//lparam=FU_flags
+//returns a pointer to option, -1 on failure
+#define MS_CLIST_FRAMES_UPDATEFRAME "CListFrame/UpdateFrame"
+
+//////////////////////////////////////////////////////////////////////////
+//gets the frame options
+//(HIWORD)wParam=FrameId
+//(LOWORD)wParam=FO_flag
+//lParam=0
+//returns a pointer to option, -1 on failure
+#define MS_CLIST_FRAMES_GETFRAMEOPTIONS "CListFrame/GetFrameOptions"
+
+//sets the frame options
+//(HIWORLD)wParam=FrameId
+//(LOWORD)wParam=FO_flag
+//lParam=value
+//returns 0 on success, -1 on failure
+#define MS_CLIST_FRAMES_SETFRAMEOPTIONS "CListFrame/SetFrameOptions"
+
+//////////////////////////////////////////////////////////////////////////
+//Frames related menu stuff
+//////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////
+//add a new item to the context frame menu
+//wParam=0
+//lParam=(LPARAM)(CLISTMENUITEM*)&mi
+//returns a handle to the new item
+//popupposition=frameid
+//contactowner=advanced parameter
+#define MS_CLIST_ADDCONTEXTFRAMEMENUITEM "CList/AddContextFrameMenuItem"
+
+//////////////////////////////////////////////////////////////////////////
+//remove a item from context frame menu
+//wParam=hMenuItem returned by MS_CLIST_ADDCONTACTMENUITEM
+//lParam=0
+//returns 0 on success, nonzero on failure
+#define MS_CLIST_REMOVECONTEXTFRAMEMENUITEM "CList/RemoveContextFrameMenuItem"
+
+//////////////////////////////////////////////////////////////////////////
+//builds the context menu for a frame
+//wparam=frameid
+//lParam=0
+//returns a HMENU on success, or NULL on failure
+#define MS_CLIST_MENUBUILDFRAMECONTEXT "CList/BuildContextFrameMenu"
+
+//////////////////////////////////////////////////////////////////////////
+// the frame menu is about to be built
+// wparam=frameid
+// lparam=
+// -1 for build from titlebar,
+// use
+// MS_CLIST_ADDCONTEXTFRAMEMENUITEM
+// MS_CLIST_REMOVECONTEXTFRAMEMENUITEM
+//
+// >0 for build in main menu,
+// must be popupname=lparam to place your items in right popup of main menu.
+// use
+// MS_CLIST_ADDMAINMENUITEM
+// MS_CLIST_REMOVEMAINMENUITEM
+//
+#define ME_CLIST_PREBUILDFRAMEMENU "CList/PreBuildFrameMenu"
+
+//////////////////////////////////////////////////////////////////////////
+//needed by cluiframes module to add frames menu to main menu.
+//it just calls NotifyEventHooks(hPreBuildFrameMenuEvent,wParam,lParam);
+#define MS_CLIST_FRAMEMENUNOTIFY "CList/ContextFrameMenuNotify"
+
diff --git a/buddyexpectator/m_popup.h b/buddyexpectator/m_popup.h new file mode 100644 index 0000000..9dc9d61 --- /dev/null +++ b/buddyexpectator/m_popup.h @@ -0,0 +1,418 @@ +/*
+===============================================================================
+ PopUp plugin
+Plugin Name: PopUp
+Plugin authors: Luca Santarelli aka hrk (hrk@users.sourceforge.net)
+ Victor Pavlychko (nullbie@gmail.com)
+===============================================================================
+The purpose of this plugin is to give developers a common "platform/interface"
+to show PopUps. It is born from the source code of NewStatusNotify, another
+plugin I've made.
+
+Remember that users *must* have this plugin enabled, or they won't get any
+popup. Write this in the requirements, do whatever you wish ;-)... but tell
+them!
+===============================================================================
+*/
+
+#ifndef __m_popup_h__
+#define __m_popup_h__
+
+/*
+NOTE! Since Popup 1.0.1.2 there is a main meun group called "PopUps" where I
+have put a "Enable/Disable" item. You can add your own "enable/disable" items
+by adding these lines before you call MS_CLIST_ADDMAINMENUITEM:
+mi.pszPopUpName = Translate("PopUps");
+mi.position = 0; //You don't need it and it's better if you put it to zero.
+*/
+
+#ifndef POPUP_VERSION
+#define POPUP_VERSION 0x02010003
+#endif
+
+#define MAX_CONTACTNAME 2048
+#define MAX_SECONDLINE 2048
+#define MAX_ACTIONTITLE 64
+
+// Popup Action flags
+#define PAF_ENABLED 0x01 // Actions is enabled. You may store one global
+ // action set and toggle some items depending on
+ // popup you are requesting
+
+// ANSI Popup Action
+typedef struct
+{
+ int cbSize; // sizeof(POPUPACTION)
+ HICON lchIcon; // Action Icon
+ union
+ { // Action title text
+ char lptzTitle[MAX_ACTIONTITLE];
+ char lpzTitle[MAX_ACTIONTITLE];
+ };
+ DWORD flags; // set of PAF_* flags
+ WPARAM wParam; // wParam for UM_POPUPACTION message
+ LPARAM lParam; // lParam for UM_POPUPACTION message
+} POPUPACTION, *LPPOPUPACTION;
+
+// Unicode version of POPUPACTION
+typedef struct
+{
+ int cbSize;
+ HICON lchIcon;
+ union
+ {
+ WCHAR lptzTitle[MAX_ACTIONTITLE];
+ WCHAR lpwzTitle[MAX_ACTIONTITLE];
+ };
+ DWORD flags;
+ WPARAM wParam;
+ LPARAM lParam;
+} POPUPACTIONW, *LPPOPUPACTIONW;
+
+// This is the basic data you'll need to fill and pass to the service function.
+typedef struct
+{
+ HANDLE lchContact; // Handle to the contact, can be NULL (main contact).
+ HICON lchIcon; // Handle to a icon to be shown. Cannot be NULL.
+ union
+ {
+ char lptzContactName[MAX_CONTACTNAME]; // This is the contact name or the first line in the plugin. Cannot be NULL.
+ char lpzContactName[MAX_CONTACTNAME];
+ };
+ union
+ {
+ char lptzText[MAX_SECONDLINE]; // This is the second line text. Users can choose to hide it. Cannot be NULL.
+ char lpzText[MAX_SECONDLINE];
+ };
+ COLORREF colorBack; // COLORREF to be used for the background. Can be NULL, default will be used.
+ COLORREF colorText; // COLORREF to be used for the text. Can be NULL, default will be used.
+ WNDPROC PluginWindowProc; // Read below. Can be NULL; default will be used.
+ void * PluginData; // Read below. Can be NULL.
+} POPUPDATA, * LPPOPUPDATA;
+
+// Extended popup data
+typedef struct
+{
+ HANDLE lchContact;
+ HICON lchIcon;
+ union
+ {
+ char lptzContactName[MAX_CONTACTNAME];
+ char lpzContactName[MAX_CONTACTNAME];
+ };
+ union
+ {
+ char lptzText[MAX_SECONDLINE];
+ char lpzText[MAX_SECONDLINE];
+ };
+ COLORREF colorBack;
+ COLORREF colorText;
+ WNDPROC PluginWindowProc;
+ void * PluginData;
+ int iSeconds; // Custom delay time in seconds. -1 means "forever", 0 means "default time".
+
+#if POPUP_VERSION < 0x02010003
+ // For compatability
+ char cZero[16]; // Some unused bytes which may come useful in the future.
+
+#else
+ // you *MUST* pass APT_NEWDATA flag for services to take care of this data
+ HBITMAP hbmAvatar; // Bitmap to use instead of avatar
+ int actionCount; // Amount of passed actions
+ LPPOPUPACTION lpActions; // Popup Actions
+ int cbSize; // struct size for future
+#endif
+} POPUPDATAEX, *LPPOPUPDATAEX;
+
+// Unicode version of POPUPDATAEX
+typedef struct
+{
+ HANDLE lchContact;
+ HICON lchIcon;
+ union
+ {
+ WCHAR lptzContactName[MAX_CONTACTNAME];
+ WCHAR lpwzContactName[MAX_CONTACTNAME];
+ };
+ union
+ {
+ WCHAR lptzText[MAX_CONTACTNAME];
+ WCHAR lpwzText[MAX_CONTACTNAME];
+ };
+ COLORREF colorBack;
+ COLORREF colorText;
+ WNDPROC PluginWindowProc;
+ void * PluginData;
+ int iSeconds;
+#if POPUP_VERSION < 0x02010003
+ char cZero[16];
+#else
+ HBITMAP hbmAvatar;
+ int actionCount;
+ LPPOPUPACTIONW lpActions;
+ int cbSize;
+#endif
+} POPUPDATAW, *LPPOPUPDATAW;
+
+#if defined(_UNICODE) || defined(UNICODE)
+ typedef POPUPDATAW POPUPDATAT;
+ typedef LPPOPUPDATAW LPPOPUPDATAT;
+ typedef POPUPACTIONW POPUPACTIONT;
+ typedef LPPOPUPACTIONW LPPOPUPACTIONT;
+#else
+ typedef POPUPDATAEX POPUPDATAT;
+ typedef LPPOPUPDATAEX LPPOPUPDATAT;
+ typedef POPUPACTION POPUPACTIONT;
+ typedef LPPOPUPACTION LPPOPUPACTIONT;
+#endif
+
+/* PopUp/AddPopup
+Creates, adds and shows a popup, given a (valid) POPUPDATA structure pointer.
+
+wParam = (WPARAM)(*POPUPDATA)PopUpDataAddress
+lParam = 0
+
+Returns: > 0 on success, 0 if creation went bad, -1 if the PopUpData contained unacceptable values.
+NOTE: it returns -1 if the PopUpData was not valid, if there were already too many popups, if the module was disabled.
+Otherwise, it can return anything else...
+
+Popup Plus 2.0.4.0+
+You may pass additional creation flags via lParam:
+ APF_RETURN_HWND ....... function returns handle to newly created popup window (however this calls are a bit slower)
+ APF_CUSTOM_POPUP ...... new popup is created in hidden state and doesn't obey to popup queue rules.
+ you may control it via UM_* messages and custom window procedure (not yet implemented)
+ APF_NO_HISTORY ........ do not log this popup in popup history (useful for previews)
+ APF_NO_POPUP .......... do not show popup. this is useful if you want popup yo be stored in history only
+ APF_NEWDATA ........... use new version of POPUPDATAEX/POPUPDATAW structs
+*/
+#define APF_RETURN_HWND 0x01
+#define APF_CUSTOM_POPUP 0x02
+#define APF_NO_HISTORY 0x04
+#define APF_NO_POPUP 0x08
+#define APF_NEWDATA 0x10
+
+#define MS_POPUP_ADDPOPUP "PopUp/AddPopUp"
+static int __inline PUAddPopUp(POPUPDATA* ppdp) {
+ return CallService(MS_POPUP_ADDPOPUP, (WPARAM)ppdp,0);
+}
+
+#define MS_POPUP_ADDPOPUPEX "PopUp/AddPopUpEx"
+static int __inline PUAddPopUpEx(POPUPDATAEX* ppdp) {
+ return CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)ppdp,0);
+}
+
+#define MS_POPUP_ADDPOPUPW "PopUp/AddPopUpW"
+static int __inline PUAddPopUpW(POPUPDATAW* ppdp) {
+ return CallService(MS_POPUP_ADDPOPUPW, (WPARAM)ppdp,0);
+}
+
+#if defined(_UNICODE) || defined(UNICODE)
+ #define MS_POPUP_ADDPOPUPT MS_POPUP_ADDPOPUPW
+ #define PUAddPopUpT PUAddPopUpW
+#else
+ #define MS_POPUP_ADDPOPUPT MS_POPUP_ADDPOPUPEX
+ #define PUAddPopUpT PUAddPopUpEx
+#endif
+
+
+/* PopUp/GetContact
+Returns the handle to the contact associated to the specified PopUpWindow.
+
+wParam = (WPARAM)(HWND)hPopUpWindow
+lParam = 0;
+
+Returns: the HANDLE of the contact. Can return NULL, meaning it's the main contact. -1 means failure.
+*/
+#define MS_POPUP_GETCONTACT "PopUp/GetContact"
+static HANDLE __inline PUGetContact(HWND hPopUpWindow) {
+ return (HANDLE)CallService(MS_POPUP_GETCONTACT, (WPARAM)hPopUpWindow,0);
+}
+
+/* PopUp/GetPluginData
+Returns custom plugin date associated with popup
+
+wParam = (WPARAM)(HWND)hPopUpWindow
+lParam = (LPARAM)(PLUGINDATA*)PluginDataAddress;
+
+Returns: the address of the PLUGINDATA structure. Can return NULL, meaning nothing was given. -1 means failure.
+
+IMPORTANT NOTE: it doesn't seem to work if you do:
+CallService(..., (LPARAM)aPointerToAStruct);
+and then use that struct.
+Do this, instead:
+aPointerToStruct = CallService(..., (LPARAM)aPointerToAStruct);
+and it will work. Just look at the example I've written above (PopUpDlgProc).
+
+*/
+#define MS_POPUP_GETPLUGINDATA "PopUp/GetPluginData"
+static void __inline * PUGetPluginData(HWND hPopUpWindow) {
+ long * uselessPointer = NULL;
+ return (void*)CallService(MS_POPUP_GETPLUGINDATA,(WPARAM)hPopUpWindow,(LPARAM)uselessPointer);
+}
+
+/* PopUp/IsSecondLineShown
+Checks if second line is enable
+
+wParam = 0
+lParam = 0
+
+Returns: 0 if the user has chosen not to have the second line, 1 if he choose to have the second line.
+*/
+#define MS_POPUP_ISSECONDLINESHOWN "PopUp/IsSecondLineShown"
+static BOOL __inline PUIsSecondLineShown() {
+ return (BOOL)CallService(MS_POPUP_ISSECONDLINESHOWN,0,0);
+}
+
+/* PopUp/Query
+
+Requests an action or an answer from PopUp module.
+
+wParam = (WPARAM)wpQuery
+
+returns 0 on success, -1 on error, 1 on stupid calls ;-)
+*/
+
+#define PUQS_ENABLEPOPUPS 1 // returns 0 if state was changed, 1 if state wasn't changed
+#define PUQS_DISABLEPOPUPS 2 // " "
+#define PUQS_GETSTATUS 3 //Returns 1 (TRUE) if popups are enabled, 0 (FALSE) if popups are disabled.
+
+#define MS_POPUP_QUERY "PopUp/Query"
+
+/* UM_FREEPLUGINDATA
+Process this message if you have allocated your own memory. (i.e.: POPUPDATA.PluginData != NULL)
+
+wParam = 0
+lParam = 0
+*/
+#define UM_FREEPLUGINDATA (WM_USER + 0x0200)
+
+/* UM_DESTROYPOPUP
+Send this message when you want to destroy the popup, or use the function below.
+
+wParam = 0
+lParam = 0
+*/
+#define UM_DESTROYPOPUP (WM_USER + 0x0201)
+static int __inline PUDeletePopUp(HWND hWndPopUp) {
+ return (int)SendMessage(hWndPopUp, UM_DESTROYPOPUP,0,0);
+}
+
+/* UM_INITPOPUP
+This message is sent to the PopUp when its creation has been finished, so POPUPDATA (and thus your PluginData) is reachable.
+Catch it if you needed to catch WM_CREATE or WM_INITDIALOG, which you'll never ever get in your entire popup-life.
+Return value: if you process this message, return 0. If you don't process it, return 0. Do whatever you like ;-)
+
+wParam = (WPARAM)(HWND)hPopUpWindow (this is useless, you get message inside your popup window)
+lParam = 0
+*/
+#define UM_INITPOPUP (WM_USER + 0x0202)
+
+/* PopUp/Changetext
+Changes the text displayed in the second line of the popup.
+
+wParam = (WPARAM)(HWND)hPopUpWindow
+lParam = (LPARAM)(char*)lpzNewText
+
+returns: > 0 for success, -1 for failure, 0 if the failure is due to second line not being shown. (but you could call
+PUIsSecondLineShown() before changing the text...)
+*/
+#define MS_POPUP_CHANGETEXT "PopUp/Changetext"
+static int __inline PUChangeText(HWND hWndPopUp, LPCTSTR lpzNewText) {
+ return (int)CallService(MS_POPUP_CHANGETEXT, (WPARAM)hWndPopUp, (LPARAM)lpzNewText);
+}
+
+#define MS_POPUP_CHANGETEXTW "PopUp/ChangetextW"
+static int __inline PUChangeTextW(HWND hWndPopUp, LPCWSTR lpwzNewText) {
+ return (int)CallService(MS_POPUP_CHANGETEXTW, (WPARAM)hWndPopUp, (LPARAM)lpwzNewText);
+}
+
+#if defined(_UNICODE) || defined(UNICODE)
+ #define MS_POPUP_CHANGETEXTT MS_POPUP_CHANGETEXTW
+ #define PUChangeTextT PUChangeTextW
+#else
+ #define MS_POPUP_CHANGETEXTT MS_POPUP_CHANGETEXT
+ #define PUChangeTextT PUChangeText
+#endif
+
+/* PopUp/Change
+Changes the entire popup
+
+wParam = (WPARAM)(HWND)hPopUpWindow
+lParam = (LPARAM)(POPUPDATAEX*)newData
+*/
+#define MS_POPUP_CHANGE "PopUp/Change"
+static int __inline PUChange(HWND hWndPopUp, POPUPDATAEX *newData) {
+ return (int)CallService(MS_POPUP_CHANGE, (WPARAM)hWndPopUp, (LPARAM)newData);
+}
+
+#define MS_POPUP_CHANGEW "PopUp/ChangeW"
+static int __inline PUChangeW(HWND hWndPopUp, POPUPDATAW *newData) {
+ return (int)CallService(MS_POPUP_CHANGE, (WPARAM)hWndPopUp, (LPARAM)newData);
+}
+
+#if defined(_UNICODE) || defined(UNICODE)
+ #define MS_POPUP_CHANGET MS_POPUP_CHANGEW
+ #define PUChangeT PUChangeW
+#else
+ #define MS_POPUP_CHANGET MS_POPUP_CHANGE
+ #define PUChangeT PUChange
+#endif
+
+/* UM_CHANGEPOPUP
+This message is triggered by Change/ChangeText services. You also may post it directly, but make
+sure you allocate memory via miranda mmi, because popup will mir_free() them!
+
+wParam = Modification type
+lParam = value of type defined by wParam
+*/
+
+#define CPT_TEXT 1 // lParam = (char *)text
+#define CPT_TEXTW 2 // lParam = (WCHAR *)text
+#define CPT_TITLE 3 // lParam = (char *)title
+#define CPT_TITLEW 4 // lParam = (WCHAR *)title
+#define CPT_DATA 5 // lParam = (POPUPDATA *)data
+#define CPT_DATAEX 6 // lParam = (POPUPDATAEX *)data
+#define CPT_DATAW 7 // lParam = (POPUPDATAW *)data
+#define CPT_DATA2 8 // lParam = (POPUPDATA2 *)data -- see m_popup2.h for details
+
+#define UM_CHANGEPOPUP (WM_USER + 0x0203)
+
+#if defined(_UNICODE) || defined(UNICODE)
+ #define CPT_TEXTT CPT_TEXTW
+ #define CPT_TITLET CPT_TITLEW
+ #define CPT_DATAT CPT_DATAW
+#else
+ #define CPT_TEXTT CPT_TEXT
+ #define CPT_TITLET CPT_TITLE
+ #define CPT_DATAT CPT_DATA
+#endif
+
+/* UM_POPUPACTION
+Popup Action notification
+
+wParam and lParam are specified bu plugin.
+wParam = 0 is used buy popup plus internally!
+*/
+
+#define UM_POPUPACTION (WM_USER + 0x0204)
+
+/* PopUp/ShowMessage
+This is mainly for developers.
+Shows a warning message in a PopUp. It's useful if you need a "MessageBox" like function, but you don't want a modal
+window (which will interfere with a DialogProcedure. MessageBox steals focus and control, this one not.
+
+wParam = (char *)lpzMessage
+lParam = 0;
+
+Returns: 0 if the popup was shown, -1 in case of failure.
+*/
+#define SM_WARNING 0x01 //Triangle icon.
+#define SM_NOTIFY 0x02 //Exclamation mark icon.
+#define SM_ERROR 0x03 //Cross icon.
+#define MS_POPUP_SHOWMESSAGE "PopUp/ShowMessage"
+
+static int __inline PUShowMessage(char *lpzText, DWORD kind) {
+ return (int)CallService(MS_POPUP_SHOWMESSAGE, (WPARAM)lpzText,(LPARAM)kind);
+}
+
+#endif // __m_popup_h__
diff --git a/buddyexpectator/m_updater.h b/buddyexpectator/m_updater.h new file mode 100644 index 0000000..488d372 --- /dev/null +++ b/buddyexpectator/m_updater.h @@ -0,0 +1,150 @@ +#ifndef _M_UPDATER_H
+#define _M_UPDATER_H
+
+// NOTES:
+// - For langpack updates, include a string of the following format in the langpack text file:
+// ";FLID: <file listing name> <version>"
+// version must be four numbers seperated by '.', in the range 0-255 inclusive
+// - Updater will disable plugins that are downloaded but were not active prior to the update (this is so that, if an archive contains e.g. ansi and
+// unicode versions, the correct plugin will be the only one active after the new version is installed)...so if you add a support plugin, you may need
+// to install an ini file to make the plugin activate when miranda restarts after the update
+// - Updater will replace all dlls that have the same internal shortName as a downloaded update dll (this is so that msn1.dll and msn2.dll, for example,
+// will both be updated) - so if you have a unicode and a non-unicode version of a plugin in your archive, you should make the internal names different (which will break automatic
+// updates from the file listing if there is only one file listing entry for both versions, unless you use the 'MS_UPDATE_REGISTER' service below)
+// - Updater will install all files in the root of the archive into the plugins folder, except for langpack files that contain the FLID string which go into the root folder (same
+// folder as miranda32.exe)...all folders in the archive will also be copied to miranda's root folder, and their contents transferred into the new folders. The only exception is a
+// special folder called 'root_files' - if there is a folder by that name in the archive, it's contents will also be copied into miranda's root folder - this is intended to be used
+// to install additional dlls etc that a plugin may require)
+
+// if you set Update.szUpdateURL to the following value when registering, as well as setting your beta site and version data,
+// Updater will ignore szVersionURL and pbVersionPrefix, and attempt to find the file listing URL's from the backend XML data.
+// for this to work, the plugin name in pluginInfo.shortName must match the file listing exactly (except for case)
+#define UPDATER_AUTOREGISTER "UpdaterAUTOREGISTER"
+// Updater will also use the backend xml data if you provide URL's that reference the miranda file listing for updates (so you can use that method
+// if e.g. your plugin shortName does not match the file listing) - it will grab the file listing id from the end of these URLs
+
+typedef struct Update_tag {
+ int cbSize;
+ char *szComponentName; // component name as it will appear in the UI (will be translated before displaying)
+
+ char *szVersionURL; // URL where the current version can be found (NULL to disable)
+ BYTE *pbVersionPrefix; // bytes occuring in VersionURL before the version, used to locate the version information within the URL data
+ // (note that this URL could point at a binary file - dunno why, but it could :)
+ int cpbVersionPrefix; // number of bytes pointed to by pbVersionPrefix
+ char *szUpdateURL; // URL where dll/zip is located
+ // set to UPDATER_AUTOREGISTER if you want Updater to find the file listing URLs (ensure plugin shortName matches file listing!)
+
+ char *szBetaVersionURL; // URL where the beta version can be found (NULL to disable betas)
+ BYTE *pbBetaVersionPrefix; // bytes occuring in VersionURL before the version, used to locate the version information within the URL data
+ int cpbBetaVersionPrefix; // number of bytes pointed to by pbVersionPrefix
+ char *szBetaUpdateURL; // URL where dll/zip is located
+
+ BYTE *pbVersion; // bytes of current version, used for comparison with those in VersionURL
+ int cpbVersion; // number of bytes pointed to by pbVersion
+
+ char *szBetaChangelogURL; // url for displaying changelog for beta versions
+} Update;
+
+// register a comonent with Updater
+//
+// wparam = 0
+// lparam = (LPARAM)&Update
+#define MS_UPDATE_REGISTER "Update/Register"
+
+// utility functions to create a version string from a DWORD or from pluginInfo
+// point buf at a buffer at least 16 chars wide - but note the version string returned may be shorter
+//
+__inline static char *CreateVersionString(DWORD version, char *buf) {
+ mir_snprintf(buf, 16, "%d.%d.%d.%d", (version >> 24) & 0xFF, (version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);
+ return buf;
+}
+
+__inline static char *CreateVersionStringPlugin(PLUGININFO *pluginInfo, char *buf) {
+ return CreateVersionString(pluginInfo->version, buf);
+}
+
+__inline static char *CreateVersionStringPluginEx(PLUGININFOEX *pluginInfo, char *buf) {
+ return CreateVersionString(pluginInfo->version, buf);
+}
+
+
+// register the 'easy' way - use this method if you have no beta URL and the plugin is on the miranda file listing
+// NOTE: the plugin version string on the file listing must be the string version of the version in pluginInfo (i.e. 0.0.0.1,
+// four numbers between 0 and 255 inclusivem, so no letters, brackets, etc.)
+//
+// wParam = (int)fileID - this is the file ID from the file listing (i.e. the number at the end of the download link)
+// lParam = (PLUGININFO*)&pluginInfo
+#define MS_UPDATE_REGISTERFL "Update/RegisterFL"
+
+// this function can be used to 'unregister' components - useful for plugins that register non-plugin/langpack components and
+// may need to change those components on the fly
+// lParam = (char *)szComponentName
+#define MS_UPDATE_UNREGISTER "Update/Unregister"
+
+// this event is fired when the startup process is complete, but NOT if a restart is imminent
+// it is designed for status managment plugins to use as a trigger for beggining their own startup process
+// wParam = lParam = 0 (unused)
+// (added in version 0.1.6.0)
+#define ME_UPDATE_STARTUPDONE "Update/StartupDone"
+
+// this service can be used to enable/disable Updater's global status control
+// it can be called from the StartupDone event handler
+// wParam = (BOOL)enable
+// lParam = 0
+// (added in version 0.1.6.0)
+#define MS_UPDATE_ENABLESTATUSCONTROL "Update/EnableStatusControl"
+
+// An description of usage of the above service and event:
+// Say you are a status control plugin that normally sets protocol or global statuses in your ModulesLoaded event handler.
+// In order to make yourself 'Updater compatible', you would move the status control code from ModulesLoaded to another function,
+// say DoStartup. Then, in ModulesLoaded you would check for the existence of the MS_UPDATE_ENABLESTATUSCONTROL service.
+// If it does not exist, call DoStartup. If it does exist, hook the ME_UPDATE_STARTUPDONE event and call DoStartup from there. You may
+// also wish to call MS_UPDATE_ENABLESTATUSCONTROL with wParam == FALSE at this time, to disable Updater's own status control feature.
+
+// this service can be used to determine whether updates are possible for a component with the given name
+// wParam = 0
+// lParam = (char *)szComponentName
+// returns TRUE if updates are supported, FALSE otherwise
+#define MS_UPDATE_ISUPDATESUPPORTED "Update/IsUpdateSupported"
+
+#endif
+
+
+/////////////// Usage Example ///////////////
+
+#ifdef EXAMPLE_CODE
+
+// you need to #include "m_updater.h" and HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded) in your Load function...
+
+int OnModulesLoaded(WPARAM wParam, LPARAM lParam) {
+
+ Update update = {0}; // for c you'd use memset or ZeroMemory...
+ char szVersion[16];
+
+ update.cbSize = sizeof(Update);
+
+ update.szComponentName = pluginInfo.shortName;
+ update.pbVersion = (BYTE *)CreateVersionString(&pluginInfo, szVersion);
+ update.cpbVersion = strlen((char *)update.pbVersion);
+
+ // these are the three lines that matter - the archive, the page containing the version string, and the text (or data)
+ // before the version that we use to locate it on the page
+ // (note that if the update URL and the version URL point to standard file listing entries, the backend xml
+ // data will be used to check for updates rather than the actual web page - this is not true for beta urls)
+ update.szUpdateURL = "http://scottellis.com.au:81/test/updater.zip";
+ update.szVersionURL = "http://scottellis.com.au:81/test/updater_test.html";
+ update.pbVersionPrefix = (BYTE *)"Updater version ";
+
+ update.cpbVersionPrefix = strlen((char *)update.pbVersionPrefix);
+
+ // do the same for the beta versions of the above struct members if you wish to allow beta updates from another URL
+
+ CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
+
+ // Alternatively, to register a plugin with e.g. file ID 2254 on the file listing...
+ // CallService(MS_UPDATE_REGISTERFL, (WPARAM)2254, (LPARAM)&pluginInfo);
+
+ return 0;
+}
+
+#endif
diff --git a/buddyexpectator/options.cpp b/buddyexpectator/options.cpp new file mode 100644 index 0000000..6ebe7f3 --- /dev/null +++ b/buddyexpectator/options.cpp @@ -0,0 +1,628 @@ +/*
+ Buddy Expectator+ plugin for Miranda-IM (www.miranda-im.org)
+ (c)2005 Anar Ibragimoff (ai91@mail.ru)
+ (c)2006 Scott Ellis (mail@scottellis.com.au)
+ (c)2007,2008 Alexander Turyak (thief@miranda-im.org.ua)
+
+ 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: http://svn.miranda.im/mainrepo/buddyexpectator/trunk/options.cpp $
+ Revision : $Rev: 1003 $
+ Last change on : $Date: 2008-01-12 17:15:47 +0200 (Сб, 12 янв 2008) $
+ Last change by : $Author: Thief $
+*/
+
+#include "common.h"
+#include "options.h"
+
+#define DEF_COLOR_BACK 0xCEF7AD
+#define DEF_COLOR_FORE 0x000000
+
+extern HICON hIcon;
+extern time_t getLastSeen(HANDLE);
+extern time_t getLastInputMsg(HANDLE);
+extern bool isContactGoneFor(HANDLE, int);
+Options options;
+
+void LoadOptions()
+{
+ options.iAbsencePeriod = DBGetContactSettingDword(NULL, MODULE_NAME, "iAbsencePeriod", 14);
+ options.iAbsencePeriod2 = DBGetContactSettingDword(NULL, MODULE_NAME, "iAbsencePeriod2", 30 * 3);
+ options.iSilencePeriod = DBGetContactSettingDword(NULL, MODULE_NAME, "iSilencePeriod", 30);
+ options.iShowPopUp = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowPopUp", 1);
+ options.iShowEvent = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowEvent", 0);
+ options.iShowUDetails = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowUDetails", 0);
+ options.iShowMessageWindow = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowMessageWindow", 1);
+ options.iPopUpColorBack = DBGetContactSettingDword(NULL, MODULE_NAME, "iPopUpColorBack", DEF_COLOR_BACK);
+ options.iPopUpColorFore = DBGetContactSettingDword(NULL, MODULE_NAME, "iPopUpColorFore", DEF_COLOR_FORE);
+ options.iUsePopupColors = DBGetContactSettingByte(NULL, MODULE_NAME, "iUsePopupColors", 0);
+ options.iUseWinColors = DBGetContactSettingByte(NULL, MODULE_NAME, "iUseWinColors", 0);
+ options.iPopUpDelay = DBGetContactSettingByte(NULL, MODULE_NAME, "iPopUpDelay", 0);
+
+ options.iShowPopUp2 = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowPopUp2", 1);
+ options.iShowEvent2 = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowEvent2", 0);
+ options.action2 = (GoneContactAction)DBGetContactSettingByte(NULL, MODULE_NAME, "Action2", (BYTE)GCA_NOACTION);
+ options.notifyFirstOnline = DBGetContactSettingByte(NULL, MODULE_NAME, "bShowFirstSight", 0) ? true : false;
+ options.hideInactive = DBGetContactSettingByte(NULL, MODULE_NAME, "bHideInactive", 0) ? true : false;
+ options.enableMissYou = DBGetContactSettingByte(NULL, MODULE_NAME, "bMissYouEnabled", 1) ? true : false;
+ options.MissYouIcon = DBGetContactSettingByte(NULL, MODULE_NAME, "bMissYouIcon", 0);
+}
+
+void SaveOptions()
+{
+ DBWriteContactSettingDword(NULL, MODULE_NAME, "iAbsencePeriod", options.iAbsencePeriod);
+ DBWriteContactSettingDword(NULL, MODULE_NAME, "iAbsencePeriod2", options.iAbsencePeriod2);
+ DBWriteContactSettingDword(NULL, MODULE_NAME, "iSilencePeriod", options.iSilencePeriod);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowPopUp", options.iShowPopUp);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowEvent", options.iShowEvent);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowUDetails", options.iShowUDetails);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowMessageWindow", options.iShowMessageWindow);
+
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowPopUp2", options.iShowPopUp2);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowEvent2", options.iShowEvent2);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "Action2", (BYTE)options.action2);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "bShowFirstSight", options.notifyFirstOnline ? 1 : 0);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "bHideInactive", options.hideInactive ? 1 : 0);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "bMissYouEnabled", options.enableMissYou ? 1 : 0);
+}
+
+
+void SavePopupOptions()
+{
+ DBWriteContactSettingDword(NULL, MODULE_NAME, "iPopUpColorBack", options.iPopUpColorBack);
+ DBWriteContactSettingDword(NULL, MODULE_NAME, "iPopUpColorFore", options.iPopUpColorFore);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "iUsePopupColors", options.iUsePopupColors);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "iUseWinColors", options.iUseWinColors);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "iPopUpDelay", options.iPopUpDelay);
+}
+
+/**
+ * Options panel function
+ */
+static int CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+
+ if (!ServiceExists(MS_POPUP_ADDPOPUP))
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK_POPUP), FALSE);
+ }
+
+ //iAbsencePeriod
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_RESETCONTENT, 0, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_ADDSTRING, 0, (LPARAM) Translate("days"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_ADDSTRING, 0, (LPARAM) Translate("weeks"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_ADDSTRING, 0, (LPARAM) Translate("months"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_ADDSTRING, 0, (LPARAM) Translate("years"));
+ if (options.iAbsencePeriod % 365 == 0)
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, options.iAbsencePeriod/365, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_SETCURSEL, 3, 0);
+ }
+ else if (options.iAbsencePeriod % 30 == 0)
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, options.iAbsencePeriod/30, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_SETCURSEL, 2, 0);
+ }
+ else if (options.iAbsencePeriod % 7 == 0)
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, options.iAbsencePeriod/7, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_SETCURSEL, 1, 0);
+ }
+ else
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, options.iAbsencePeriod, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_SETCURSEL, 0, 0);
+ }
+
+ //iAbsencePeriod2
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_RESETCONTENT, 0, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_ADDSTRING, 0, (LPARAM) Translate("days"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_ADDSTRING, 0, (LPARAM) Translate("weeks"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_ADDSTRING, 0, (LPARAM) Translate("months"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_ADDSTRING, 0, (LPARAM) Translate("years"));
+ if (options.iAbsencePeriod2 % 365 == 0)
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, options.iAbsencePeriod2/365, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_SETCURSEL, 3, 0);
+ }
+ else if (options.iAbsencePeriod2 % 30 == 0)
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, options.iAbsencePeriod2/30, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_SETCURSEL, 2, 0);
+ }
+ else if (options.iAbsencePeriod2 % 7 == 0)
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, options.iAbsencePeriod2/7, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_SETCURSEL, 1, 0);
+ }
+ else
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2,options.iAbsencePeriod2, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_SETCURSEL, 0, 0);
+ }
+
+ //iSilencePeriod
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_RESETCONTENT, 0, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_ADDSTRING, 0, (LPARAM) Translate("days"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_ADDSTRING, 0, (LPARAM) Translate("weeks"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_ADDSTRING, 0, (LPARAM) Translate("months"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_ADDSTRING, 0, (LPARAM) Translate("years"));
+ if (options.iSilencePeriod % 365 == 0)
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, options.iSilencePeriod/365, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_SETCURSEL, 3, 0);
+ }
+ else if (options.iSilencePeriod % 30 == 0)
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, options.iSilencePeriod/30, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_SETCURSEL, 2, 0);
+ }
+ else if (options.iSilencePeriod % 7 == 0)
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, options.iSilencePeriod/7, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_SETCURSEL, 1, 0);
+ }
+ else
+ {
+ SetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR,options.iSilencePeriod, FALSE);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_SETCURSEL, 0, 0);
+ }
+
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_POPUP), BM_SETCHECK, options.iShowPopUp > 0 ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FLASHICON), BM_SETCHECK, options.iShowEvent > 0 ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_UDETAILS), BM_SETCHECK, (options.iShowUDetails > 0 ? BST_CHECKED : BST_UNCHECKED), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_MSGWINDOW), BM_SETCHECK, (options.iShowMessageWindow > 0 ? BST_CHECKED : BST_UNCHECKED), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FIRSTSIGHT), BM_SETCHECK, options.notifyFirstOnline ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_NOMSGS), BM_SETCHECK, options.hideInactive ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_MISSYOU), BM_SETCHECK, options.enableMissYou ? BST_CHECKED : BST_UNCHECKED, 0);
+
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_POPUP2), BM_SETCHECK, options.iShowPopUp2 > 0 ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FLASHICON2), BM_SETCHECK, options.iShowEvent2 > 0 ? BST_CHECKED : BST_UNCHECKED, 0);
+
+
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_RESETCONTENT, 0, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_ADDSTRING, 0, (LPARAM) Translate("Do nothing"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_ADDSTRING, 0, (LPARAM) Translate("Delete the contact"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_ADDSTRING, 0, (LPARAM) Translate("Open User Details"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_ADDSTRING, 0, (LPARAM) Translate("Open message window"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_SETCURSEL, options.action2, 0);
+
+ return TRUE;
+ case WM_COMMAND:
+ if ((HIWORD(wParam) == BN_CLICKED) || (HIWORD(wParam) == CBN_SELCHANGE)
+ || ((HIWORD(wParam) == EN_CHANGE) && (SendMessage(GetDlgItem(hwndDlg, IDC_EDIT_ABSENCE), EM_GETMODIFY, 0, 0)))
+ || ((HIWORD(wParam) == EN_CHANGE) && (SendMessage(GetDlgItem(hwndDlg, IDC_EDIT_ABSENCE2), EM_GETMODIFY, 0, 0)))
+ || ((HIWORD(wParam) == EN_CHANGE) && (SendMessage(GetDlgItem(hwndDlg, IDC_EDIT_SILENTFOR), EM_GETMODIFY, 0, 0))))
+ {
+ SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
+ }
+ break;
+ case WM_NOTIFY:
+ {
+ NMHDR* nmhdr = (NMHDR*)lParam;
+ switch (nmhdr->code)
+ {
+ case PSN_APPLY:
+
+ //iAbsencePeriod
+ int num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, 0, FALSE);
+ switch (SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD), CB_GETCURSEL, 0, 0))
+ {
+ case 1: options.iAbsencePeriod = 7 * num; break;
+ case 2: options.iAbsencePeriod = 30 * num; break;
+ case 3: options.iAbsencePeriod = 365 * num; break;
+ default: options.iAbsencePeriod = num; break;
+ }
+
+ //iAbsencePeriod2
+ num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, 0, FALSE);
+ switch (SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD2), CB_GETCURSEL, 0, 0))
+ {
+ case 1: options.iAbsencePeriod2 = 7 * num; break;
+ case 2: options.iAbsencePeriod2 = 30 * num; break;
+ case 3: options.iAbsencePeriod2 = 365 * num; break;
+ default: options.iAbsencePeriod2 = num; break;
+ }
+
+ //iSilencePeriod
+ num = GetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, 0, FALSE);
+ switch (SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_PERIOD3), CB_GETCURSEL, 0, 0))
+ {
+ case 1: options.iSilencePeriod = 7 * num; break;
+ case 2: options.iSilencePeriod = 30 * num; break;
+ case 3: options.iSilencePeriod = 365 * num; break;
+ default: options.iSilencePeriod = num; break;
+ }
+
+ options.iShowPopUp = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_POPUP), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
+ options.iShowEvent = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FLASHICON), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
+ options.iShowUDetails = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_UDETAILS), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
+ options.iShowMessageWindow = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_MSGWINDOW), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
+ options.notifyFirstOnline = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FIRSTSIGHT), BM_GETCHECK, 0, 0) == BST_CHECKED ? true : false;
+ options.hideInactive = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_NOMSGS), BM_GETCHECK, 0, 0) == BST_CHECKED ? true : false;
+ options.enableMissYou = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_MISSYOU), BM_GETCHECK, 0, 0) == BST_CHECKED ? true : false;
+
+ options.iShowPopUp2 = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_POPUP2), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
+ options.iShowEvent2 = SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_FLASHICON2), BM_GETCHECK, 0, 0) == BST_CHECKED ? 1:0;
+
+ options.action2 = (GoneContactAction)SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_ACTIONS), CB_GETCURSEL, 0, 0);
+
+ // save values to the DB
+ SaveOptions();
+
+ // clear all notified settings
+ HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ while (hContact != 0)
+ {
+ if(DBGetContactSettingByte(hContact, MODULE_NAME, "StillAbsentNotified", 0))
+ DBWriteContactSettingByte(hContact, MODULE_NAME, "StillAbsentNotified", 0);
+
+ hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ }
+
+ // restart timer & run check
+ KillTimer(0, timer_id);
+ timer_id = SetTimer(0, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours
+ TimerProc(0, 0, 0, 0);
+ return TRUE;
+ }
+ break;
+ }
+ }
+ return 0;
+}
+
+/**
+ * PopUp Options panel function
+ */
+static int CALLBACK PopUpOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ static int ChangeLock = 0;
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+
+ ChangeLock++;
+ TranslateDialogDefault(hwndDlg);
+
+ //iPopUpColorBack
+ SendDlgItemMessage(hwndDlg, IDC_COLOR_BGR, CPM_SETCOLOUR, 0, options.iPopUpColorBack);
+
+ //iPopUpColorFore
+ SendDlgItemMessage(hwndDlg, IDC_COLOR_FRG, CPM_SETCOLOUR, 0, options.iPopUpColorFore);
+
+ if (options.iUsePopupColors)
+ {
+ CheckDlgButton(hwndDlg, IDC_COLORS_POPUP, BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_WIN), false);
+ }
+
+ if (options.iUseWinColors)
+ {
+ CheckDlgButton(hwndDlg, IDC_COLORS_WIN, BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_POPUP), false);
+ }
+
+ //iPopUpDelay
+ SetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, 5, FALSE);
+ if (options.iPopUpDelay < 0)
+ {
+ SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_PERM), BM_SETCHECK, BST_CHECKED, 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_POPUPDELAY), false);
+ }
+ else if(options.iPopUpDelay == 0)
+ {
+ SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_DEF), BM_SETCHECK, BST_CHECKED, 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_POPUPDELAY), false);
+ }
+ else
+ {
+ SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_CUST), BM_SETCHECK, BST_CHECKED, 0);
+ SetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, options.iPopUpDelay, FALSE);
+ }
+
+ ChangeLock--;
+ return TRUE;
+ case WM_COMMAND:
+ if (LOWORD(wParam) == IDC_PREVIEW)
+ {
+ POPUPDATAEX ppd;
+ ZeroMemory(&ppd, sizeof(ppd));
+
+ //iPopUpDelay
+ options.iPopUpDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, 0, FALSE);
+ if (SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_PERM), BM_GETCHECK, 0, 0) == BST_CHECKED)
+ {
+ options.iPopUpDelay = -1;
+ }
+ else if (SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_DEF), BM_GETCHECK, 0, 0) == BST_CHECKED)
+ {
+ options.iPopUpDelay = 0;
+ }
+ ppd.lchContact = NULL;
+ ppd.lchIcon = hIcon;
+ strncpy(ppd.lpzContactName, Translate("Contact name"), MAX_CONTACTNAME);
+ char szPreviewText[50];
+ mir_snprintf(szPreviewText,50,Translate("has returned after being absent since %d days"),rand() % 30);
+ strncpy(ppd.lpzText, szPreviewText, MAX_SECONDLINE);
+
+ // Get current popups colors options
+ if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_POPUP))
+ {
+ ppd.colorBack = ppd.colorText = 0;
+ }
+ else if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_WIN))
+ {
+ ppd.colorBack = GetSysColor(COLOR_BTNFACE);
+ ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ }
+ else
+ {
+ ppd.colorBack = SendDlgItemMessage(hwndDlg, IDC_COLOR_BGR, CPM_GETCOLOUR, 0, 0);
+ ppd.colorText = SendDlgItemMessage(hwndDlg, IDC_COLOR_FRG, CPM_GETCOLOUR, 0, 0);
+ }
+ ppd.PluginData = NULL;
+ ppd.iSeconds = options.iPopUpDelay;
+
+ CallService(MS_POPUP_ADDPOPUPEX, (WPARAM) &ppd, APF_NO_HISTORY);
+
+ strncpy(ppd.lpzText, Translate("You awaited this contact!"), MAX_SECONDLINE);
+ ppd.lchIcon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"enabled_icon");;
+
+ CallService(MS_POPUP_ADDPOPUPEX, (WPARAM) &ppd, APF_NO_HISTORY);
+ }
+ else
+ {
+ if ((HIWORD(wParam) == BN_CLICKED) || (HIWORD(wParam) == CBN_SELCHANGE) || ((HIWORD(wParam) == EN_CHANGE) && !ChangeLock)){
+ SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
+ }
+ if (LOWORD(wParam) == IDC_COLORS_POPUP)
+ {
+ if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_POPUP))
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_WIN), false);
+ }
+ else
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), true);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), true);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_WIN), true);
+ }
+ }
+ if (LOWORD(wParam) == IDC_COLORS_WIN)
+ {
+ if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_WIN))
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), false);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_POPUP), false);
+ }
+ else
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BGR), true);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_FRG), true);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLORS_POPUP), true);
+ }
+ }
+ if (LOWORD(wParam) == IDC_DELAY_DEF || LOWORD(wParam) == IDC_DELAY_PERM)
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_POPUPDELAY), false);
+ }
+ else if (LOWORD(wParam) == IDC_DELAY_CUST)
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_POPUPDELAY), true);
+ }
+ }
+
+ break;
+ case WM_NOTIFY:{
+ NMHDR* nmhdr = (NMHDR*)lParam;
+ switch (nmhdr->code)
+ {
+ case PSN_APPLY:
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_POPUP))
+ {
+ options.iUsePopupColors = 1;
+ options.iUseWinColors = 0;
+ }
+ else if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_WIN))
+ {
+ options.iUseWinColors = 1;
+ options.iUsePopupColors = 0;
+ options.iPopUpColorBack = GetSysColor(COLOR_BTNFACE);
+ options.iPopUpColorFore = GetSysColor(COLOR_WINDOWTEXT);
+ }
+ else
+ {
+ options.iUseWinColors = options.iUsePopupColors = 0;
+ options.iPopUpColorBack = SendDlgItemMessage(hwndDlg, IDC_COLOR_BGR, CPM_GETCOLOUR, 0, 0);
+ options.iPopUpColorFore = SendDlgItemMessage(hwndDlg, IDC_COLOR_FRG, CPM_GETCOLOUR, 0, 0);
+ }
+
+ //iPopUpDelay
+ options.iPopUpDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, 0, FALSE);
+ if (SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_PERM), BM_GETCHECK, 0, 0) == BST_CHECKED)
+ {
+ options.iPopUpDelay = -1;
+ }
+ else if (SendMessage(GetDlgItem(hwndDlg, IDC_DELAY_DEF), BM_GETCHECK, 0, 0) == BST_CHECKED)
+ {
+ options.iPopUpDelay = 0;
+ }
+
+ // save value to the DB
+ SavePopupOptions();
+
+ return TRUE;
+ }
+ break;
+ }
+ }
+ return 0;
+}
+
+/**
+ * Init options panel
+ */
+static int OptionsInit(WPARAM wParam, LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp;
+ ZeroMemory(&odp, sizeof(odp));
+ odp.cbSize = sizeof(odp);
+ odp.hInstance = hInst;
+ odp.pszGroup = Translate("Plugins");
+ odp.pszTemplate = MAKEINTRESOURCE(IDD_OPTIONSPANEL);
+ odp.pszTitle = Translate("Buddy Expectator");
+ odp.pfnDlgProc = OptionsFrameProc;
+ odp.flags = ODPF_BOLDGROUPS;
+ CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+
+ if (ServiceExists(MS_POPUP_ADDPOPUP))
+ {
+ odp.pszGroup = Translate("PopUps");
+ odp.pszTemplate = MAKEINTRESOURCE(IDD_POPUPPANEL);
+ odp.pfnDlgProc = PopUpOptionsFrameProc;
+ CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ }
+
+ return 0;
+}
+
+BOOL CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ {
+ time_t tmpTime;
+ char tmpBuf[51] = {0};
+ tmpTime = getLastSeen((HANDLE)lparam);
+ if (tmpTime == -1)
+ SetDlgItemText(hdlg, IDC_EDIT_LASTSEEN, Translate("not detected"));
+ else
+ {
+ /*
+ int status = DBGetContactSettingWord((HANDLE)lparam, MODULE_NAME, "LastStatus", ID_STATUS_OFFLINE);
+ char *strptr = (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, (LPARAM)0);
+ */
+ strftime(tmpBuf, 50, "%#x", gmtime(&tmpTime));
+ SetDlgItemText(hdlg, IDC_EDIT_LASTSEEN, tmpBuf);
+ }
+
+ tmpTime = getLastInputMsg((HANDLE)lparam);
+ if (tmpTime == -1)
+ SetDlgItemText(hdlg, IDC_EDIT_LASTINPUT, Translate("not found"));
+ else
+ {
+ strftime(tmpBuf, 50, "%#x", gmtime(&tmpTime));
+ SetDlgItemText(hdlg, IDC_EDIT_LASTINPUT, tmpBuf);
+ }
+
+ unsigned int AbsencePeriod = DBGetContactSettingDword((HANDLE)lparam, MODULE_NAME, "iAbsencePeriod", options.iAbsencePeriod);
+
+ SendDlgItemMessage(hdlg, IDC_SPINABSENCE, UDM_SETRANGE, 0, MAKELONG(999, 1));
+ SetDlgItemInt(hdlg, IDC_EDITABSENCE, AbsencePeriod, FALSE);
+
+ if (isContactGoneFor((HANDLE)lparam, options.iAbsencePeriod2))
+ {
+ SetDlgItemText(hdlg, IDC_EDIT_WILLNOTICE, Translate("This contact has been absent for an extended period of time."));
+ }
+ else
+ {
+ SetDlgItemText(hdlg, IDC_EDIT_WILLNOTICE, "");
+ }
+
+ SendMessage(GetDlgItem(hdlg, IDC_CHECK_MISSYOU), BM_SETCHECK, DBGetContactSettingByte((HANDLE)lparam, MODULE_NAME, "MissYou", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hdlg, IDC_CHECK_NOTIFYALWAYS), BM_SETCHECK, DBGetContactSettingByte((HANDLE)lparam, MODULE_NAME, "MissYouNotifyAlways", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
+ SendMessage(GetDlgItem(hdlg, IDC_CHECK_NEVERHIDE), BM_SETCHECK, DBGetContactSettingByte((HANDLE)lparam, MODULE_NAME, "NeverHide", 0) ? BST_CHECKED : BST_UNCHECKED, 0);
+
+ TranslateDialogDefault(hdlg);
+
+ return TRUE;
+ }
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lparam)->idFrom)
+ {
+ case 0:
+ switch (((LPNMHDR)lparam)->code)
+ {
+ case (PSN_APPLY):
+ {
+ HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lparam)->lParam;
+ if (hContact)
+ {
+ DBWriteContactSettingDword(hContact, MODULE_NAME, "iAbsencePeriod", GetDlgItemInt(hdlg, IDC_EDITABSENCE, 0, FALSE));
+ DBWriteContactSettingByte(hContact, MODULE_NAME, "MissYou", (SendMessage(GetDlgItem(hdlg, IDC_CHECK_MISSYOU), BM_GETCHECK, 0, 0) == BST_CHECKED) ? 1 : 0);
+ DBWriteContactSettingByte(hContact, MODULE_NAME, "MissYouNotifyAlways", (SendMessage(GetDlgItem(hdlg, IDC_CHECK_NOTIFYALWAYS), BM_GETCHECK, 0, 0) == BST_CHECKED) ? 1 : 0);
+ DBWriteContactSettingByte(hContact, MODULE_NAME, "NeverHide", (SendMessage(GetDlgItem(hdlg, IDC_CHECK_NEVERHIDE), BM_GETCHECK, 0, 0) == BST_CHECKED) ? 1 : 0);
+ }
+ break;
+ }
+ }
+ break;
+ }
+ break;
+
+ case WM_COMMAND:
+ if (wparam == MAKEWPARAM(IDC_EDITABSENCE, EN_CHANGE))
+ SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
+ else if (LOWORD(wparam) == IDCANCEL)
+ SendMessage(GetParent(hdlg), msg, wparam, lparam);
+ break;
+ }
+
+ return FALSE;
+}
+
+int UserinfoInit(WPARAM wparam, LPARAM lparam)
+{
+ if (lparam > 0)
+ {
+ OPTIONSDIALOGPAGE uip = {0};
+ uip.cbSize = sizeof(uip);
+ uip.hInstance = hInst;
+ uip.pszTemplate = MAKEINTRESOURCE(IDD_USERINFO);
+ uip.pszTitle = Translate("Buddy Expectator");
+ uip.pfnDlgProc = UserinfoDlgProc;
+
+ CallService(MS_USERINFO_ADDPAGE, wparam, (LPARAM)&uip);
+ }
+ return 0;
+}
+
+
+HANDLE hEventOptInitialise;
+void InitOptions()
+{
+ LoadOptions();
+ hEventOptInitialise = HookEvent(ME_OPT_INITIALISE, OptionsInit);
+}
+
+void DeinitOptions()
+{
+ UnhookEvent(hEventOptInitialise);
+}
diff --git a/buddyexpectator/options.h b/buddyexpectator/options.h new file mode 100644 index 0000000..ade65c5 --- /dev/null +++ b/buddyexpectator/options.h @@ -0,0 +1,64 @@ +/*
+ Buddy Expectator+ plugin for Miranda-IM (www.miranda-im.org)
+ (c)2005 Anar Ibragimoff (ai91@mail.ru)
+ (c)2006 Scott Ellis (mail@scottellis.com.au)
+ (c)2007,2008 Alexander Turyak (thief@miranda-im.org.ua)
+
+ 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: http://svn.miranda.im/mainrepo/buddyexpectator/trunk/options.h $
+ Revision : $Rev: 1003 $
+ Last change on : $Date: 2008-01-12 17:15:47 +0200 (Сб, 12 янв 2008) $
+ Last change by : $Author: Thief $
+*/
+
+#ifndef _OPTIONS_INC
+#define _OPTIONS_INC
+
+typedef enum GoneContactAction { GCA_NOACTION, GCA_DELETE, GCA_UDETAILS, GCA_MESSAGE };
+
+typedef struct {
+ int iAbsencePeriod; // notify period for returning contacts
+ int iShowPopUp;
+ int iShowEvent;
+ int iShowUDetails;
+ int iShowMessageWindow;
+
+ bool notifyFirstOnline;
+ bool enableMissYou;
+ bool hideInactive;
+ byte MissYouIcon;
+
+ int iAbsencePeriod2; // notify period for contacts that have remained away
+ int iShowPopUp2;
+ int iShowEvent2;
+ GoneContactAction action2;
+
+ int iSilencePeriod; // notify period for contacts that didn't send messages
+
+ int iPopUpColorBack;
+ int iPopUpColorFore;
+ int iPopUpDelay;
+ int iUsePopupColors;
+ int iUseWinColors;
+
+} Options;
+
+extern Options options;
+
+void InitOptions();
+void DeinitOptions();
+
+#endif
diff --git a/buddyexpectator/resource.h b/buddyexpectator/resource.h new file mode 100644 index 0000000..b06406a --- /dev/null +++ b/buddyexpectator/resource.h @@ -0,0 +1,56 @@ +//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by BuddyExpectator.rc
+//
+#define IDI_MAINICON 101
+#define IDI_ENABLED 102
+#define IDI_DISABLED 103
+#define IDI_HIDE 104
+#define IDI_NEVERHIDE 105
+#define IDD_OPTIONSPANEL 201
+#define IDD_POPUPPANEL 202
+#define IDD_USERINFO 203
+#define IDC_CHECK_POPUP 1000
+#define IDC_CHECK_POPUP2 1001
+#define IDC_CHECK_UDETAILS 1002
+#define IDC_CHECK_MSGWINDOW 1003
+#define IDC_CHECK_FLASHICON 1004
+#define IDC_CHECK_FLASHICON2 1005
+#define IDC_CHECK_FIRSTSIGHT 1006
+#define IDC_COMBO_PERIOD 1011
+#define IDC_COMBO_PERIOD2 1012
+#define IDC_COMBO_PERIOD3 1013
+#define IDC_COLOR_FRG 1021
+#define IDC_COLOR_BGR 1022
+#define IDC_COLORS_POPUP 1023
+#define IDC_COLORS_WIN 1024
+#define IDC_DELAY_DEF 1031
+#define IDC_DELAY_CUST 1032
+#define IDC_DELAY_PERM 1033
+#define IDC_EDIT_ABSENCE 1041
+#define IDC_EDIT_ABSENCE2 1042
+#define IDC_EDIT_POPUPDELAY 1043
+#define IDC_EDIT_SILENTFOR 1044
+#define IDC_EDIT_LASTSEEN 1045
+#define IDC_EDIT_LASTINPUT 1046
+#define IDC_EDIT_NOINPUTFOR 1047
+#define IDC_EDIT_WILLNOTICE 1048
+#define IDC_PREVIEW 1061
+#define IDC_CHECK_MISSYOU 1203
+#define IDC_EDITABSENCE 1204
+#define IDC_SPINABSENCE 1205
+#define IDC_CHECK_NOMSGS 1208
+#define IDC_COMBO_ACTIONS 1209
+#define IDC_CHECK_NEVERHIDE 1210
+#define IDC_CHECK_NOTIFYALWAYS 1211
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 106
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1212
+#define _APS_NEXT_SYMED_VALUE 121
+#endif
+#endif
|