summaryrefslogtreecommitdiff
path: root/protocols/Xfire/src/setnickname.cpp
blob: f2224ec59a73dddb808736dbc3f56dbe823f8a93 (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
//fürs nick - dialog

#include "stdafx.h"
#include "setnickname.h"

LRESULT CALLBACK DlgNickProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg)
	{
		case WM_INITDIALOG:
		{
			TranslateDialogDefault(hwndDlg);
			SendMessage(hwndDlg,WM_SETICON, (WPARAM)false, (LPARAM)LoadIcon(hinstance, MAKEINTRESOURCE(IDI_TM)));

			DBVARIANT dbv;
			if(!DBGetContactSetting(NULL,protocolname,"Nick",&dbv)) {
				SetDlgItemText(hwndDlg,IDC_NICKNAME,dbv.pszVal);
				DBFreeVariant(&dbv);
			}
			return TRUE;
		}
		case WM_COMMAND:
		{
			if(LOWORD(wParam) == IDOK)
			{
				char nick[255];
				GetDlgItemText(hwndDlg,IDC_NICKNAME,nick,sizeof(nick));

				CallService(XFIRE_SET_NICK,0,(LPARAM)nick);

				EndDialog(hwndDlg,TRUE);
				return TRUE;
			}
			else if(LOWORD(wParam) == IDCANCEL)
			{
				EndDialog(hwndDlg,FALSE);
				return FALSE;
			}
		}
	}
	return FALSE;
}

BOOL ShowSetNick() {
	return DialogBox(hinstance,MAKEINTRESOURCE(IDD_SETNICKNAME),NULL,DlgNickProc);
}