summaryrefslogtreecommitdiff
path: root/plugins/AVS/src/userInfo.cpp
blob: 3b7a4bd1297a89d03b97b43af64c936387510bd1 (plain)
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
/*
Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org)

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 version 2
of the License.

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, see <http://www.gnu.org/licenses/>.
*/

#include "stdafx.h"

BOOL ScreenToClient(HWND hWnd, LPRECT lpRect);

/////////////////////////////////////////////////////////////////////////////////////////

void LoadTransparentData(HWND hwndDlg, MCONTACT hContact)
{
	CheckDlgButton(hwndDlg, IDC_MAKETRANSPBKG, db_get_b(hContact, "ContactPhoto", "MakeTransparentBkg", g_plugin.getByte("MakeTransparentBkg", 0)) ? BST_CHECKED : BST_UNCHECKED);
	SendDlgItemMessage(hwndDlg, IDC_BKG_NUM_POINTS_SPIN, UDM_SETPOS, 0, (LPARAM)db_get_w(hContact, "ContactPhoto", "TranspBkgNumPoints", g_plugin.getWord("TranspBkgNumPoints", 5)));
	SendDlgItemMessage(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN, UDM_SETPOS, 0, (LPARAM)db_get_w(hContact, "ContactPhoto", "TranspBkgColorDiff", g_plugin.getWord("TranspBkgColorDiff", 10)));

	BOOL transp_enabled = IsDlgButtonChecked(hwndDlg, IDC_MAKETRANSPBKG);
	EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_L), transp_enabled);
	EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_SPIN), transp_enabled);
	EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS), transp_enabled);
	EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_L), transp_enabled);
	EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN), transp_enabled);
	EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE), transp_enabled);
}

static void SaveTransparentData(HWND hwndDlg, MCONTACT hContact)
{
	BOOL transp = IsDlgButtonChecked(hwndDlg, IDC_MAKETRANSPBKG);
	if (g_plugin.getByte("MakeTransparentBkg", 0) == transp)
		db_unset(hContact, "ContactPhoto", "MakeTransparentBkg");
	else
		db_set_b(hContact, "ContactPhoto", "MakeTransparentBkg", transp);

	uint16_t tmp = (uint16_t)SendDlgItemMessage(hwndDlg, IDC_BKG_NUM_POINTS_SPIN, UDM_GETPOS, 0, 0);
	if (g_plugin.getWord("TranspBkgNumPoints", 5) == tmp)
		db_unset(hContact, "ContactPhoto", "TranspBkgNumPoints");
	else
		db_set_w(hContact, "ContactPhoto", "TranspBkgNumPoints", tmp);

	tmp = (uint16_t)SendDlgItemMessage(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN, UDM_GETPOS, 0, 0);
	if (g_plugin.getWord("TranspBkgColorDiff", 10) == tmp)
		db_unset(hContact, "ContactPhoto", "TranspBkgColorDiff");
	else
		db_set_w(hContact, "ContactPhoto", "TranspBkgColorDiff", tmp);
}

void SaveTransparentData(HWND hwndDlg, MCONTACT hContact, BOOL locked)
{
	SaveTransparentData(hwndDlg, hContact);

	MCONTACT tmp = GetContactThatHaveTheAvatar(hContact, locked);
	if (tmp != hContact)
		SaveTransparentData(hwndDlg, tmp);
}

/////////////////////////////////////////////////////////////////////////////////////////
// User info dialog

class AvatarUserInfoDlg : public CUserInfoPageDlg
{
	HANDLE hHook = nullptr;

	CCtrlSpin spinPoints, spinDifference;
	CCtrlCheck chkTransparent;
	CCtrlButton btnHide, btnChange, btnDefaults, btnProtect, btnReset, btnDelete;

	void ReloadAvatar()
	{
		SaveTransparentData(m_hwnd, m_hContact, IsDlgButtonChecked(m_hwnd, IDC_PROTECTAVATAR));
		ChangeAvatar(m_hContact, true);
	}

	INT_PTR OnChangeAvatar(UINT, WPARAM, LPARAM)
	{
		InvalidateRect(GetDlgItem(m_hwnd, IDC_PROTOPIC), nullptr, TRUE);
		return 0;
	}

	UI_MESSAGE_MAP(AvatarUserInfoDlg, CUserInfoPageDlg);
		UI_MESSAGE(DM_AVATARCHANGED, OnChangeAvatar);
	UI_MESSAGE_MAP_END();

public:
	AvatarUserInfoDlg() :
		CUserInfoPageDlg(g_plugin, IDD_USER_AVATAR),
		btnHide(this, IDC_HIDEAVATAR),
		btnReset(this, IDC_RESET),
		btnChange(this, IDC_CHANGE),
		btnDelete(this, IDC_DELETE),
		btnProtect(this, IDC_PROTECTAVATAR),
		btnDefaults(this, ID_USE_DEFAULTS),
		chkTransparent(this, IDC_MAKETRANSPBKG),
		spinPoints(this, IDC_BKG_NUM_POINTS_SPIN, 8, 2),
		spinDifference(this, IDC_BKG_NUM_POINTS_SPIN, 100)
	{
		btnHide.OnClick = Callback(this, &AvatarUserInfoDlg::onClick_Hide);
		btnReset.OnClick = Callback(this, &AvatarUserInfoDlg::onClick_Reset);
		btnChange.OnClick = Callback(this, &AvatarUserInfoDlg::onClick_Change);
		btnDelete.OnClick = Callback(this, &AvatarUserInfoDlg::onClick_Delete);
		btnProtect.OnClick = Callback(this, &AvatarUserInfoDlg::onClick_Protect);
		btnDefaults.OnClick = Callback(this, &AvatarUserInfoDlg::onClick_UseDefaults);

		chkTransparent.OnChange = Callback(this, &AvatarUserInfoDlg::onChange_Transparent);
	}

	bool OnInitDialog() override
	{
		hHook = HookEventMessage(ME_AV_AVATARCHANGED, m_hwnd, DM_AVATARCHANGED);

		if (m_hContact != 0)
			btnDelete.Hide();

		LoadTransparentData(m_hwnd, GetContactThatHaveTheAvatar(m_hContact));
		return true;
	}

	bool OnRefresh() override
	{
		HWND protopic = GetDlgItem(m_hwnd, IDC_PROTOPIC);
		SendMessage(protopic, AVATAR_SETCONTACT, 0, m_hContact);
		SendMessage(protopic, AVATAR_SETAVATARBORDERCOLOR, 0, GetSysColor(COLOR_BTNSHADOW));
		SendMessage(protopic, AVATAR_SETNOAVATARTEXT, 0, (LPARAM)LPGENW("Contact has no avatar"));
		SendMessage(protopic, AVATAR_RESPECTHIDDEN, 0, FALSE);
		SendMessage(protopic, AVATAR_SETRESIZEIFSMALLER, 0, FALSE);

		CheckDlgButton(m_hwnd, IDC_PROTECTAVATAR, db_get_b(m_hContact, "ContactPhoto", "Locked", 0) ? BST_CHECKED : BST_UNCHECKED);
		CheckDlgButton(m_hwnd, IDC_HIDEAVATAR, Contact::IsHidden(m_hContact) ? BST_CHECKED : BST_UNCHECKED);
		return false;
	}

	bool IsEmpty() const override
	{
		auto wszFileName(db_get_wsm(m_hContact, "ContactPhoto", "File"));
		return (wszFileName.IsEmpty() || _waccess(wszFileName, 0) != 0);
	}

	void OnDestroy() override
	{
		UnhookEvent(hHook);
	}

	void onClick_UseDefaults(CCtrlButton *)
	{
		m_hContact = GetContactThatHaveTheAvatar(m_hContact);

		db_unset(m_hContact, "ContactPhoto", "MakeTransparentBkg");
		db_unset(m_hContact, "ContactPhoto", "TranspBkgNumPoints");
		db_unset(m_hContact, "ContactPhoto", "TranspBkgColorDiff");

		LoadTransparentData(m_hwnd, m_hContact);
		ReloadAvatar();
	}

	void onClick_Change(CCtrlButton *)
	{
		SetAvatar(m_hContact, 0);
		CheckDlgButton(m_hwnd, IDC_PROTECTAVATAR, db_get_b(m_hContact, "ContactPhoto", "Locked", 0) ? BST_CHECKED : BST_UNCHECKED);
	}

	void onClick_Hide(CCtrlButton *)
	{
		bool hidden = IsDlgButtonChecked(m_hwnd, IDC_HIDEAVATAR) != 0;
		SetAvatarAttribute(m_hContact, AVS_HIDEONCLIST, hidden);
		if (hidden != Contact::IsHidden(m_hContact))
			Contact::Hide(m_hContact, hidden);
	}

	void onClick_Protect(CCtrlButton *)
	{
		BOOL locked = IsDlgButtonChecked(m_hwnd, IDC_PROTECTAVATAR);
		SaveTransparentData(m_hwnd, m_hContact, locked);
		ProtectAvatar(m_hContact, locked ? 1 : 0);
	}

	void onChange_Transparent(CCtrlCheck *)
	{
		BOOL enable = IsDlgButtonChecked(m_hwnd, IDC_MAKETRANSPBKG);
		EnableWindow(GetDlgItem(m_hwnd, IDC_BKG_NUM_POINTS_L), enable);
		EnableWindow(GetDlgItem(m_hwnd, IDC_BKG_NUM_POINTS_SPIN), enable);
		EnableWindow(GetDlgItem(m_hwnd, IDC_BKG_NUM_POINTS), enable);
		EnableWindow(GetDlgItem(m_hwnd, IDC_BKG_COLOR_DIFFERENCE_L), enable);
		EnableWindow(GetDlgItem(m_hwnd, IDC_BKG_COLOR_DIFFERENCE_SPIN), enable);
		EnableWindow(GetDlgItem(m_hwnd, IDC_BKG_COLOR_DIFFERENCE), enable);
		ReloadAvatar();
	}

	void onClick_Reset(CCtrlButton *)
	{
		ProtectAvatar(m_hContact, 0);
		if (MessageBox(nullptr, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) {
			DBVARIANT dbv = { 0 };
			if (!db_get_ws(m_hContact, "ContactPhoto", "File", &dbv)) {
				DeleteFile(dbv.pwszVal);
				db_free(&dbv);
			}
		}
		db_unset(m_hContact, "ContactPhoto", "Locked");
		db_unset(m_hContact, "ContactPhoto", "Backup");
		db_unset(m_hContact, "ContactPhoto", "RFile");
		db_unset(m_hContact, "ContactPhoto", "File");
		db_unset(m_hContact, "ContactPhoto", "Format");

		char *szProto = Proto_GetBaseAccountName(m_hContact);
		db_unset(m_hContact, szProto, "AvatarHash");
		DeleteAvatarFromCache(m_hContact, FALSE);

		QueueAdd(m_hContact);
	}

	void onClick_Delete(CCtrlButton *)
	{
		ProtectAvatar(m_hContact, 0);
		if (MessageBoxW(nullptr, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) {
			DBVARIANT dbv = { 0 };
			if (!db_get_ws(m_hContact, "ContactPhoto", "File", &dbv)) {
				DeleteFile(dbv.pwszVal);
				db_free(&dbv);
			}
		}
		db_unset(m_hContact, "ContactPhoto", "Locked");
		db_unset(m_hContact, "ContactPhoto", "Backup");
		db_unset(m_hContact, "ContactPhoto", "RFile");
		db_unset(m_hContact, "ContactPhoto", "File");
		db_unset(m_hContact, "ContactPhoto", "Format");
		DeleteAvatarFromCache(m_hContact, FALSE);
	}
};

/////////////////////////////////////////////////////////////////////////////////////////
// Protocol avatar dialog

class AvatarProtoInfoDlg : public CUserInfoPageDlg
{
	char* GetSelectedProtocol()
	{
		// Get selection
		int iItem = protocols.GetSelectionMark();
		if (iItem < 0)
			return nullptr;

		// Get protocol name
		LVITEM item = {0};
		item.mask = LVIF_PARAM;
		item.iItem = iItem;
		SendMessage(protocols.GetHwnd(), LVM_GETITEMA, 0, (LPARAM)&item);
		return (char *)item.lParam;
	}

	void OffsetWindow(int iCtrlId, int dx)
	{
		HWND hwnd = GetDlgItem(m_hwnd, iCtrlId);
		
		RECT rc;
		GetWindowRect(hwnd, &rc);
		ScreenToClient(m_hwnd, &rc);
		OffsetRect(&rc, dx, 0);
		MoveWindow(hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE);
	}

	void EnableDisableControls(char *proto)
	{
		if (chkPerProto.IsChecked()) {
			if (proto == nullptr) {
				EnableWindow(GetDlgItem(m_hwnd, IDC_CHANGE), FALSE);
				EnableWindow(GetDlgItem(m_hwnd, IDC_DELETE), FALSE);
			}
			else {
				if (!ProtoServiceExists(proto, PS_SETMYAVATAR)) {
					EnableWindow(GetDlgItem(m_hwnd, IDC_CHANGE), FALSE);
					EnableWindow(GetDlgItem(m_hwnd, IDC_DELETE), FALSE);
				}
				else {
					EnableWindow(GetDlgItem(m_hwnd, IDC_CHANGE), TRUE);

					int width, height;
					SendDlgItemMessage(m_hwnd, IDC_PROTOPIC, AVATAR_GETUSEDSPACE, (WPARAM)&width, (LPARAM)&height);
					EnableWindow(GetDlgItem(m_hwnd, IDC_DELETE), (LPARAM)width != 0 || height != 0);
				}
			}
		}
		else {
			EnableWindow(GetDlgItem(m_hwnd, IDC_CHANGE), TRUE);

			if (g_plugin.getByte("GlobalUserAvatarNotConsistent", 1))
				EnableWindow(GetDlgItem(m_hwnd, IDC_DELETE), TRUE);
			else {
				int width, height;
				SendDlgItemMessage(m_hwnd, IDC_PROTOPIC, AVATAR_GETUSEDSPACE, (WPARAM)&width, (LPARAM)&height);
				EnableWindow(GetDlgItem(m_hwnd, IDC_DELETE), (LPARAM)width != 0 || height != 0);
			}
		}
	}

	CCtrlCheck chkPerProto;
	CCtrlButton btnChange, btnDelete;
	CCtrlListView protocols;

public:
	AvatarProtoInfoDlg() :
		CUserInfoPageDlg(g_plugin, IDD_PROTO_AVATARS),
		protocols(this, IDC_PROTOCOLS),
		btnChange(this, IDC_CHANGE),
		btnDelete(this, IDC_DELETE),
		chkPerProto(this, IDC_PER_PROTO)
	{
		protocols.OnItemChanged = Callback(this, &AvatarProtoInfoDlg::onItemChanged_List);

		btnChange.OnClick = Callback(this, &AvatarProtoInfoDlg::onClick_Change);
		btnDelete.OnClick = Callback(this, &AvatarProtoInfoDlg::onClick_Delete);

		CreateLink(chkPerProto, g_plugin.bPerProto);
		chkPerProto.OnChange = Callback(this, &AvatarProtoInfoDlg::onChange_PerProto);
	}

	bool OnInitDialog() override
	{
		HWND protopic = GetDlgItem(m_hwnd, IDC_PROTOPIC);
		SendMessage(protopic, AVATAR_SETAVATARBORDERCOLOR, 0, (LPARAM)GetSysColor(COLOR_BTNSHADOW));
		SendMessage(protopic, AVATAR_SETNOAVATARTEXT, 0, (LPARAM)LPGENW("No avatar"));
		SendMessage(protopic, AVATAR_SETRESIZEIFSMALLER, 0, (LPARAM)FALSE);

		protocols.SetExtendedListViewStyleEx(0, LVS_EX_SUBITEMIMAGES);

		HIMAGELIST hIml = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 4, 0);
		protocols.SetImageList(hIml, LVSIL_SMALL);

		LVCOLUMN lvc = { 0 };
		lvc.mask = LVCF_FMT;
		lvc.fmt = LVCFMT_IMAGE | LVCFMT_LEFT;
		protocols.InsertColumn(0, &lvc);

		LVITEM item = { 0 };
		item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
		item.iItem = 1000;

		// List protocols
		int num = 0;
		for (auto &it : Accounts()) {
			if (!ProtoServiceExists(it->szModuleName, PS_GETMYAVATAR))
				continue;

			if (!Proto_IsAvatarsEnabled(it->szModuleName))
				continue;

			ImageList_AddIcon(hIml, Skin_LoadProtoIcon(it->szModuleName, ID_STATUS_ONLINE));
			item.pszText = it->tszAccountName;
			item.iImage = num;
			item.lParam = (LPARAM)it->szModuleName;
			protocols.InsertItem(&item);
			num++;
		}

		protocols.SetCurSel(0);
		protocols.SetColumnWidth(0, LVSCW_AUTOSIZE);
		protocols.Arrange(LVA_ALIGNLEFT | LVA_ALIGNTOP);
		return true;
	}

	void onItemChanged_List(CCtrlListView::TEventInfo *ev)
	{
		LPNMLISTVIEW li = ev->nmlv;
		if (li->uNewState & LVIS_SELECTED) {
			SendDlgItemMessage(m_hwnd, IDC_PROTOPIC, AVATAR_SETPROTOCOL, 0, li->lParam);
			EnableDisableControls((char*)li->lParam);
		}
	}

	INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override
	{
		if (msg == WM_NOTIFY) {
			LPNMHDR hdr = (LPNMHDR)lParam;
			if (hdr->idFrom == IDC_PROTOPIC && hdr->code == NM_AVATAR_CHANGED)
				EnableDisableControls(GetSelectedProtocol());
		}
		return CDlgBase::DlgProc(msg, wParam, lParam);
	}

	void onClick_Change(CCtrlButton *)
	{
		if (!chkPerProto.IsChecked())
			SetMyAvatar(NULL, NULL);
		else {
			char *proto = GetSelectedProtocol();
			if (proto != nullptr)
				SetMyAvatar((WPARAM)proto, NULL);
		}
	}

	void onClick_Delete(CCtrlButton *)
	{
		if (!chkPerProto.IsChecked()) {
			if (MessageBox(m_hwnd, TranslateT("Are you sure you want to remove your avatar?"), TranslateT("Global avatar"), MB_YESNO) == IDYES)
				SetMyAvatar(NULL, (LPARAM)L"");
		}
		else {
			if (char *proto = GetSelectedProtocol())
				if (MessageBox(m_hwnd, TranslateT("Are you sure you want to remove your avatar?"), _A2T(proto), MB_YESNO) == IDYES)
					SetMyAvatar((WPARAM)proto, (LPARAM)L"");
		}
	}

	void onChange_PerProto(CCtrlCheck *pCheck)
	{
		int diff = 147; // Pre-calc

		if (chkPerProto.IsChecked()) {
			if (!IsWindowVisible(protocols.GetHwnd())) {
				// Show list of protocols
				protocols.Show();

				// Move controls
				OffsetWindow(IDC_PROTOPIC, diff);
				OffsetWindow(IDC_CHANGE, diff);
				OffsetWindow(IDC_DELETE, diff);
			}

			char *proto = GetSelectedProtocol();
			if (proto == nullptr) {
				protocols.SetItemState(0, LVIS_FOCUSED | LVIS_SELECTED, 0x0F);
			}
			else {
				SendDlgItemMessage(m_hwnd, IDC_PROTOPIC, AVATAR_SETPROTOCOL, 0, (LPARAM)proto);
				EnableDisableControls(proto);
			}
		}
		else {
			if (!m_bInitialized) {
				PostMessage(m_hwnd, WM_COMMAND, IDC_PER_PROTO, 0);
			}
			else if (!pCheck || IsWindowVisible(protocols.GetHwnd())) {
				// Hide list of protocols
				protocols.Hide();

				// Move controls
				OffsetWindow(IDC_PROTOPIC, -diff);
				OffsetWindow(IDC_CHANGE, -diff);
				OffsetWindow(IDC_DELETE, -diff);
			}

			SendDlgItemMessage(m_hwnd, IDC_PROTOPIC, AVATAR_SETPROTOCOL, 0, NULL);
		}
	}
};

int OnDetailsInit(WPARAM wParam, LPARAM hContact)
{
	USERINFOPAGE uip = {};
	uip.szTitle.a = LPGEN("Avatar");
	uip.flags = ODPF_ICON;
	uip.dwInitParam = (LPARAM)g_plugin.getIconHandle(IDI_AVATAR);

	if (hContact == NULL) {
		// User dialog
		uip.pDialog = new AvatarProtoInfoDlg();
		g_plugin.addUserInfo(wParam, &uip);
	}
	else {
		char *szProto = Proto_GetBaseAccountName(hContact);
		if (szProto == nullptr || g_plugin.getByte(szProto, 1)) {
			// Contact dialog
			uip.position = -2000000000;
			uip.pDialog = new AvatarUserInfoDlg();
			g_plugin.addUserInfo(wParam, &uip);
		}
	}
	return 0;
}