int TlenOnModulesLoaded(void *ptr, WPARAM wParam, LPARAM lParam) { char str[128]; TlenProtocol *proto = (TlenProtocol *)ptr; /* Set all contacts to offline */ HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); while (hContact != NULL) { char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0); if(szProto!=NULL && !strcmp(szProto, proto->iface.m_szModuleName)) { if (DBGetContactSettingWord(hContact, proto->iface.m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) { DBWriteContactSettingWord(hContact, proto->iface.m_szModuleName, "Status", ID_STATUS_OFFLINE); } } hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); } TlenMUCInit(proto); sprintf(str, "%s", Translate("Incoming mail")); SkinAddNewSoundEx("TlenMailNotify", proto->iface.m_szProtoName, str); sprintf(str, "%s", Translate("Alert")); SkinAddNewSoundEx("TlenAlertNotify", proto->iface.m_szProtoName, str); sprintf(str, "%s", Translate("Voice chat")); SkinAddNewSoundEx("TlenVoiceNotify", proto->iface.m_szProtoName, str); HookEventObj_Ex(ME_USERINFO_INITIALISE, proto, TlenUserInfoInit); return 0; }
extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfo); mir_getCLI(); InitCommonControls(); g_hSendWindowList = WindowList_Create(); g_hRecvWindowList = WindowList_Create(); //init hooks HookEvent(ME_SYSTEM_MODULESLOADED, HookModulesLoaded); HookEvent(ME_DB_EVENT_ADDED, HookDBEventAdded); HookEvent(ME_DB_CONTACT_DELETED, HookContactDeleted); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, HookContactSettingChanged); //create services CreateServiceFunction(MS_CONTACTS_SEND, ServiceSendCommand); CreateServiceFunction(MS_CONTACTS_RECEIVE, ServiceReceiveCommand); //define event sounds SkinAddNewSoundEx("RecvContacts", LPGEN("Incoming Contacts"), LPGEN("Events"), "contacts.wav"); SkinAddNewSoundEx("SentContacts", LPGEN("Outgoing Contacts"), LPGEN("Events"), "ocontacts.wav"); return 0; }
int LoadModules(void) { HookEvent(ME_OPT_INITIALISE,OptInitialise); HookEvent(ME_CLIST_PREBUILDCONTACTMENU,SmsRebuildContactMenu); HookEvent(ME_PROTO_ACK,handleAckSMS); HookEvent(ME_DB_EVENT_ADDED,handleNewMessage); HookEvent(ME_PROTO_ACCLISTCHANGED,RefreshAccountList); char szServiceFunction[MAX_PATH]; mir_snprintf(szServiceFunction,sizeof(szServiceFunction),"%s%s",PROTOCOL_NAMEA,SMS_SEND); CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 300050000; mi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_SMS); mi.ptszName = SMS_SEND_STR; mi.pszService = szServiceFunction; mi.flags = CMIF_TCHAR; Menu_AddMainMenuItem(&mi); mi.position = -2000070000; mi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_SMS); mi.ptszName = SMS_SEND_CM_STR; mi.pszService = szServiceFunction; mi.flags = CMIF_TCHAR; ssSMSSettings.hContactMenuItems[0] = Menu_AddContactMenuItem(&mi); SkinAddNewSoundEx("RecvSMSMsg",PROTOCOL_NAMEA,LPGEN("Incoming SMS Message")); SkinAddNewSoundEx("RecvSMSConfirmation",PROTOCOL_NAMEA,LPGEN("Incoming SMS Confirmation")); RefreshAccountList(NULL,NULL); RestoreUnreadMessageAlerts(); return 0; }
void InitList() { SkinAddNewSoundEx("Triggered1", LPGEN("Alarms"), LPGEN("Alert 1")); SkinAddNewSoundEx("Triggered2", LPGEN("Alarms"), LPGEN("Alert 2")); SkinAddNewSoundEx("Triggered3", LPGEN("Alarms"), LPGEN("Alert 3")); // load last checked time DBVARIANT dbv; dbv.type = DBVT_BLOB; dbv.cpbVal = sizeof(SYSTEMTIME); if (!db_get(NULL, MODULE, "LastCheck", &dbv)) { memcpy(&last_check, dbv.pbVal, sizeof(SYSTEMTIME)); db_free(&dbv); } else GetLocalTime(&last_check); last_saved_check = last_check; LoadAlarms(); hAlarmTriggeredEvent = CreateHookableEvent(ME_ALARMS_TRIGGERED); hAddAlarmService = CreateServiceFunction(MS_ALARMS_ADDALARM, AddAlarmService); InitAlarmWin(); timer_id = SetTimer(0, 0, TIMER_PERIOD, TimerProc); HookEvent(ME_IDLE_CHANGED, IdleChanged); }
int LoadSendRecvAuthModule(void) { CreateServiceFunction(MS_AUTH_SHOWREQUEST, ShowReqWindow); CreateServiceFunction(MS_AUTH_SHOWADDED, ShowAddedWindow); HookEvent(ME_DB_EVENT_ADDED, AuthEventAdded); SkinAddNewSoundEx("AuthRequest", LPGEN("Alerts"), LPGEN("Authorization request")); SkinAddNewSoundEx("AddedEvent", LPGEN("Alerts"), LPGEN("Added event")); return 0; }
int ModulesLoaded(WPARAM, LPARAM) { InitMenuItems(); InitTabsrmmButton(); SkinAddNewSoundEx(SOUND_UPCOMPLETE, LPGEN("FTP File"), LPGEN("File upload complete")); SkinAddNewSoundEx(SOUND_CANCEL, LPGEN("FTP File"), LPGEN("Upload canceled")); curl_global_init(CURL_GLOBAL_ALL); return 0; }
int ModulesLoaded(WPARAM wParam, LPARAM lParam) { LPCTSTR ptszEmptySting = _T(""); // Заполняем конфигурационные строки из базы. Если их там нет - генерируем. for (int i = 0; i < bLayNum; i++) { LPTSTR ptszCurrLayout = GenerateLayoutString(hklLayouts[i]); LPSTR ptszTemp = GetNameOfLayout(hklLayouts[i]); ptrT tszValue(db_get_tsa(NULL, ModuleName, ptszTemp)); if (tszValue == 0) ptszLayStrings[i] = ptszCurrLayout; else if (!_tcscmp(tszValue, ptszEmptySting)) ptszLayStrings[i] = ptszCurrLayout; else { ptszLayStrings[i] = tszValue.detouch(); if (!_tcscmp(ptszCurrLayout, ptszLayStrings[i])) db_unset(NULL, ModuleName, ptszTemp); mir_free(ptszCurrLayout); } mir_free(ptszTemp); } // Прочитаем основные настройки ReadMainOptions(); // Прочитаем настройки попапов ReadPopupOptions(); // Зарегим звук SkinAddNewSoundEx(SND_ChangeLayout, ModuleName, LPGEN("Changing Layout")); SkinAddNewSoundEx(SND_ChangeCase, ModuleName, LPGEN("Changing Case")); // Хук на нажатие клавиши kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, NULL, GetCurrentThreadId()); hChangeLayout = CreateServiceFunction(MS_CKL_CHANGELAYOUT, APIChangeLayout); hGetLayoutOfText = CreateServiceFunction(MS_CKL_GETLAYOUTOFTEXT, APIGetLayoutOfText); hChangeTextLayout = CreateServiceFunction(MS_CKL_CHANGETEXTLAYOUT, APIChangeTextLayout); // IcoLib support Icon_Register(hInst, ModuleName, iconList, SIZEOF(iconList)); HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged); OnIconsChanged(0, 0); RegPopupActions(); db_set_dw(NULL, ModuleName, "CurrentVer", PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM)); return 0; }
static int ModulesLoaded(WPARAM wParam, LPARAM lParam) { char str[128]; JabberWsInit(); //JabberSslInit(); TlenMUCInit(); HookEvent_Ex(ME_USERINFO_INITIALISE, TlenUserInfoInit); sprintf(str, "%s", TranslateT("Incoming mail")); SkinAddNewSoundEx("TlenMailNotify", jabberModuleName, str); sprintf(str, "%s", TranslateT("Alert")); SkinAddNewSoundEx("TlenAlertNotify", jabberModuleName, str); sprintf(str, "%s", TranslateT("Voice chat")); SkinAddNewSoundEx("TlenVoiceNotify", jabberModuleName, str); return 0; }
int MirandaLoaded(WPARAM wParam, LPARAM lParam) { InitPcre(); ModuleLoad(0, 0); COptPage PopupOptPage(g_PopupOptPage); PopupOptPage.DBToMem(); RecompileRegexps(*(TCString*)PopupOptPage.GetValue(IDC_POPUPOPTDLG_IGNORESTRINGS)); HookEvent(ME_OPT_INITIALISE, OptionsDlgInit); HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad); HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged); SkinAddNewSoundEx(CLIENTCHANGED_SOUND, NULL, LPGEN("ClientChangeNotify: Client changed")); if (bPopupExists) { CreateServiceFunction(MS_CCN_TOGGLEPOPUPS, srvTogglePopups); HookEvent(ME_CLIST_PREBUILDMAINMENU, PrebuildMainMenu); CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR; if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY)) mi.ptszName = LPGENT("Disable c&lient change notification"); else mi.ptszName = LPGENT("Enable c&lient change notification"); mi.pszService = MS_CCN_TOGGLEPOPUPS; mi.ptszPopupName = LPGENT("Popups"); g_hTogglePopupsMenuItem = Menu_AddMainMenuItem(&mi); } // seems that Fingerprint is not installed if (!bFingerprintExists && !db_get_b(NULL, MOD_NAME, DB_NO_FINGERPRINT_ERROR, 0)) CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_CCN_ERROR), NULL, CCNErrorDlgProc); return 0; }
void skin_hook_modules_loaded() { /* register our sounds */ SkinAddNewSoundEx( SKIN_SOUND_ALERT_BEEP, VQCHAT_PROTO_NAME, Translate("Contact alert beep")); }
int LoadSendRecvMessageModule(void) { if (LoadLibraryA("riched20.dll") == NULL) { if (IDYES != MessageBoxA(0, Translate ("Miranda could not load the built-in message module, riched20.dll is missing. If you are using Windows 95 or WINE please make sure you have riched20.dll installed. Press 'Yes' to continue loading Miranda."), Translate("Information"), MB_YESNO | MB_ICONINFORMATION)) return 1; return 0; } hDLL = LoadLibraryA("user32"); pSetLayeredWindowAttributes = (PSLWA) GetProcAddress(hDLL,"SetLayeredWindowAttributes"); InitGlobals(); RichUtil_Load(); OleInitialize(NULL); InitREOleCallback(); InitOptions(); hEventDbEventAdded = HookEvent(ME_DB_EVENT_ADDED, MessageEventAdded); hEventDbSettingChange = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, MessageSettingChanged); hEventContactDeleted = HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted); HookEvent(ME_SYSTEM_MODULESLOADED, SplitmsgModulesLoaded); HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged); HookEvent(ME_PROTO_CONTACTISTYPING, TypingMessage); HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownSendRecv); CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand); #if defined(_UNICODE) CreateServiceFunction(MS_MSG_SENDMESSAGE "W", SendMessageCommand); #endif CreateServiceFunction(MS_MSG_GETWINDOWAPI, GetWindowAPI); CreateServiceFunction(MS_MSG_GETWINDOWCLASS, GetWindowClass); CreateServiceFunction(MS_MSG_GETWINDOWDATA, GetWindowData); CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand); CreateServiceFunction("SRMsg/TypingMessage", TypingMessageCommand); hHookWinEvt=CreateHookableEvent(ME_MSG_WINDOWEVENT); SkinAddNewSoundEx("RecvMsgActive", Translate("Messages"), Translate("Incoming (Focused Window)")); SkinAddNewSoundEx("RecvMsgInactive", Translate("Messages"), Translate("Incoming (Unfocused Window)")); SkinAddNewSoundEx("AlertMsg", Translate("Messages"), Translate("Incoming (New Session)")); SkinAddNewSoundEx("SendMsg", Translate("Messages"), Translate("Outgoing")); hCurSplitNS = LoadCursor(NULL, IDC_SIZENS); hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE); hCurHyperlinkHand = LoadCursor(NULL, IDC_HAND); if (hCurHyperlinkHand == NULL) hCurHyperlinkHand = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND)); hDragCursor = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_DRAGCURSOR)); return 0; }
int TN_ModuleInit() { hPopupsList = WindowList_Create(); OnePopup = M.GetByte(Module, SET_ONEPOPUP, DEF_ONEPOPUP); ShowMenu = M.GetByte(Module, SET_SHOWDISABLEMENU, DEF_SHOWDISABLEMENU); int i = M.GetByte(Module, SET_DISABLED, DEF_DISABLED); Disabled = i & 1; StartDisabled = i & 2; StopDisabled = i & 4; ColorMode = M.GetByte(Module, SET_COLOR_MODE, DEF_COLOR_MODE); TimeoutMode = M.GetByte(Module, SET_TIMEOUT_MODE, DEF_TIMEOUT_MODE); Timeout = M.GetByte(Module, SET_TIMEOUT, DEF_TIMEOUT); TimeoutMode2 = M.GetByte(Module, SET_TIMEOUT_MODE2, DEF_TIMEOUT_MODE2); Timeout2 = M.GetByte(Module, SET_TIMEOUT2, DEF_TIMEOUT2); if (!(M.GetDword(Module, colorPicker[0].desc, 1) && !M.GetDword(Module, colorPicker[0].desc, 0))) for (i = 0; i < _countof(colorPicker); i++) colorPicker[i].color = M.GetDword(Module, colorPicker[i].desc, 0); mir_sntprintf(szStart, _countof(szStart), TranslateT("...is typing a message.")); mir_sntprintf(szStop, _countof(szStop), TranslateT("...has stopped typing.")); if (PluginConfig.g_bPopupAvail && ShowMenu) { hTypingNotify = CreateServiceFunction("TypingNotify/EnableDisableMenuCommand", EnableDisableMenuCommand); CMenuItem mi; if (!Disabled) { mi.name.a = LPGEN("Disable &typing notification"); mi.hIcolibItem = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_ENABLED)); } else { mi.name.a = LPGEN("Enable &typing notification"); mi.hIcolibItem = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_DISABLED)); } mi.pszService = "TypingNotify/EnableDisableMenuCommand"; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Popups"), 0); hDisableMenu = Menu_AddMainMenuItem(&mi); } SkinAddNewSoundEx("TNStart", LPGEN("Instant messages"), LPGEN("Contact started typing")); SkinAddNewSoundEx("TNStop", LPGEN("Instant messages"), LPGEN("Contact stopped typing")); return 0; }
int TlenProtocol::OnModulesLoaded(WPARAM, LPARAM) { char str[128]; /* Set all contacts to offline */ for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) if (db_get_w(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) db_set_w(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE); strncpy_s(str, LPGEN("Incoming mail"), _TRUNCATE); SkinAddNewSoundEx("TlenMailNotify", m_szModuleName, str); strncpy_s(str, LPGEN("Alert"), _TRUNCATE); SkinAddNewSoundEx("TlenAlertNotify", m_szModuleName, str); strncpy_s(str, LPGEN("Voice chat"), _TRUNCATE); SkinAddNewSoundEx("TlenVoiceNotify", m_szModuleName, str); HookProtoEvent(ME_USERINFO_INITIALISE, &TlenProtocol::UserInfoInit); return 0; }
CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) : PROTO<CMraProto>(_module, _displayName), m_bLoggedIn(false), m_groups(5, NumericKeySortT) { InitializeCriticalSectionAndSpinCount(&csCriticalSectionSend, 0); MraSendQueueInitialize(0, &hSendQueueHandle); MraFilesQueueInitialize(0, &hFilesQueueHandle); MraMPopSessionQueueInitialize(&hMPopSessionQueue); MraAvatarsQueueInitialize(&hAvatarsQueueHandle); CreateProtoService(PS_SETCUSTOMSTATUSEX, &CMraProto::MraSetXStatusEx); CreateProtoService(PS_GETCUSTOMSTATUSEX, &CMraProto::MraGetXStatusEx); CreateProtoService(PS_GETCUSTOMSTATUSICON, &CMraProto::MraGetXStatusIcon); CreateProtoService(PS_SET_LISTENINGTO, &CMraProto::MraSetListeningTo); CreateProtoService(PS_CREATEACCMGRUI, &CMraProto::MraCreateAccMgrUI); CreateProtoService(PS_GETAVATARCAPS, &CMraProto::MraGetAvatarCaps); CreateProtoService(PS_GETAVATARINFOT, &CMraProto::MraGetAvatarInfo); CreateProtoService(PS_GETMYAVATART, &CMraProto::MraGetMyAvatar); CreateProtoService(MS_ICQ_SENDSMS, &CMraProto::MraSendSMS); CreateProtoService(PS_SEND_NUDGE, &CMraProto::MraSendNudge); if ( ServiceExists(MS_NUDGE_SEND)) m_heNudgeReceived = CreateProtoEvent(PE_NUDGE); TCHAR name[128]; mir_sntprintf( name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = { sizeof(nlu) }; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; nlu.ptszDescriptiveName = name; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); HookProtoEvent(ME_SYSTEM_PRESHUTDOWN, &CMraProto::OnPreShutdown); InitMenus(); mir_snprintf(szNewMailSound, SIZEOF(szNewMailSound), "%s: %s", m_szModuleName, MRA_SOUND_NEW_EMAIL); SkinAddNewSoundEx(szNewMailSound, m_szModuleName, MRA_SOUND_NEW_EMAIL); HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &CMraProto::MraRebuildStatusMenu); hExtraXstatusIcon = ExtraIcon_Register("MRAXstatus", LPGEN("Mail.ru Xstatus"), "mra_xstatus25"); hExtraInfo = ExtraIcon_Register("MRAStatus", LPGEN("Mail.ru extra info"), "mra_xstatus49"); bHideXStatusUI = FALSE; m_iXStatus = getByte(DBSETTING_XSTATUSID, MRA_MIR_XSTATUS_NONE); if ( !IsXStatusValid(m_iXStatus)) m_iXStatus = MRA_MIR_XSTATUS_NONE; }
CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) : PROTO<CSkypeProto>(protoName, userName), m_PopupClasses(1), m_InviteDialogs(1), m_GCCreateDialogs(1), m_OutMessages(3, PtrKeySortT) { m_hProtoIcon = Icons[0].Handle; InitNetwork(); requestQueue = new RequestQueue(m_hNetlibUser); CreateProtoService(PS_CREATEACCMGRUI, &CSkypeProto::OnAccountManagerInit); CreateProtoService(PS_GETAVATARINFO, &CSkypeProto::SvcGetAvatarInfo); CreateProtoService(PS_GETAVATARCAPS, &CSkypeProto::SvcGetAvatarCaps); CreateProtoService(PS_GETMYAVATAR, &CSkypeProto::SvcGetMyAvatar); CreateProtoService(PS_SETMYAVATAR, &CSkypeProto::SvcSetMyAvatar); CreateProtoService("/IncomingCallCLE", &CSkypeProto::OnIncomingCallCLE); CreateProtoService("/IncomingCallPP", &CSkypeProto::OnIncomingCallPP); m_tszAvatarFolder = std::tstring(VARST(_T("%miranda_avatarcache%"))) + _T("\\") + m_tszUserName; DWORD dwAttributes = GetFileAttributes(m_tszAvatarFolder.c_str()); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) CreateDirectoryTreeT(m_tszAvatarFolder.c_str()); //sounds SkinAddNewSoundEx("skype_inc_call", "SkypeWeb", LPGEN("Incoming call sound")); SkinAddNewSoundEx("skype_call_canceled", "SkypeWeb", LPGEN("Incoming call canceled sound")); m_hTrouterEvent = CreateEvent(NULL, FALSE, FALSE, NULL); m_hPollingEvent = CreateEvent(NULL, FALSE, FALSE, NULL); m_hTrouterHealthEvent = CreateEvent(NULL, FALSE, FALSE, NULL); SkypeSetTimer(); m_hPollingThread = ForkThreadEx(&CSkypeProto::PollingThread, NULL, NULL); m_hTrouterThread = ForkThreadEx(&CSkypeProto::TRouterThread, NULL, NULL); }
CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) : PROTO<CMraProto>(_module, _displayName), m_bLoggedIn(false), m_groups(5, NumericKeySortT) { MraSendQueueInitialize(0, &hSendQueueHandle); MraFilesQueueInitialize(0, &hFilesQueueHandle); MraMPopSessionQueueInitialize(&hMPopSessionQueue);//getByte("AutoAuthOnWebServices", MRA_DEFAULT_AUTO_AUTH_ON_WEB_SVCS) MraAvatarsQueueInitialize(&hAvatarsQueueHandle); CreateProtoService(PS_SETCUSTOMSTATUSEX, &CMraProto::MraSetXStatusEx); CreateProtoService(PS_GETCUSTOMSTATUSEX, &CMraProto::MraGetXStatusEx); CreateProtoService(PS_GETCUSTOMSTATUSICON, &CMraProto::MraGetXStatusIcon); CreateProtoService(PS_SET_LISTENINGTO, &CMraProto::MraSetListeningTo); CreateProtoService(PS_CREATEACCMGRUI, &CMraProto::MraCreateAccMgrUI); CreateProtoService(PS_GETAVATARCAPS, &CMraProto::MraGetAvatarCaps); CreateProtoService(PS_GETAVATARINFO, &CMraProto::MraGetAvatarInfo); CreateProtoService(PS_GETMYAVATAR, &CMraProto::MraGetMyAvatar); CreateProtoService(MS_ICQ_SENDSMS, &CMraProto::MraSendSMS); CreateProtoService(PS_SEND_NUDGE, &CMraProto::MraSendNudge); CreateProtoService(PS_GETUNREADEMAILCOUNT, &CMraProto::GetUnreadEmailCount); if (ServiceExists(MS_NUDGE_SEND)) m_heNudgeReceived = CreateProtoEvent(PE_NUDGE); TCHAR name[MAX_PATH]; mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = { sizeof(nlu) }; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; nlu.szSettingsModule = m_szModuleName; nlu.ptszDescriptiveName = name; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); InitMenus(); mir_snprintf(szNewMailSound, _countof(szNewMailSound), "%s_new_email", m_szModuleName); SkinAddNewSoundEx(szNewMailSound, m_szModuleName, MRA_SOUND_NEW_EMAIL); HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &CMraProto::MraRebuildStatusMenu); hExtraXstatusIcon = ExtraIcon_Register("MRAXstatus", LPGEN("Mail.ru xStatus"), "mra_xstatus25"); hExtraInfo = ExtraIcon_Register("MRAStatus", LPGEN("Mail.ru extra info"), MRA_XSTATUS_UNKNOWN_STR); m_bHideXStatusUI = false; m_iXStatus = getByte(DBSETTING_XSTATUSID, MRA_MIR_XSTATUS_NONE); if (!IsXStatusValid(m_iXStatus)) m_iXStatus = MRA_MIR_XSTATUS_NONE; }
int LoadSendRecvUrlModule(void) { hUrlWindowList = WindowList_Create(); HookEvent(ME_SYSTEM_MODULESLOADED, SRUrlModulesLoaded); HookEvent(ME_DB_EVENT_ADDED, UrlEventAdded); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, SRUrlPreBuildMenu); hEventContactSettingChange = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged); hContactDeleted = HookEvent(ME_DB_CONTACT_DELETED, UrlContactDeleted); HookEvent(ME_SYSTEM_PRESHUTDOWN, SRUrlShutdown); CreateServiceFunction(MS_URL_SENDURL, SendUrlCommand); CreateServiceFunction("SRUrl/ReadUrl", ReadUrlCommand); SkinAddNewSoundEx("RecvUrl", LPGEN("URL"), LPGEN("Incoming")); return 0; }
int LoadSendRecvMessageModule(void) { if (LoadLibraryA("Msftedit.dll") == NULL) { if (IDYES != MessageBox(0, TranslateTS(tszError), TranslateT("Information"), MB_YESNO | MB_ICONINFORMATION)) return 1; return 0; } InitGlobals(); RichUtil_Load(); InitOptions(); HookEvent(ME_DB_EVENT_ADDED, MessageEventAdded); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, MessageSettingChanged); HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted); HookEvent(ME_SYSTEM_MODULESLOADED, SplitmsgModulesLoaded); HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged); HookEvent(ME_PROTO_CONTACTISTYPING, TypingMessage); HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownSendRecv); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand); CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommand_W); CreateServiceFunction(MS_MSG_GETWINDOWAPI, GetWindowAPI); CreateServiceFunction(MS_MSG_GETWINDOWCLASS, GetWindowClass); CreateServiceFunction(MS_MSG_GETWINDOWDATA, GetWindowData); CreateServiceFunction(MS_MSG_SETSTATUSTEXT, SetStatusText); CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand); hHookWinEvt = CreateHookableEvent(ME_MSG_WINDOWEVENT); hHookWinPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP); hHookWinWrite = CreateHookableEvent(ME_MSG_PRECREATEEVENT); SkinAddNewSoundEx("RecvMsgActive", LPGEN("Instant messages"), LPGEN("Incoming (focused window)")); SkinAddNewSoundEx("RecvMsgInactive", LPGEN("Instant messages"), LPGEN("Incoming (unfocused window)")); SkinAddNewSoundEx("AlertMsg", LPGEN("Instant messages"), LPGEN("Incoming (new session)")); SkinAddNewSoundEx("SendMsg", LPGEN("Instant messages"), LPGEN("Outgoing")); SkinAddNewSoundEx("SendError", LPGEN("Instant messages"), LPGEN("Message send error")); SkinAddNewSoundEx("TNStart", LPGEN("Instant messages"), LPGEN("Contact started typing")); SkinAddNewSoundEx("TNStop", LPGEN("Instant messages"), LPGEN("Contact stopped typing")); hCurSplitNS = LoadCursor(NULL, IDC_SIZENS); hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE); hCurHyperlinkHand = LoadCursor(NULL, IDC_HAND); if (hCurHyperlinkHand == NULL) hCurHyperlinkHand = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND)); InitStatusIcons(); return 0; }
extern "C" int __declspec(dllexport) Load(void) { char service[100]={""}; PROTOCOLDESCRIPTOR pd={ PROTOCOLDESCRIPTOR_V3_SIZE }; #ifdef _DEBUG _OutputDebugString(_T("Entering Load dll")); #endif mir_getLP( &pluginInfo ); //hCurrentEditMutex=CreateMutex(NULL,FALSE,_T("CurrentEditMutex")); hExceptionsMutex=CreateMutex(NULL,FALSE,_T("ExceptionsMutex")); LoadSettings(); connExceptions=LoadSettingsConnections(); //create protocol //ZeroMemory(&pd,sizeof(pd)); //pd.cbSize=sizeof(pd); pd.szName=PLUGINNAME; pd.type=PROTOTYPE_PROTOCOL; CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); //set all contacts to offline for (HANDLE hContact = db_find_first(PLUGINNAME); hContact != NULL; hContact = db_find_next(hContact,PLUGINNAME)) db_set_w(hContact,PLUGINNAME,"status",ID_STATUS_OFFLINE); mir_snprintf(service,sizeof(service), "%s%s", PLUGINNAME, PS_GETCAPS); CreateServiceFunction(service, GetCaps); mir_snprintf(service,sizeof(service), "%s%s", PLUGINNAME, PS_GETNAME); CreateServiceFunction(service, GetName); mir_snprintf(service,sizeof(service), "%s%s", PLUGINNAME, PS_LOADICON); CreateServiceFunction(service, TMLoadIcon); mir_snprintf(service,sizeof(service), "%s%s", PLUGINNAME, PS_SETSTATUS); CreateServiceFunction(service, SetStatus); mir_snprintf(service,sizeof(service), "%s%s", PLUGINNAME, PS_GETSTATUS); CreateServiceFunction(service, GetStatus); SkinAddNewSoundEx(PLUGINNAME_NEWSOUND,PLUGINNAME, LPGEN("New Connection Notification")); hOptInit = HookEvent(ME_OPT_INITIALISE, ConnectionNotifyOptInit);//register service to hook option call assert(hOptInit); hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, modulesloaded);//hook event that all plugins are loaded assert(hHookModulesLoaded); hHookPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, preshutdown); return 0; }
void LoadProtocols(void) { //Load the default nudge mir_snprintf(DefaultNudge.ProtocolName, "Default"); mir_snprintf(DefaultNudge.NudgeSoundname, "Nudge : Default"); SkinAddNewSoundEx(DefaultNudge.NudgeSoundname, LPGEN("Nudge"), LPGEN("Default Nudge")); DefaultNudge.Load(); GlobalNudge.Load(); int numberOfProtocols = 0; PROTOACCOUNT **ppProtocolDescriptors; Proto_EnumAccounts(&numberOfProtocols, &ppProtocolDescriptors); for (int i = 0; i < numberOfProtocols; i++) Nudge_AddAccount(ppProtocolDescriptors[i]); shake.Load(); }
extern "C" int __declspec(dllexport) Load(void) { #ifdef _DEBUG _OutputDebugString(_T("Entering Load dll")); #endif mir_getLP(&pluginInfo); mir_getCLI(); hExceptionsMutex = CreateMutex(NULL, FALSE, _T("ExceptionsMutex")); LoadSettings(); connExceptions = LoadSettingsConnections(); PROTOCOLDESCRIPTOR pd = { 0 }; pd.cbSize = sizeof(pd); pd.szName = PLUGINNAME; pd.type = PROTOTYPE_PROTOCOL; Proto_RegisterModule(&pd); //set all contacts to offline for (MCONTACT hContact = db_find_first(PLUGINNAME); hContact != NULL; hContact = db_find_next(hContact, PLUGINNAME)) db_set_w(hContact, PLUGINNAME, "status", ID_STATUS_OFFLINE); CreateProtoServiceFunction(PLUGINNAME, PS_GETCAPS, GetCaps); CreateProtoServiceFunction(PLUGINNAME, PS_GETNAME, GetName); CreateProtoServiceFunction(PLUGINNAME, PS_LOADICON, TMLoadIcon); CreateProtoServiceFunction(PLUGINNAME, PS_SETSTATUS, SetStatus); CreateProtoServiceFunction(PLUGINNAME, PS_GETSTATUS, GetStatus); SkinAddNewSoundEx(PLUGINNAME_NEWSOUND, PLUGINNAME, LPGEN("New Connection Notification")); hOptInit = HookEvent(ME_OPT_INITIALISE, ConnectionNotifyOptInit);//register service to hook option call assert(hOptInit); hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, modulesloaded);//hook event that all plugins are loaded assert(hHookModulesLoaded); hHookPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, preshutdown); return 0; }
int OnLoadModule(void) { hMsftEdit = LoadLibrary(_T("Msftedit.dll")); if (hMsftEdit == NULL) { if (IDYES != MessageBox(0, TranslateT ("Miranda could not load the built-in message module, Msftedit.dll is missing. If you are using WINE, please make sure you have Msftedit.dll installed. Press 'Yes' to continue loading Miranda."), TranslateT("Information"), MB_YESNO | MB_ICONINFORMATION)) return 1; return 0; } InitGlobals(); RichUtil_Load(); InitStatusIcons(); RegisterIcons(); RegisterFontServiceFonts(); RegisterKeyBindings(); HookEvent(ME_OPT_INITIALISE, OptInitialise); HookEvent(ME_DB_EVENT_ADDED, MessageEventAdded); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, MessageSettingChanged); HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged); HookEvent(ME_PROTO_CONTACTISTYPING, TypingMessage); HookEvent(ME_SYSTEM_PRESHUTDOWN, OnSystemPreshutdown); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad); HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad); CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand); CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommandW); CreateServiceFunction(MS_MSG_GETWINDOWAPI, GetWindowAPI); CreateServiceFunction(MS_MSG_GETWINDOWCLASS, GetWindowClass); CreateServiceFunction(MS_MSG_GETWINDOWDATA, GetWindowData); CreateServiceFunction(MS_MSG_SETSTATUSTEXT, SetStatusText); CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand); CreateServiceFunction("SRMsg/TypingMessage", TypingMessageCommand); hHookWinEvt = CreateHookableEvent(ME_MSG_WINDOWEVENT); hHookWinPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP); hHookWinWrite = CreateHookableEvent(ME_MSG_PRECREATEEVENT); SkinAddNewSoundEx("RecvMsgActive", LPGEN("Instant messages"), LPGEN("Incoming (focused window)")); SkinAddNewSoundEx("RecvMsgInactive", LPGEN("Instant messages"), LPGEN("Incoming (unfocused window)")); SkinAddNewSoundEx("AlertMsg", LPGEN("Instant messages"), LPGEN("Incoming (new session)")); SkinAddNewSoundEx("SendMsg", LPGEN("Instant messages"), LPGEN("Outgoing")); SkinAddNewSoundEx("TNStart", LPGEN("Instant messages"), LPGEN("Contact started typing")); SkinAddNewSoundEx("TNStop", LPGEN("Instant messages"), LPGEN("Contact stopped typing")); hCurSplitNS = LoadCursor(NULL, IDC_SIZENS); hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE); hCurHyperlinkHand = LoadCursor(NULL, IDC_HAND); if (hCurHyperlinkHand == NULL) hCurHyperlinkHand = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND)); hDragCursor = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_DRAGCURSOR)); Chat_Load(); return 0; }
extern "C" int __declspec(dllexport) Load() { mir_getLP(&pluginInfoEx); mir_getCLI(); SkinAddNewSoundEx("Gmail", LPGEN("Other"), LPGEN("Gmail: New thread(s)")); HookEvent(ME_CLIST_DOUBLECLICKED, OpenBrowser); PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE }; pd.szName = MODULE_NAME; pd.type = PROTOTYPE_VIRTUAL; Proto_RegisterModule(&pd); CreateProtoServiceFunction(MODULE_NAME, PS_GETCAPS, GetCaps); CreateProtoServiceFunction(MODULE_NAME, PS_GETSTATUS, GetStatus); CreateProtoServiceFunction(MODULE_NAME, PS_GETNAME, GetName); CreateServiceFunction("GmailMNotifier/Notifying", Notifying); opt.circleTime = db_get_dw(NULL, MODULE_NAME, "circleTime", 30); opt.notifierOnTray = db_get_dw(NULL, MODULE_NAME, "notifierOnTray", TRUE); opt.notifierOnPop = db_get_dw(NULL, MODULE_NAME, "notifierOnPop", TRUE); opt.popupDuration = db_get_dw(NULL, MODULE_NAME, "popupDuration", -1); opt.popupBgColor = db_get_dw(NULL, MODULE_NAME, "popupBgColor", RGB(173, 206, 247)); opt.popupTxtColor = db_get_dw(NULL, MODULE_NAME, "popupTxtColor", RGB(0, 0, 0)); opt.OpenUsePrg = db_get_dw(NULL, MODULE_NAME, "OpenUsePrg", 0); opt.ShowCustomIcon = db_get_dw(NULL, MODULE_NAME, "ShowCustomIcon", FALSE); opt.UseOnline = db_get_dw(NULL, MODULE_NAME, "UseOnline", FALSE); opt.AutoLogin = db_get_dw(NULL, MODULE_NAME, "AutoLogin", TRUE); opt.LogThreads = db_get_dw(NULL, MODULE_NAME, "LogThreads", FALSE); DBVARIANT dbv; if (db_get_s(NULL, "Icons", "GmailMNotifier40076", &dbv)) { db_set_s(NULL, "Icons", "GmailMNotifier40071", "plugins\\gmailm.dll,2"); db_set_s(NULL, "Icons", "GmailMNotifier40072", "plugins\\gmailm.dll,2"); db_set_s(NULL, "Icons", "GmailMNotifier40076", "plugins\\gmailm.dll,0"); db_set_s(NULL, "Icons", "GmailMNotifier40073", "plugins\\gmailm.dll,1"); } else db_free(&dbv); BuildList(); ID_STATUS_NONEW = opt.UseOnline ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE; for (int i = 0; i < acc_num; i++) db_set_dw(acc[i].hContact, MODULE_NAME, "Status", ID_STATUS_NONEW); hTimer = SetTimer(NULL, 0, opt.circleTime * 60000, TimerProc); hMirandaStarted = HookEvent(ME_SYSTEM_MODULESLOADED, OnMirandaStart); hOptionsInitial = HookEvent(ME_OPT_INITIALISE, OptInit); CreateServiceFunction(MODULE_NAME "/MenuCommand", PluginMenuCommand); CMenuItem mi; SET_UID(mi, 0xbe16f37, 0x17be, 0x4494, 0xaa, 0xb2, 0x3a, 0xa7, 0x38, 0xfa, 0xf9, 0xcc); mi.position = -0x7FFFFFFF; mi.hIcolibItem = Skin_LoadProtoIcon(MODULE_NAME, ID_STATUS_ONLINE); mi.name.a = LPGEN("&Check all Gmail inboxes"); mi.pszService = MODULE_NAME "/MenuCommand"; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x22c6ace1, 0xba0c, 0x44b5, 0xa4, 0xd2, 0x1, 0x7d, 0xb1, 0xe0, 0x51, 0xeb); mi.name.a = LPGEN("&Check Gmail inbox"); mi.pszService = "/MenuCommand"; Menu_AddContactMenuItem(&mi, MODULE_NAME); return 0; }
extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; mir_getMMI(&mmi); mir_getLI(&li); mir_getMD5I(&md5i); mir_getUTFI(&utfi); #else extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfoEx); InitServices(); #endif db_set_b(NULL, MODNAME, "NeedRestart", 0); DWORD dwLen = GetTempPath( SIZEOF(tszTempPath), tszTempPath); if (tszTempPath[dwLen-1] == '\\') tszTempPath[dwLen-1] = 0; LoadOptions(); InitPopupList(); InitNetlib(); InitIcoLib(); // Add cheking update menu item InitCheck(); CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 400010000; mi.icolibItem = Skin_GetIconHandle("check_update"); mi.pszName = LPGEN("Check for updates"); mi.pszService = MODNAME"/CheckUpdates"; Menu_AddMainMenuItem(&mi); #if MIRANDA_VER >= 0x0A00 InitListNew(); mi.position++; mi.icolibItem = Skin_GetIconHandle("plg_list"); mi.pszName = LPGEN("Available components list"); mi.pszService = MODNAME"/ShowList"; Menu_AddMainMenuItem(&mi); InitOptions(); #endif // Add hotkey HOTKEYDESC hkd = { sizeof(hkd) }; hkd.pszName = "Check for updates"; hkd.pszDescription = "Check for updates"; hkd.pszSection = "Plugin Updater"; hkd.pszService = MODNAME"/CheckUpdates"; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F10) | HKF_MIRANDA_LOCAL; hkd.lParam = FALSE; Hotkey_Register(&hkd); InitEvents(); //add sounds SkinAddNewSoundEx("updatecompleted",LPGEN("Plugin Updater"),LPGEN("Update completed")); SkinAddNewSoundEx("updatefailed",LPGEN("Plugin Updater"),LPGEN("Update failed")); return 0; }
int MirandaLoaded(WPARAM, LPARAM) { LoadMsgTreeModule(); LoadCListModule(); InitUpdateMsgs(); g_IconList.ReloadIcons(); int numAccs = 0; PROTOACCOUNT **accs; Proto_EnumAccounts(&numAccs, &accs); for (int i = 0, CurProtoIndex = 0; i < numAccs && CurProtoIndex < MAXICQACCOUNTS; i++) { HANDLE hHook = HookEvent(CString(accs[i]->szModuleName) + ME_ICQ_STATUSMSGREQ, StatusMsgReqHooks[CurProtoIndex]); if (hHook) { ICQProtoList[CurProtoIndex] = accs[i]->szModuleName; CurProtoIndex++; } } CreateServiceFunction(MS_AWAYSYS_SETCONTACTSTATMSG, SetContactStatMsg); CreateServiceFunction(MS_AWAYSYS_AUTOREPLY_TOGGLE, ToggleSendOnEvent); CreateServiceFunction(MS_AWAYSYS_AUTOREPLY_ON, srvAutoreplyOn); CreateServiceFunction(MS_AWAYSYS_AUTOREPLY_OFF, srvAutoreplyOff); CreateServiceFunction(MS_AWAYSYS_AUTOREPLY_USEDEFAULT, srvAutoreplyUseDefault); CreateServiceFunction(MS_AWAYMSG_GETSTATUSMSGW, GetStatusMsgW); CreateServiceFunction(MS_NAS_GETSTATEA, GetStateA); CreateServiceFunction(MS_NAS_SETSTATEA, SetStateA); CreateServiceFunction(MS_NAS_GETSTATEW, GetStateW); CreateServiceFunction(MS_NAS_SETSTATEW, SetStateW); CreateServiceFunction(MS_NAS_INVOKESTATUSWINDOW, InvokeStatusWindow); // and old AwaySysMod service, for compatibility reasons CreateServiceFunction(MS_AWAYSYS_SETSTATUSMODE, SetStatusMode); HookEvent(ME_TTB_MODULELOADED, Create_TopToolbar); HookEvent(ME_OPT_INITIALISE, OptsDlgInit); HookEvent(ME_CLIST_STATUSMODECHANGE, StatusChanged); HookEvent(ME_CS_STATUSCHANGEEX, CSStatusChange); // for compatibility with StartupStatus and AdvancedAutoAway HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DBSettingChanged); HookEvent(ME_DB_EVENT_FILTER_ADD, MsgEventAdded); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu); HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged); HookEvent(ME_IDLE_CHANGED, IdleChangeEvent); g_hReadWndList = WindowList_Create(); int SendOnEvent = CContactSettings(g_ProtoStates[(char*)NULL].Status).Autoreply; CMenuItem mi; mi.position = 1000020000; mi.flags = CMIF_TCHAR | CMIF_NOTOFFLINE; mi.hIcolibItem = iconList[SendOnEvent ? 1 : 0].hIcolib; mi.name.t = SendOnEvent ? DISABLE_SOE_COMMAND : ENABLE_SOE_COMMAND; mi.pszService = MS_AWAYSYS_AUTOREPLY_TOGGLE; g_hToggleSOEMenuItem = Menu_AddMainMenuItem(&mi); memset(&mi, 0, sizeof(mi)); mi.position = -2000005000; mi.flags = CMIF_TCHAR | CMIF_NOTOFFLINE | CMIF_HIDDEN; mi.name.t = LPGENT("Read status message"); // never seen... mi.pszService = MS_AWAYMSG_SHOWAWAYMSG; g_hReadStatMenuItem = Menu_AddContactMenuItem(&mi); if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_USEMENUITEM)) { memset(&mi, 0, sizeof(mi)); mi.flags = CMIF_TCHAR | CMIF_HIDDEN; mi.name.t = LPGENT("Set status message"); // will never be shown mi.position = 1000020000; mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_MSGICON)); mi.pszService = MS_AWAYSYS_SETCONTACTSTATMSG; g_hContactMenuItem = Menu_AddContactMenuItem(&mi); memset(&mi, 0, sizeof(mi)); mi.flags = CMIF_TCHAR; mi.hIcolibItem = NULL; mi.position = 1000020000; mi.name.t = LPGENT("Autoreply"); g_hToggleSOEContactMenuItem = Menu_AddContactMenuItem(&mi); mi.flags = CMIF_TCHAR; mi.root = g_hToggleSOEContactMenuItem; mi.position = 1000020000; mi.hIcolibItem = iconList[1].hIcolib; mi.name.t = LPGENT("On"); mi.pszService = MS_AWAYSYS_AUTOREPLY_ON; g_hAutoreplyOnContactMenuItem = Menu_AddContactMenuItem(&mi); mi.hIcolibItem = iconList[0].hIcolib; mi.name.t = LPGENT("Off"); mi.pszService = MS_AWAYSYS_AUTOREPLY_OFF; g_hAutoreplyOffContactMenuItem = Menu_AddContactMenuItem(&mi); mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_DOT)); mi.name.t = LPGENT("Use the default setting"); mi.pszService = MS_AWAYSYS_AUTOREPLY_USEDEFAULT; g_hAutoreplyUseDefaultContactMenuItem = Menu_AddContactMenuItem(&mi); } // add that funky thingy (just tweaked a bit, was spotted in Miranda's src code) // we have to read the status message from contacts too... err CreateServiceFunction(MS_AWAYMSG_SHOWAWAYMSG, GetContactStatMsg); SkinAddNewSoundEx(AWAYSYS_STATUSMSGREQUEST_SOUND, NULL, LPGEN("NewAwaySys: Incoming status message request")); if (ServiceExists(MS_VARS_REGISTERTOKEN)) { CreateServiceFunction(MS_AWAYSYS_FREEVARMEM, srvFreeVarMem); CreateServiceFunction(MS_AWAYSYS_VARIABLESHANDLER, srvVariablesHandler); TOKENREGISTER tr = { sizeof(tr) }; tr.szService = MS_AWAYSYS_VARIABLESHANDLER; tr.szCleanupService = MS_AWAYSYS_FREEVARMEM; tr.memType = TR_MEM_OWNER; for (int i = 0; i < _countof(Variables); i++) { tr.flags = Variables[i].Flags | TRF_CALLSVC | TRF_TCHAR; tr.tszTokenString = Variables[i].Name; tr.szHelpText = Variables[i].Descr; CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM)&tr); } } HookEvent(ME_MODERNOPT_INITIALIZE, ModernOptInitialise); return 0; }
int OptionsInit(void) { LoadLogFonts(); LOGFONT lf; LoadMsgDlgFont(18, &lf, NULL); lstrcpy(lf.lfFaceName, _T("MS Shell Dlg")); lf.lfUnderline = lf.lfItalic = lf.lfStrikeOut = 0; lf.lfHeight = -17; lf.lfWeight = FW_BOLD; g_Settings->NameFont = CreateFontIndirect(&lf); g_Settings->UserListFont = NULL; g_Settings->UserListHeadingsFont = NULL; g_Settings->iWidth = db_get_dw(NULL, CHAT_MODULE, "roomwidth", -1); g_Settings->iHeight = db_get_dw(NULL, CHAT_MODULE, "roomheight", -1); g_Settings->iSplitterX = db_get_w(NULL, CHAT_MODULE, "SplitterX", 105); if (g_Settings->iSplitterX <= 50) g_Settings->iSplitterX = 105; g_Settings->iSplitterY = db_get_w(NULL, CHAT_MODULE, "SplitterY", 90); if (g_Settings->iSplitterY <= 65) g_Settings->iSplitterY = 90; SkinAddNewSoundEx("ChatMessage", LPGEN("Group chats"), LPGEN("Incoming message")); SkinAddNewSoundEx("ChatHighlight", LPGEN("Group chats"), LPGEN("Message is highlighted")); SkinAddNewSoundEx("ChatAction", LPGEN("Group chats"), LPGEN("User has performed an action")); SkinAddNewSoundEx("ChatJoin", LPGEN("Group chats"), LPGEN("User has joined")); SkinAddNewSoundEx("ChatPart", LPGEN("Group chats"), LPGEN("User has left")); SkinAddNewSoundEx("ChatKick", LPGEN("Group chats"), LPGEN("User has kicked some other user")); SkinAddNewSoundEx("ChatMode", LPGEN("Group chats"), LPGEN("User's status was changed")); SkinAddNewSoundEx("ChatNick", LPGEN("Group chats"), LPGEN("User has changed name")); SkinAddNewSoundEx("ChatNotice", LPGEN("Group chats"), LPGEN("User has sent a notice")); SkinAddNewSoundEx("ChatQuit", LPGEN("Group chats"), LPGEN("User has disconnected")); SkinAddNewSoundEx("ChatTopic", LPGEN("Group chats"), LPGEN("The topic has been changed")); return 0; }
extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); YAMN_STATUS = ID_STATUS_OFFLINE; // we get the Miranda Root Path PathToAbsoluteT( _T("."), szMirandaDir); // retrieve the current profile name CallService(MS_DB_GETPROFILENAMET, (WPARAM)_countof(ProfileName), (LPARAM)ProfileName); //not to pass entire array to fcn TCHAR *fc = _tcsrchr(ProfileName, '.'); if ( fc != NULL ) *fc = 0; // we get the user path where our yamn-account.book.ini is stored from mirandaboot.ini file GetProfileDirectory(UserDirectory, _countof(UserDirectory)); // Enumerate all the code pages available for the System Locale EnumSystemCodePages(EnumSystemCodePagesProc, CP_INSTALLED); CodePageNamesSupp = new _tcptable[CPLENSUPP]; for (int i = 0, k = 0; i < CPLENALL; i++) { if (CodePageNamesAll[i].isValid) { CodePageNamesSupp[k] = CodePageNamesAll[i]; k++; } } // Registering YAMN as protocol PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE }; pd.szName = YAMN_DBMODULE; pd.type = PROTOTYPE_VIRTUAL; Proto_RegisterModule(&pd); InitializeCriticalSection(&AccountStatusCS); InitializeCriticalSection(&FileWritingCS); InitializeCriticalSection(&PluginRegCS); if (NULL == (NoWriterEV = CreateEvent(NULL, TRUE, TRUE, NULL))) return 1; if (NULL == (WriteToFileEV = CreateEvent(NULL, FALSE, FALSE, NULL))) return 1; if (NULL == (ExitEV = CreateEvent(NULL, TRUE, FALSE, NULL))) return 1; PosX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBPOSX, 0); PosY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBPOSY, 0); SizeX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBSIZEX, 800); SizeY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBSIZEY, 200); HeadPosX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSX, 0); HeadPosY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSY, 0); HeadSizeX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEX, 690); HeadSizeY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEY, 300); HeadSplitPos = db_get_w(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSSPLIT, 250); optDateTime = db_get_b(NULL, YAMN_DBMODULE, YAMN_DBTIMEOPTIONS, optDateTime); // Create new window queues for broadcast messages YAMNVar.MessageWnds = WindowList_Create(); YAMNVar.NewMailAccountWnd = WindowList_Create(); YAMNVar.Shutdown = FALSE; hCurSplitNS = LoadCursor(NULL, IDC_SIZENS); hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE); #ifdef _DEBUG InitDebug(); #endif CreateServiceFunctions(); SkinAddNewSoundEx(YAMN_NEWMAILSOUND, YAMN_DBMODULE, YAMN_NEWMAILSNDDESC); SkinAddNewSoundEx(YAMN_CONNECTFAILSOUND, YAMN_DBMODULE, YAMN_CONNECTFAILSNDDESC); HookEvents(); LoadIcons(); LoadPlugins(); HOTKEYDESC hkd = {0}; hkd.cbSize = sizeof(hkd); hkd.pszName = "YAMN_hotkey"; hkd.pszService = MS_YAMN_FORCECHECK; hkd.pszSection = YAMN_DBMODULE; hkd.pszDescription = LPGEN("Check mail"); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F11); Hotkey_Register(&hkd); //Create thread that will be executed every second if (!(SecTimer = SetTimer(NULL, 0, 1000, TimerProc))) return 1; return 0; }
int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { hIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged); hExtraIconListRebuild = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, OnExtraIconListRebuild); hExtraImageApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnExtraImageApply); hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged); hTopToolBarModuleLoaded = HookEvent(ME_TTB_MODULELOADED, OnTopToolBarModuleLoaded); //hContactSendMessage = HookEvent(ME_WWI_SENDMESSAGE, OnContactSendMessage); SkinAddNewSoundEx(BIRTHDAY_NEAR_SOUND, "WhenWasIt", "Birthday near"); SkinAddNewSoundEx(BIRTHDAY_TODAY_SOUND, "WhenWasIt", "Birthday today"); RebuildAdvIconList(); char buffer[1024]; Update update = {0}; update.cbSize = sizeof(Update); update.szComponentName = __PLUGIN_DISPLAY_NAME; update.pbVersion = (BYTE *) CreateVersionString(VERSION, buffer); update.cpbVersion = (int) strlen((char *) update.pbVersion); update.szUpdateURL = UPDATER_AUTOREGISTER; update.szBetaVersionURL = WHENWASIT_VERSION_URL; update.szBetaUpdateURL = WHENWASIT_UPDATE_URL; update.pbBetaVersionPrefix = (BYTE *) WHENWASIT_VERSION_PREFIX; update.cpbBetaVersionPrefix = (int) strlen(WHENWASIT_VERSION_PREFIX); CallService(MS_UPDATE_REGISTER, 0, (LPARAM) &update); UpdateTimers(); CLISTMENUITEM cl = {0}; cl.cbSize = sizeof(CLISTMENUITEM); cl.hIcon = hiCheckMenu; cl.position = 10000000; cl.pszService = MS_WWI_CHECK_BIRTHDAYS; cl.pszName = "Check for birthdays"; cl.pszPopupName = "Birthdays (When Was It)"; hmCheckBirthdays = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl); cl.pszService = MS_WWI_LIST_SHOW; cl.pszName = "Birthday list"; cl.hIcon = hiListMenu; hmBirthdayList = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl); cl.pszService = MS_WWI_REFRESH_USERDETAILS; cl.position = 10100000; cl.pszName = "Refresh user details"; cl.hIcon = hiRefreshUserDetails; hmRefreshDetails = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl); cl.pszService = MS_WWI_IMPORT_BIRTHDAYS; cl.position = 10200000; cl.pszName = "Import birthdays"; cl.hIcon = hiImportBirthdays; hmImportBirthdays = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl); cl.pszService = MS_WWI_EXPORT_BIRTHDAYS; cl.pszName = "Export birthdays"; cl.hIcon = hiExportBirthdays; hmExportBirthdays = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl); cl.pszService = MS_WWI_ADD_BIRTHDAY; cl.position = 10000000; cl.hIcon = hiAddBirthdayContact; cl.pszName = "Add/change user &birthday"; hmAddChangeBirthday = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &cl); if(ServiceExists(MS_HOTKEY_REGISTER)) { HOTKEYDESC hotkey = {0}; hotkey.cbSize = sizeof(hotkey); hotkey.dwFlags = HKD_TCHAR; hotkey.ptszSection = LPGENT("Birthdays"); hotkey.pszName = "wwi_birthday_list"; hotkey.ptszDescription = LPGENT("Birthday list"); hotkey.pszService = MS_WWI_LIST_SHOW; CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&hotkey); hotkey.pszName = "wwi_check_birthdays"; hotkey.ptszDescription = LPGENT("Check for birthdays"); hotkey.pszService = MS_WWI_CHECK_BIRTHDAYS; CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&hotkey); } return 0; }