1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
/*
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 _WIN32_WINNT 0x0400
#define _WIN32_IE 0x0300
#include <windows.h>
#include <time.h>
#include <newpluginapi.h>
#include <m_clistint.h>
#include <m_clui.h>
#include <m_skin.h>
#include <m_protomod.h>
#include <m_database.h>
#include <m_system.h>
#include <m_userinfo.h>
#include <m_contacts.h>
#include <m_message.h>
#include <m_ignore.h>
#include <m_icolib.h>
#include <m_langpack.h>
#include <win2k.h>
#include <m_metacontacts.h>
#include "resource.h"
#include "version.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_PTR TranslateMenuFunc(HANDLE hContact, int i);
extern HGENMENU hMenuContact[MAX_CONTACTS];
extern HINSTANCE hInstance;
extern PLUGININFOEX pluginInfo;
// contact menu items
extern HGENMENU hMenuConvert, hMenuAdd, hMenuEdit, hMenuDelete, hMenuDefault, hMenuForceDefault, hMenuOnOff;
extern DWORD nextMetaID;
extern int mcStatus;
INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_AddTo(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_Edit(WPARAM wParam,LPARAM lParam);
void Meta_RemoveContactNumber(HANDLE hMeta, int number);
INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_Default(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_ForceDefault(WPARAM wParam,LPARAM lParam);
INT_PTR 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_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_PTR Meta_GetCaps(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_GetName(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_LoadIcon(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_SetStatus(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_GetStatus(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_SendMessage(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_RecvMessage(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_ContactMenuFunc(WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR 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};
struct MetaOptions
{
BYTE set_default_on_recv;
BYTE always_use_default;
BYTE suppress_status;
BYTE copy_subcontact_history;
BYTE subcontact_windows;
BYTE metahistory;
BYTE subhistory;
BYTE copydata;
BYTE lockHandle;
BYTE temp_default;
BYTE flash_meta_message_icon;
BYTE copy_userinfo;
BYTE use_proto_recv;
int menu_contact_label;
int menu_function;
int clist_contact_name;
int days_history;
int set_status_from_offline_delay;
};
extern MetaOptions options;
INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcOptsPriorities(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
int Meta_WriteOptions(MetaOptions *opt);
int Meta_ReadOptions(MetaOptions *opt);
int GetDefaufaultPrio(int status);
int GetRealPriority(char *proto, int status);
// API function headers
INT_PTR MetaAPI_GetMeta(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_GetDefault(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_GetDefaultNum(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_GetMostOnline(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_GetNumContacts(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_GetContact(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_SetDefaultContactNum(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_SetDefaultContact(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_ForceSendContactNum(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_ForceSendContact(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_UnforceSendContact(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_ForceDefault(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_GetForceState(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_GetProtoName(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_ConvertToMeta(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_AddToMeta(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_RemoveFromMeta(WPARAM wParam, LPARAM lParam);
INT_PTR MetaAPI_DisableHiddenGroup(WPARAM wParam, LPARAM lParam);
// extended db get/write setting functions, that handle unicode
INT_PTR MyDBWriteContactSetting(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv);
INT_PTR Mydb_get(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv);
// IcoLib support
void InitIcons(void);
typedef enum {I_MENUOFF, I_MENU, I_CONVERT, I_ADD, I_EDIT, I_SETDEFAULT, I_REMOVE} IconIndex;
HICON LoadIconEx(IconIndex i);
HANDLE GetIconHandle(IconIndex i);
extern HANDLE hEventDefaultChanged, hEventForceSend, hEventUnforceSend, hSubcontactsChanged;
extern POINT menuMousePoint;
extern BOOL message_window_api_enabled;
#define MAX_PROTOCOLS 20
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"
#define szDelMsg LPGEN("You are going to remove all the contacts associated with this MetaContact.\nThis will delete the MetaContact.\n\nProceed Anyway?")
#endif
|