/* MetaContacts Plugin for Miranda IM. Copyright © 2004 Universite Louis PASTEUR, STRASBOURG. 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 metacontacts.h * * Header declaring functions that are accessed in multiple files. */ #define _CRT_SECURE_NO_DEPRECATE #define _USE_32BIT_TIME_T #define _WIN32_WINNT 0x0400 #define _WIN32_IE 0x0300 #include #include #include #include #include #include #include #include #include #include #include #include "resource.h" #include "m_metacontacts.h" #include "IcoLib.h" #include "../../include/newpluginapi.h" #include "../../include/m_clist.h" #include "../../include/m_clui.h" #include "../../include/m_skin.h" #include "../../include/m_langpack.h" #include "../../include/m_protomod.h" #include "../../include/m_database.h" #include "../../include/m_system.h" #include "../../include/m_protocols.h" #include "../../include/m_userinfo.h" #include "../../include/m_options.h" #include "../../include/m_protosvc.h" #include "../../include/m_utils.h" #include "../../include/m_ignore.h" #include "../../include/m_clc.h" #include "../../include/m_contacts.h" #include "../../include/m_message.h" #include "../../include/m_ignore.h" #include "../../include/m_langpack.h" #include "../../include/m_popup.h" #include "../mwclist/CLUIFrames/m_cluiframes.h" #include "../updater/m_updater.h" #define META_PROTO "MetaContacts" #define META_FILTER "MetaContactsFilter" #define META_ID "MetaID" #define META_FILTER_ID "MetaFilterID" #define META_LINK "MetaLink" #define META_HIDDEN_GROUP "MetaContacts Hidden Group" #define MAX_CONTACTS 20 // I can't think of a way around this - mental block int TranslateMenuFunc(HANDLE hContact, int i); extern HANDLE hMenuContact[MAX_CONTACTS]; int MenuFunc0(WPARAM wParam, LPARAM lParam); int MenuFunc1(WPARAM wParam, LPARAM lParam); int MenuFunc2(WPARAM wParam, LPARAM lParam); int MenuFunc3(WPARAM wParam, LPARAM lParam); int MenuFunc4(WPARAM wParam, LPARAM lParam); int MenuFunc5(WPARAM wParam, LPARAM lParam); int MenuFunc6(WPARAM wParam, LPARAM lParam); int MenuFunc7(WPARAM wParam, LPARAM lParam); int MenuFunc8(WPARAM wParam, LPARAM lParam); int MenuFunc9(WPARAM wParam, LPARAM lParam); int MenuFunc10(WPARAM wParam, LPARAM lParam); int MenuFunc11(WPARAM wParam, LPARAM lParam); int MenuFunc12(WPARAM wParam, LPARAM lParam); int MenuFunc13(WPARAM wParam, LPARAM lParam); int MenuFunc14(WPARAM wParam, LPARAM lParam); int MenuFunc15(WPARAM wParam, LPARAM lParam); int MenuFunc16(WPARAM wParam, LPARAM lParam); int MenuFunc17(WPARAM wParam, LPARAM lParam); int MenuFunc18(WPARAM wParam, LPARAM lParam); int MenuFunc19(WPARAM wParam, LPARAM lParam); extern HINSTANCE hInstance; extern PLUGININFO pluginInfo; // contact menu items extern HANDLE hMenuConvert, hMenuAdd, hMenuEdit, hMenuDelete, hMenuDefault, hMenuForceDefault; // main menu item extern HANDLE hMenuOnOff; extern DWORD nextMetaID; extern int mcStatus; extern HANDLE metaMainThread; int Meta_Convert(WPARAM wParam,LPARAM lParam); int Meta_AddTo(WPARAM wParam,LPARAM lParam); int Meta_Edit(WPARAM wParam,LPARAM lParam); void Meta_RemoveContactNumber(HANDLE hMeta, int number); int Meta_Delete(WPARAM wParam,LPARAM lParam); int Meta_Default(WPARAM wParam,LPARAM lParam); int Meta_ForceDefault(WPARAM wParam,LPARAM lParam); int Meta_IsEnabled(); int Meta_EqualDBV(DBVARIANT *dbv, DBVARIANT *id); int Meta_ModifyMenu(WPARAM wParam,LPARAM lParam); BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default); HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id); int Meta_SetNick(char *proto); HANDLE Meta_GetMostOnline(HANDLE hMeta); HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long capability); int Meta_HideLinkedContacts(void); int Meta_SetHandles(void); int Meta_UnhideLinkedContacts(void); int Meta_GetContactNumber(HANDLE hContact); HANDLE Meta_GetContactHandle(HANDLE hMeta, int contact_number); void Meta_GetStatusString(int status, char *buf, size_t size); void Meta_RestoreGroup(HANDLE hContact); void Meta_SetGroup(HANDLE hContact); int Meta_HideMetaContacts(int hide); int Meta_SuppressStatus(int suppress); int Meta_CopyContactNick(HANDLE hMeta, HANDLE hContact); void Meta_CopyData(HANDLE hMeta); int Meta_SetAllNicks(); int Meta_IsHiddenGroup(const char *group_name); int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2); // function to copy history from one contact to another - courtesy JdGordon with mods (thx) void copyHistory(HANDLE hContactFrom,HANDLE hContactTo); // inverse //void Meta_RemoveHistory(HANDLE hContactRemoveFrom, HANDLE hContactSource); void Meta_FixStatus(HANDLE hMeta); char *Meta_GetUniqueIdentifier(HANDLE hContact, DWORD *pused); int Meta_GetCaps(WPARAM wParam,LPARAM lParam); int Meta_GetName(WPARAM wParam,LPARAM lParam); int Meta_LoadIcon(WPARAM wParam,LPARAM lParam); int Meta_SetStatus(WPARAM wParam,LPARAM lParam); int Meta_GetStatus(WPARAM wParam,LPARAM lParam); int Meta_SendMessage(WPARAM wParam,LPARAM lParam); int Meta_RecvMessage(WPARAM wParam,LPARAM lParam); int Meta_ContactMenuFunc(WPARAM wParam, LPARAM lParam); BOOL CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); BOOL CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); void Meta_InitServices(); void Meta_CloseHandles(); enum MenuDisplayNameType {DNT_UID = 0, DNT_DID = 1}; enum MenuFunctionType {FT_MSG = 0, FT_MENU = 1, FT_INFO = 2}; enum CListDisplayNameType {CNNT_NICK = 0, CNNT_DISPLAYNAME = 1}; typedef struct tag_MetaOptions { BOOL set_default_on_recv; BOOL always_use_default; BOOL suppress_status; int menu_contact_label; int clist_contact_name; int menu_function; BOOL suppress_proto; BOOL copy_subcontact_history; int days_history; int set_status_from_offline_delay; BOOL subcontact_windows; BOOL metahistory; BOOL subhistory; BOOL copydata; BOOL lockHandle; BOOL temp_default; BOOL flash_meta_message_icon; BOOL copy_userinfo; BOOL use_proto_recv; } MetaOptions; extern MetaOptions options; BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); int Meta_WriteOptions(MetaOptions *opt); int Meta_ReadOptions(MetaOptions *opt); // API function headers int MetaAPI_GetMeta(WPARAM wParam, LPARAM lParam); int MetaAPI_GetDefault(WPARAM wParam, LPARAM lParam); int MetaAPI_GetDefaultNum(WPARAM wParam, LPARAM lParam); int MetaAPI_GetMostOnline(WPARAM wParam, LPARAM lParam); int MetaAPI_GetNumContacts(WPARAM wParam, LPARAM lParam); int MetaAPI_GetContact(WPARAM wParam, LPARAM lParam); int MetaAPI_SetDefaultContactNum(WPARAM wParam, LPARAM lParam); int MetaAPI_SetDefaultContact(WPARAM wParam, LPARAM lParam); int MetaAPI_ForceSendContactNum(WPARAM wParam, LPARAM lParam); int MetaAPI_ForceSendContact(WPARAM wParam, LPARAM lParam); int MetaAPI_UnforceSendContact(WPARAM wParam, LPARAM lParam); int MetaAPI_ForceDefault(WPARAM wParam, LPARAM lParam); int MetaAPI_GetForceState(WPARAM wParam, LPARAM lParam); int MetaAPI_GetProtoName(WPARAM wParam, LPARAM lParam); int MetaAPI_ConvertToMeta(WPARAM wParam, LPARAM lParam); int MetaAPI_AddToMeta(WPARAM wParam, LPARAM lParam); int MetaAPI_RemoveFromMeta(WPARAM wParam, LPARAM lParam); int MetaAPI_DisableHiddenGroup(WPARAM wParam, LPARAM lParam); // extended db get/write setting functions, that handle unicode int MyDBWriteContactSetting(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); int MyDBGetContactSetting(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); // IcoLib support extern HICON hIconToggleOn, hIconToggleOff, hIconConvert, hIconAdd, hIconEdit, hIconDefault, hIconRemove; void InitIcons(); void DeinitIcons(); extern HANDLE hEventDefaultChanged, hEventForceSend, hEventUnforceSend, hSubcontactsChanged; extern POINT menuMousePoint; extern BOOL message_window_api_enabled; #define MAX_PROTOCOLS 20 extern int proto_count; extern char proto_names[MAX_PROTOCOLS * 128]; // used for the 'jabber' hack - i.e. hide contacts instead of moving them to the hidden group #define JABBER_UNIQUE_ID_SETTING "jid" // delay setting status from offline - to help reduce innapropriate status notification popups #define DEFAULT_SET_STATUS_SLEEP_TIME 15000 // milliseconds // service from clist_meta_mw, existence means we don't need to hide subcontacts (woohoo - thanks FYR) #define MS_CLUI_METASUPPORT "CLUI/MetaContactSupport" extern BOOL meta_group_hack_disabled; #ifndef MS_CLUI_GETVERSION #define MS_CLUI_GETVERSION "CLUI/GetVersion" extern BOOL os_unicode_enabled; #endif