当前位置: 首页>>代码示例>>C++>>正文


C++ TranslateT函数代码示例

本文整理汇总了C++中TranslateT函数的典型用法代码示例。如果您正苦于以下问题:C++ TranslateT函数的具体用法?C++ TranslateT怎么用?C++ TranslateT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TranslateT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateMutex

FacebookProto::FacebookProto(const char* proto_name,const TCHAR* username) :
	PROTO<FacebookProto>(proto_name, username)
{
	facy.parent = this;

	signon_lock_ = CreateMutex(NULL, FALSE, NULL);
	avatar_lock_ = CreateMutex(NULL, FALSE, NULL);
	log_lock_ = CreateMutex(NULL, FALSE, NULL);
	update_loop_lock_ = CreateEvent(NULL, FALSE, FALSE, NULL);
	facy.buddies_lock_ = CreateMutex(NULL, FALSE, NULL);
	facy.send_message_lock_ = CreateMutex(NULL, FALSE, NULL);
	facy.fcb_conn_lock_ = CreateMutex(NULL, FALSE, NULL);

	m_invisible = false;

	CreateProtoService(PS_CREATEACCMGRUI,		&FacebookProto::SvcCreateAccMgrUI);
	CreateProtoService(PS_GETMYAWAYMSG,			&FacebookProto::GetMyAwayMsg);
	CreateProtoService(PS_GETMYAVATART,			&FacebookProto::GetMyAvatar);
	CreateProtoService(PS_GETAVATARINFOT,		&FacebookProto::GetAvatarInfo);
	CreateProtoService(PS_GETAVATARCAPS,		&FacebookProto::GetAvatarCaps);
	CreateProtoService(PS_GETUNREADEMAILCOUNT,	&FacebookProto::GetNotificationsCount);

	CreateProtoService(PS_JOINCHAT,				&FacebookProto::OnJoinChat);
	CreateProtoService(PS_LEAVECHAT,			&FacebookProto::OnLeaveChat);

	CreateProtoService("/Mind",					&FacebookProto::OnMind);
	CreateProtoService("/VisitProfile",			&FacebookProto::VisitProfile);
	CreateProtoService("/VisitNotifications",	&FacebookProto::VisitNotifications);

	HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &FacebookProto::OnBuildStatusMenu);
	HookProtoEvent(ME_OPT_INITIALISE,           &FacebookProto::OnOptionsInit);
	HookProtoEvent(ME_IDLE_CHANGED,             &FacebookProto::OnIdleChanged);
	HookProtoEvent(ME_TTB_MODULELOADED,         &FacebookProto::OnToolbarInit);
	HookProtoEvent(ME_GC_EVENT,					&FacebookProto::OnGCEvent);
	HookProtoEvent(ME_GC_BUILDMENU,				&FacebookProto::OnGCMenuHook);
	HookProtoEvent(ME_DB_EVENT_MARKED_READ,		&FacebookProto::OnDbEventRead);
	HookProtoEvent(ME_MSG_WINDOWEVENT,			&FacebookProto::OnProcessSrmmEvent);

	db_set_resident(m_szModuleName, "Status");
	db_set_resident(m_szModuleName, "IdleTS");

	InitHotkeys();
	InitPopups();
	InitSounds();

	// Create standard network connection
	TCHAR descr[512];
	NETLIBUSER nlu = {sizeof(nlu)};
	nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
	nlu.szSettingsModule = m_szModuleName;
	mir_sntprintf(descr, SIZEOF(descr), TranslateT("%s server connection"), m_tszUserName);
	nlu.ptszDescriptiveName = descr;
	m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
	if (m_hNetlibUser == NULL)
		MessageBox(NULL, TranslateT("Unable to get Netlib connection for Facebook"), m_tszUserName, MB_OK);

	facy.set_handle(m_hNetlibUser);	

	// Set all contacts offline -- in case we crashed
	SetAllContactStatuses(ID_STATUS_OFFLINE);
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:61,代码来源:proto.cpp

示例2: DlgProcOptsSettings

static BOOL CALLBACK DlgProcOptsSettings(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	CNetwork* network=(CNetwork*)GetWindowLong(GetParent(hwndDlg),GWL_USERDATA);

	switch (msg) {
		case WM_INITDIALOG:	// Options dialog is being initialized
			{
				TranslateDialogDefault(hwndDlg);

				// Add server to list
				SendDlgItemMessage(hwndDlg,IDC_AVATARTYPE,CB_ADDSTRING,NULL,(LPARAM)TranslateT("Head Image and User Head"));
				SendDlgItemMessage(hwndDlg,IDC_AVATARTYPE,CB_ADDSTRING,NULL,(LPARAM)TranslateT("Head Image"));
				SendDlgItemMessage(hwndDlg,IDC_AVATARTYPE,CB_ADDSTRING,NULL,(LPARAM)TranslateT("QQ Show"));
				SendDlgItemMessage(hwndDlg,IDC_AVATARTYPE,CB_ADDSTRING,NULL,(LPARAM)TranslateT("None"));

				if (network) {
					SendDlgItemMessage(hwndDlg,IDC_AVATARTYPE,CB_SETCURSEL,DBGetContactSettingByte(NULL,network->m_szModuleName,QQ_AVATARTYPE,0),0);

					// Check Options
					//CHECK_CONTROL(IDC_BBCODE,QQ_ENABLEBBCODE);
					//CHECK_CONTROL(IDC_SHOWCHAT, DBGetContactSettingByte(NULL,network->m_szModuleName,QQ_SHOWCHAT,0));
					CHECK_CONTROL(IDC_NOADDIDENTITY,QQ_DISABLEIDENTITY);
					CHECK_CONTROL(IDC_REMOVENICKCHARS,QQ_REMOVENICKCHARS);
					CHECK_CONTROL(IDC_REPLYMODEMSG,QQ_REPLYMODEMSG);
					CHECK_CONTROL(IDC_CUSTOMBLOCK2,QQ_BLOCKEMPTYREQUESTS);
					CHECK_CONTROL(IDC_STATUSASPERSONAL,QQ_STATUSASPERSONAL);
					CHECK_CONTROL(IDC_WAITACK,QQ_WAITACK);
					CHECK_CONTROL(IDC_SHOWAD,QQ_SHOWAD);
					CHECK_CONTROL(IDC_MAILNOTIFY,QQ_MAILNOTIFY);
					CHECK_CONTROL(IDC_NOPROGRESSPOPUPS,QQ_NOPROGRESSPOPUPS);
				}

				return TRUE;
			}

		case WM_COMMAND:	// When a control is toggled
			SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			break;

		case WM_NOTIFY:		// When a notify is sent by Options Dialog (Property Sheet)
			if (network && ((LPNMHDR)lParam)->code==PSN_APPLY) {
				int reconnectRequired=0;

				// Check Options
				WRITE_BYTE_SETTING(QQ_AVATARTYPE,SendDlgItemMessage(hwndDlg,IDC_AVATARTYPE,CB_GETCURSEL,0,0));

				CHECK_BYTE_SETTING(QQ_DISABLEIDENTITY,IDC_NOADDIDENTITY);
				WRITE_CHECK_SETTING(QQ_DISABLEIDENTITY,IDC_NOADDIDENTITY);

				CHECK_BYTE_SETTING(QQ_REMOVENICKCHARS,IDC_REMOVENICKCHARS);
				WRITE_CHECK_SETTING(QQ_REMOVENICKCHARS,IDC_REMOVENICKCHARS);

				WRITE_CHECK_SETTING(QQ_REPLYMODEMSG,IDC_REPLYMODEMSG);

				WRITE_CHECK_SETTING(QQ_BLOCKEMPTYREQUESTS,IDC_CUSTOMBLOCK2);

				WRITE_CHECK_SETTING(QQ_STATUSASPERSONAL,IDC_STATUSASPERSONAL);

				//CHECK_BYTE_SETTING(QQ_WAITACK,IDC_WAITACK);
				WRITE_CHECK_SETTING(QQ_WAITACK,IDC_WAITACK);
				network->m_needAck=IsDlgButtonChecked(hwndDlg,IDC_WAITACK);

				WRITE_CHECK_SETTING(QQ_SHOWAD,IDC_SHOWAD);
				WRITE_CHECK_SETTING(QQ_MAILNOTIFY,IDC_MAILNOTIFY);

				WRITE_CHECK_SETTING(QQ_NOPROGRESSPOPUPS,IDC_NOPROGRESSPOPUPS);

				if(Packet::isClientKeySet() && reconnectRequired) MessageBox(hwndDlg,TranslateT("The changes you have made require you to reconnect to the QQ network before they take effect"),APPNAME,MB_OK);
				return TRUE;
			}
			break;
	}
	return FALSE;
}
开发者ID:v998,项目名称:studiokuma,代码行数:74,代码来源:options.cpp

示例3: DlgProcOptsAcc

// DlgProcOpts(): Dialog Callback
// hwndDlg: hWnd to options dialog
// msg: Window message received
// wParam: Depending on msg
// lParam: Depending on msg
static BOOL CALLBACK DlgProcOptsAcc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	CNetwork* network=(CNetwork*)GetWindowLong(GetParent(hwndDlg),GWL_USERDATA);

	switch (msg)
	{
		case WM_INITDIALOG:	// Options dialog is being initialized
		{
			DBVARIANT dbv;
			HWND hControl;
			char** pszServers=servers;
			TranslateDialogDefault(hwndDlg);

			// Add server to list
			hControl=GetDlgItem(hwndDlg,IDC_SERVER);
			while (*pszServers) {
				ADD_LIST_ITEM(*pszServers);
				pszServers++;
			}

			SendDlgItemMessage(hwndDlg,IDC_AVATARTYPE,CB_ADDSTRING,NULL,(LPARAM)TranslateT("Head Image and User Head"));
			SendDlgItemMessage(hwndDlg,IDC_AVATARTYPE,CB_ADDSTRING,NULL,(LPARAM)TranslateT("Head Image"));
			SendDlgItemMessage(hwndDlg,IDC_AVATARTYPE,CB_ADDSTRING,NULL,(LPARAM)TranslateT("QQ Show"));
			SendDlgItemMessage(hwndDlg,IDC_AVATARTYPE,CB_ADDSTRING,NULL,(LPARAM)TranslateT("None"));

			SendDlgItemMessage(hwndDlg,IDC_CONVERSION,CB_ADDSTRING,NULL,(LPARAM)TranslateT("No Message Conversion"));
			SendDlgItemMessage(hwndDlg,IDC_CONVERSION,CB_ADDSTRING,NULL,(LPARAM)TranslateT("Receive: No Change, Send: Convert to Simplified"));
			SendDlgItemMessage(hwndDlg,IDC_CONVERSION,CB_ADDSTRING,NULL,(LPARAM)TranslateT("Receive: Convert to Traditional, Send: No Change"));
			SendDlgItemMessage(hwndDlg,IDC_CONVERSION,CB_ADDSTRING,NULL,(LPARAM)TranslateT("Receive: Convert to Traditional, Send: Convert to Simplified"));

			if (!(hControl=GetDlgItem(hwndDlg,IDC_NOTICE))) itoa(1,(LPSTR)hControl,10);
			SetWindowText(hControl,L"Miranda IM 专用的 QQ 插件 (MirandaQQ)\n版权所有(C) 2008 小熊工作室,保留所有权利。\n此插件使用 libeva QQ 库,版权所有(C) 云帆。\nThe QQ icon is from Cristal Icons pack, courtesy of Angeli-Ka. Used with permission from author.\n\n此插件是根据 GPL 第二版的条款而授权。你可以修改并重新发布基于此产品的成果,但你「必须保留所有原有的版权宣告」,并将有关之所有代码公开。若要更多信息,请参照 http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 上的 GPL 合约条款,或 http://docs.huihoo.com/open_source/GPL-chinese.html 参考该条款的中文译本。\n最后,由于太多人滥用桥接功能 (桥接20个群过分么?),所以此功能将被永久移除。你们要加回去请自便,但不要再在支持群里询问有关问题。");
			ShowWindow(hControl,SW_SHOWNORMAL);

			if (network) {
				SendMessage(GetDlgItem(hwndDlg,IDC_CONVERSION),CB_SETCURSEL,DBGetContactSettingByte(NULL,network->m_szModuleName,QQ_MESSAGECONVERSION,0),0);

				if(!DBGetContactSetting(NULL,network->m_szModuleName,QQ_LOGINSERVER2,&dbv)) {
					SetDlgItemTextA(hwndDlg,IDC_SERVER,dbv.pszVal);
					DBFreeVariant(&dbv);
				} else {
					SetDlgItemTextA(hwndDlg,IDC_SERVER,*servers);
				}

				// Login ID and Password
				if(!DBGetContactSetting(NULL,network->m_szModuleName,UNIQUEIDSETTING,&dbv)){
					char szID[16];
					ultoa(dbv.lVal,szID,10);
					SetDlgItemTextA(hwndDlg,IDC_LOGIN,szID);
					DBFreeVariant(&dbv);
				}

				SetDlgItemTextA(hwndDlg,IDC_PASSWORD,PASSWORDMASK);

				CHECK_CONTROL(IDC_FORCEINVISIBLE,QQ_INVISIBLE);
				//CHECK_CONTROL(IDC_FORCEUNICODE,QQ_FORCEUNICODE);
				CheckDlgButton(hwndDlg,IDC_FORCEUNICODE,BST_CHECKED);
				EnableWindow(GetDlgItem(hwndDlg,IDC_FORCEUNICODE),FALSE);
				//CHECK_CONTROL2(IDC_AUTOSERVER,QQ_NOAUTOSERVER);
				ShowWindow(GetDlgItem(hwndDlg,IDC_AUTOSERVER),SW_HIDE);

				// Version and Connection Information
				/*
				pszTemp=mir_strdup(szCheckoutTime);

				SetDlgItemTextA(hwndDlg,IDC_VERSION,pszTemp);
				mir_free(pszTemp);
				*/

				WCHAR szTemp[MAX_PATH];
				swprintf(szTemp,TranslateT("This copy of MirandaQQ is based on EVA %S, Module: %S"),version,network->m_szModuleName);
				SetDlgItemText(hwndDlg,IDC_VERSION,szTemp);

				//if (qqSettings->unicode)
					SetDlgItemText(hwndDlg,IDC_UNICODEMSG,TranslateT("Unicode Messaging Support(UTF-8) is Enabled."));
				/*else
					SetDlgItemText(hwndDlg,IDC_UNICODEMSG,TranslateT("Unicode Messaging Support is Disabled."));*/
			}
			return TRUE;
		}


		case WM_COMMAND:	// When a control is toggled
			switch (LOWORD(wParam)) {
				case IDC_LOGIN:
				case IDC_PASSWORD:
				//case IDC_SERVER:
				case IDC_VERSION:
					if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0;
					break;
				case IDC_CONVERSION:
				case IDC_SERVER:
					if (HIWORD(wParam) != CBN_SELCHANGE) return 0;
					
			}
//.........这里部分代码省略.........
开发者ID:v998,项目名称:studiokuma,代码行数:101,代码来源:options.cpp

示例4: DlgProcPopupActions

INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    static bool windowInitialized = false;
    int i;

    switch (msg) {
    case WM_INITDIALOG:
        windowInitialized = false;

        TranslateDialogDefault(hwnd);

        SendMessage(GetDlgItem(hwnd, IDC_ICO_INFO), STM_SETICON, (WPARAM)IcoLib_GetIcon(ICO_MISC_NOTIFY, 0), 0);

        CheckDlgButton(hwnd, IDC_CHK_ENABLEACTIONS, PopupOptions.actions & ACT_ENABLE ? TRUE : FALSE);
        CheckDlgButton(hwnd, IDC_CHK_IMCONTACTSONLY, PopupOptions.actions & ACT_DEF_IMONLY ? TRUE : FALSE);
        CheckDlgButton(hwnd, IDC_CHK_CONTACTSONLY, PopupOptions.actions & ACT_DEF_NOGLOBAL ? TRUE : FALSE);
        CheckDlgButton(hwnd, IDC_CHK_DONTCLOSE, PopupOptions.actions & ACT_DEF_KEEPWND ? TRUE : FALSE);
        CheckDlgButton(hwnd, IDC_CHK_LARGEICONS, PopupOptions.actions & ACT_LARGE ? TRUE : FALSE);
        CheckDlgButton(hwnd, IDC_RD_TEXT, PopupOptions.actions & ACT_TEXT ? TRUE : FALSE);
        CheckDlgButton(hwnd, IDC_RD_LEFTICONS, PopupOptions.actions & ACT_LEFTICONS ? TRUE : FALSE);
        CheckDlgButton(hwnd, IDC_RD_RIGHTICONS, PopupOptions.actions & ACT_RIGHTICONS ? TRUE : FALSE);

        {
            DWORD dwActiveItem = 0;
            HWND hCombo = GetDlgItem(hwnd, IDC_CB_LEFT);
            dwActiveItem = MouseOverride(hCombo, PopupOptions.overrideLeft);
            SendDlgItemMessage(hwnd, IDC_CB_LEFT, CB_SETCURSEL, dwActiveItem, 0);

            dwActiveItem = 0;
            hCombo = GetDlgItem(hwnd, IDC_CB_MIDDLE);
            dwActiveItem = MouseOverride(hCombo, PopupOptions.overrideMiddle);
            SendDlgItemMessage(hwnd, IDC_CB_MIDDLE, CB_SETCURSEL, dwActiveItem, 0);

            dwActiveItem = 0;
            hCombo = GetDlgItem(hwnd, IDC_CB_RIGHT);
            dwActiveItem = MouseOverride(hCombo, PopupOptions.overrideRight);
            SendDlgItemMessage(hwnd, IDC_CB_RIGHT, CB_SETCURSEL, dwActiveItem, 0);

            HWND hwndList = GetDlgItem(hwnd, IDC_ACTIONS);
            ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_CHECKBOXES | LVS_EX_LABELTIP);
            HIMAGELIST hImgList = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 10, 1);
            ListView_SetImageList(hwndList, hImgList, LVSIL_SMALL);

            LVCOLUMN column = {0};
            column.mask = LVCF_TEXT | LVCF_WIDTH;
            column.pszText = TranslateT("Action");
            column.cx = 175;
            ListView_InsertColumn(hwndList, 0, &column);

            ListView_EnableGroupView(hwndList, TRUE);

            LIST<char> groups(1, strcmp);

            for (i = 0; i < gActions.getCount(); ++i) {
                char szGroup[64];
                char *szName = strchr(gActions[i]->lpzTitle, '/');
                if (!szName) szName = gActions[i]->lpzTitle;
                else ++szName;
                lstrcpynA(szGroup, gActions[i]->lpzTitle, szName - gActions[i]->lpzTitle);

                int grpId = 0;

                if ((grpId = groups.getIndex(szGroup)) < 0)
                {
                    LVGROUP group = {0};
                    group.cbSize = sizeof(group);
                    group.mask = LVGF_HEADER | LVGF_GROUPID;
                    LPTSTR wszGroup = mir_a2t(szGroup);
                    group.pszHeader = TranslateTS(wszGroup);
                    group.cchHeader = lstrlen(wszGroup);
                    grpId = group.iGroupId = groups.getCount();
                    int grpId = ListView_InsertGroup(hwndList, -1, &group);
                    mir_free(wszGroup);
                    groups.insert(mir_strdup(szGroup), groups.getCount());
                }

                LVITEM item = {0};
                item.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_TEXT | LVIF_STATE | LVIF_INDENT;
                item.iItem = i;
                ptrT tszName(mir_a2t(szName));
                item.pszText = TranslateTS(tszName);
                item.iImage = ImageList_AddIcon(hImgList, gActions[i]->lchIcon);
                item.lParam = i;
                item.mask |= LVIF_GROUPID;
                item.iGroupId = grpId;
                item.iIndent = 0;
                ListView_InsertItem(hwndList, &item);

                ListView_SetItemState(hwndList, i, (gActions[i]->flags & PAF_ENABLED) ? 0x2000 : 0x1000, LVIS_STATEIMAGEMASK);
            }

            BOOL enabled = (PopupOptions.actions & ACT_ENABLE) ? TRUE : FALSE;
            for (i = 0; i < SIZEOF(controls); ++i)
                EnableWindow(GetDlgItem(hwnd, controls[i]), enabled);
        }
        windowInitialized = true;
        break;

    case WM_COMMAND:
        switch (LOWORD(wParam)) {
//.........这里部分代码省略.........
开发者ID:0xmono,项目名称:miranda-ng,代码行数:101,代码来源:actions.cpp

示例5: AddToList

INT_PTR AddToList(WPARAM, LPARAM lParam)
{
	PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT *) lParam;
	DBVARIANT dbv;
	MCONTACT hContact;
	int sameurl = 0;
	int samename = 0;

	if (psr == NULL)
		return 0;
	if (psr->nick.t == NULL) {
		WErrorPopup((UINT_PTR)"ERROR", TranslateT("Please select site in Find/Add contacts..."));
		return 0;
	}   
	// if contact with the same ID was not found, add it
	if (psr->cbSize != sizeof(PROTOSEARCHRESULT))
		return NULL;
	// search for existing contact
	for (hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) {
		// check ID to see if the contact already exist in the database
		if (db_get_ts(hContact, MODULENAME, "URL", &dbv))
			continue;
		if (!mir_tstrcmpi(psr->nick.t, dbv.ptszVal)) {
			// remove the flag for not on list and hidden, thus make the
			// contact visible
			// and add them on the list
			sameurl ++;
			if (db_get_b(hContact, "CList", "NotOnList", 1)) {
				db_unset(hContact, "CList", "NotOnList");
				db_unset(hContact, "CList", "Hidden");
			}
		}
		db_free(&dbv);
	}

	hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
	Proto_AddToContact(hContact, MODULENAME);

	/////////write to db
	db_set_b(hContact, MODULENAME, ON_TOP_KEY, 0);
	db_set_b(hContact, MODULENAME, DBLE_WIN_KEY, 1);
	db_set_s(hContact, MODULENAME, END_STRING_KEY, "");
	db_set_b(hContact, MODULENAME, RWSPACE_KEY, 1);

	//Convert url into a name for contact
	TCHAR Cnick[255];
	if (psr->nick.t != NULL)
		_tcsncpy(Cnick, psr->nick.t, _countof(Cnick));
	else
		Cnick[0] = 0;

	TCHAR *Oldnick = _tcsstr(Cnick, _T("://"));
	if (Oldnick != 0)
		Oldnick += 3;
	else
		Oldnick = Cnick;

	TCHAR *Newnick = _tcsstr(Oldnick, _T("www."));
	if (Newnick != 0)
		Newnick += 4;
	else {
		Newnick = _tcsstr(Oldnick, _T("WWW."));
		if (Newnick != 0)
			Newnick += 4;
		else
			Newnick = Oldnick;
	}

	TCHAR *Nend = _tcschr(Newnick, '.');
	if (Nend) *Nend = '\0';

	for (MCONTACT hContact2 = db_find_first(MODULENAME); hContact2 != NULL; hContact2 = db_find_next(hContact2, MODULENAME)) {
		if (!db_get_ts(hContact2, MODULENAME, PRESERVE_NAME_KEY, &dbv)) {
			if (!mir_tstrcmpi(Newnick, dbv.ptszVal)) {
				// remove the flag for not on list and hidden, thus make the
				// contact visible
				// and add them on the list
				samename++;
				if (db_get_b(hContact2, "CList", "NotOnList", 1)) {
					db_unset(hContact2, "CList", "NotOnList");
					db_unset(hContact2, "CList", "Hidden");
				}
				db_free(&dbv);
			}
		}
		db_free(&dbv);
	}

	if ((sameurl > 0) || (samename > 0)) // contact has the same url or name as another contact, add rand num to name
	{
		srand((unsigned) time(NULL));
		
		TCHAR ranStr[10];
		_itot((int) 10000 *rand() / (RAND_MAX + 1.0), ranStr, 10);
		mir_tstrcat(Newnick, ranStr);
	}
	//end convert

	db_set_ts(hContact, "CList", "MyHandle", Newnick);
	db_set_ts(hContact, MODULENAME, PRESERVE_NAME_KEY, Newnick);
//.........这里部分代码省略.........
开发者ID:truefriend-cz,项目名称:miranda-ng,代码行数:101,代码来源:webview_services.cpp

示例6: EnableWindow

UINT CDropbox::RequestAcceessTokenAsync(void *owner, void* param)
{
	HWND hwndDlg = (HWND)param;
	CDropbox *instance = (CDropbox*)owner;

	EnableWindow(GetDlgItem(hwndDlg, IDC_AUTHORIZE), FALSE);
	SetDlgItemText(hwndDlg, IDC_AUTH_STATUS, TranslateT("in process..."));

	if (instance->HasAccessToken())
		instance->DestroyAcceessToken();

	char requestToken[128];
	GetDlgItemTextA(hwndDlg, IDC_REQUEST_CODE, requestToken, SIZEOF(requestToken));

	char data[1024];
	mir_snprintf(
		data,
		SIZEOF(data),
		"grant_type=authorization_code&code=%s",
		requestToken);

	HttpRequest *request = new HttpRequest(instance->hNetlibUser, REQUEST_POST, DROPBOX_API_URL "/oauth2/token");
	request->AddBasicAuthHeader(DROPBOX_API_KEY, DROPBOX_API_SECRET);
	request->AddHeader("Content-Type", "application/x-www-form-urlencoded");
	request->pData = mir_strdup(data);
	request->dataLength = (int)strlen(data);

	mir_ptr<NETLIBHTTPREQUEST> response(request->Send());

	delete request;

	MCONTACT hContact = instance->GetDefaultContact();

	if (response)
	{
		JSONROOT root(response->pData);
		if (root)
		{
			if (response->resultCode == HTTP_STATUS_OK)
			{
				JSONNODE *node = json_get(root, "access_token");
				ptrA access_token = ptrA(mir_u2a(json_as_string(node)));
				db_set_s(NULL, MODULE, "TokenSecret", access_token);

				if (hContact)
				{
					if (db_get_w(hContact, MODULE, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
						db_set_w(hContact, MODULE, "Status", ID_STATUS_ONLINE);
				}

				instance->RequestAccountInfo();

				if (hwndDlg)
					SetDlgItemText(hwndDlg, IDC_AUTH_STATUS, TranslateT("you have been authorized"));
				/*else
					ShowNotification(TranslateT("you have been authorized"), MB_ICONINFORMATION);*/
			}
			else
			{
				JSONNODE *node = json_get(root, "error_description");
				ptrW error_description(json_as_string(node));

				if (hwndDlg)
					SetDlgItemText(hwndDlg, IDC_AUTH_STATUS, error_description);
				/*else
					ShowNotification((wchar_t*)error_description, MB_ICONERROR);*/
			}
		}
	}
	else
	{
		if (hwndDlg)
			SetDlgItemText(hwndDlg, IDC_AUTH_STATUS, TranslateT("server does not respond"));

		HandleHttpResponseError(instance->hNetlibUser, response);
	}

	SetDlgItemTextA(hwndDlg, IDC_REQUEST_CODE, "");

	return 0;
}
开发者ID:martok,项目名称:miranda-ng,代码行数:81,代码来源:dropbox.cpp

示例7: MessageBox

LRESULT SendQueue::WarnPendingJobs(unsigned int)
{
	return MessageBox(0,
		TranslateT("There are unsent messages waiting for confirmation.\nIf you close the window now, Miranda will try to send them but may be unable to inform you about possible delivery errors.\nDo you really want to close the window(s)?"),
		TranslateT("Message window warning"), MB_YESNO | MB_ICONHAND);
}
开发者ID:ybznek,项目名称:miranda-ng,代码行数:6,代码来源:sendqueue.cpp

示例8: TranslateT

int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, bool fIsSendLater)
{
	bool  fAvail = sendLater->isAvail();

	const TCHAR *szNote = 0;

	if (fIsSendLater && dat) {
		if (fAvail)
			szNote = TranslateT("Message successfully queued for later delivery.\nIt will be sent as soon as possible and a popup will inform you about the result.");
		else
			szNote = TranslateT("The send later feature is not available on this protocol.");

		T2Utf utfText(szNote);
		DBEVENTINFO dbei;
		dbei.cbSize = sizeof(dbei);
		dbei.eventType = EVENTTYPE_MESSAGE;
		dbei.flags = DBEF_SENT | DBEF_UTF;
		dbei.szModule = GetContactProto(dat->hContact);
		dbei.timestamp = time(NULL);
		dbei.cbBlob = (int)mir_strlen(utfText) + 1;
		dbei.pBlob = (PBYTE)(char*)utfText;
		StreamInEvents(dat->hwnd, 0, 1, 1, &dbei);
		if (dat->hDbEventFirst == NULL)
			SendMessage(dat->hwnd, DM_REMAKELOG, 0, 0);
		dat->cache->saveHistory(0, 0);
		EnableSendButton(dat, FALSE);
		if (dat->pContainer->hwndActive == dat->hwnd)
			UpdateReadChars(dat);
		SendDlgItemMessage(dat->hwnd, IDC_SAVE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_BUTTON_CANCEL]);
		SendDlgItemMessage(dat->hwnd, IDC_SAVE, BUTTONADDTOOLTIP, (WPARAM)pszIDCSAVE_close, BATF_TCHAR);
		dat->dwFlags &= ~MWF_SAVEBTN_SAV;

		if (!fAvail)
			return 0;
	}

	if (iJobIndex >= 0 && iJobIndex < NR_SENDJOBS) {
		SendJob *job = &m_jobs[iJobIndex];
		char szKeyName[20];
		TCHAR tszHeader[150];

		if (fIsSendLater) {
			time_t now = time(0);
			TCHAR tszTimestamp[30];
			_tcsftime(tszTimestamp, _countof(tszTimestamp), _T("%Y.%m.%d - %H:%M"), _localtime32((__time32_t *)&now));
			mir_snprintf(szKeyName, "S%d", now);
			mir_sntprintf(tszHeader, TranslateT("\n(Sent delayed. Original timestamp %s)"), tszTimestamp);
		}
		else mir_sntprintf(tszHeader, _T("M%d|"), time(0));

		T2Utf utf_header(tszHeader);
		size_t required = mir_strlen(utf_header) + mir_strlen(job->szSendBuffer) + 10;
		char *tszMsg = reinterpret_cast<char *>(mir_alloc(required));

		if (fIsSendLater) {
			mir_snprintf(tszMsg, required, "%s%s", job->szSendBuffer, utf_header);
			db_set_s(hContact ? hContact : job->hContact, "SendLater", szKeyName, tszMsg);
		}
		else {
			mir_snprintf(tszMsg, required, "%s%s", utf_header, job->szSendBuffer);
			sendLater->addJob(tszMsg, hContact);
		}
		mir_free(tszMsg);

		if (fIsSendLater) {
			int iCount = db_get_dw(hContact ? hContact : job->hContact, "SendLater", "count", 0);
			iCount++;
			db_set_dw(hContact ? hContact : job->hContact, "SendLater", "count", iCount);
			sendLater->addContact(hContact ? hContact : job->hContact);
		}
		return iJobIndex;
	}
	return -1;
}
开发者ID:ybznek,项目名称:miranda-ng,代码行数:74,代码来源:sendqueue.cpp

示例9: getSendLength

int SendQueue::sendQueued(TWindowData *dat, const int iEntry)
{
	CContactCache *ccActive = CContactCache::getContactCache(dat->hContact);
	if (ccActive == NULL)
		return 0;

	HWND	hwndDlg = dat->hwnd;

	if (dat->sendMode & SMODE_MULTIPLE) {
		int iJobs = 0;
		int iMinLength = 0;

		m_jobs[iEntry].iStatus = SQ_INPROGRESS;
		m_jobs[iEntry].hContact = ccActive->getActiveContact();
		m_jobs[iEntry].hOwnerWnd = hwndDlg;

		size_t iSendLength = getSendLength(iEntry);

		for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
			HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, hContact, 0);
			if (hItem && SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) {
				CContactCache *c = CContactCache::getContactCache(hContact);
				if (c)
					iMinLength = (iMinLength == 0 ? c->getMaxMessageLength() : min(c->getMaxMessageLength(), iMinLength));
			}
		}

		if (iSendLength >= iMinLength) {
			TCHAR	tszError[256];
			mir_sntprintf(tszError, TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), iMinLength);
			::SendMessage(dat->hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, LPARAM(tszError));
			sendQueue->clearJob(iEntry);
			return 0;
		}

		for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
			HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, hContact, 0);
			if (hItem && SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) {
				doSendLater(iEntry, 0, hContact, false);
				iJobs++;
			}
		}

		sendQueue->clearJob(iEntry);
		if (iJobs)
			sendLater->flushQueue(); // force queue processing
		return 0;
	}

	if (dat->hContact == NULL)
		return 0;  //never happens

	dat->nMax = dat->cache->getMaxMessageLength(); // refresh length info

	if (M.GetByte("autosplit", 0) && !(dat->sendMode & SMODE_SENDLATER)) {
		// determine send buffer length
		BOOL fSplit = FALSE;
		if (getSendLength(iEntry) >= dat->nMax)
			fSplit = true;

		if (!fSplit)
			goto send_unsplitted;

		m_jobs[iEntry].hContact = ccActive->getActiveContact();
		m_jobs[iEntry].hOwnerWnd = hwndDlg;
		m_jobs[iEntry].iStatus = SQ_INPROGRESS;
		m_jobs[iEntry].iAcksNeeded = 1;
		m_jobs[iEntry].chunkSize = dat->nMax;

		DWORD dwOldFlags = m_jobs[iEntry].dwFlags;
		mir_forkthread(DoSplitSendA, (LPVOID)iEntry);
		m_jobs[iEntry].dwFlags = dwOldFlags;
	}
	else {
	send_unsplitted:
		m_jobs[iEntry].hContact = ccActive->getActiveContact();
		m_jobs[iEntry].hOwnerWnd = hwndDlg;
		m_jobs[iEntry].iStatus = SQ_INPROGRESS;
		m_jobs[iEntry].iAcksNeeded = 1;
		if (dat->sendMode & SMODE_SENDLATER) {
			TCHAR	tszError[256];

			size_t iSendLength = getSendLength(iEntry);
			if (iSendLength >= dat->nMax) {
				mir_sntprintf(tszError, TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), dat->nMax);
				SendMessage(dat->hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, LPARAM(tszError));
				clearJob(iEntry);
				return 0;
			}
			doSendLater(iEntry, dat);
			clearJob(iEntry);
			return 0;
		}
		m_jobs[iEntry].hSendId = (HANDLE)CallContactService(dat->hContact, PSS_MESSAGE, m_jobs[iEntry].dwFlags, (LPARAM)m_jobs[iEntry].szSendBuffer);

		if (dat->sendMode & SMODE_NOACK) {              // fake the ack if we are not interested in receiving real acks
			ACKDATA ack = { 0 };
			ack.hContact = dat->hContact;
			ack.hProcess = m_jobs[iEntry].hSendId;
			ack.type = ACKTYPE_MESSAGE;
//.........这里部分代码省略.........
开发者ID:ybznek,项目名称:miranda-ng,代码行数:101,代码来源:sendqueue.cpp

示例10: showErrorControls

int SendQueue::ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam)
{
	ACKDATA *ack = (ACKDATA *)lParam;

	TContainerData *m_pContainer = 0;
	if (dat)
		m_pContainer = dat->pContainer;

	int iFound = (int)(LOWORD(wParam));
	SendJob &job = m_jobs[iFound];

	if (job.iStatus == SQ_ERROR) { // received ack for a job which is already in error state...
		if (dat) {                  // window still open
			if (dat->iCurrentQueueError == iFound) {
				dat->iCurrentQueueError = -1;
				showErrorControls(dat, FALSE);
			}
		}
		// we must discard this job, because there is no message window open to handle the
		// error properly. But we display a tray notification to inform the user about the problem.
		else goto inform_and_discard;
	}

	// failed acks are only handled when the window is still open. with no window open, they will be *silently* discarded

	if (ack->result == ACKRESULT_FAILED) {
		if (dat) {
			// "hard" errors are handled differently in multisend. There is no option to retry - once failed, they
			// are discarded and the user is notified with a small log message.
			if (!nen_options.iNoSounds && !(m_pContainer->dwFlags & CNT_NOSOUND))
				SkinPlaySound("SendError");

			TCHAR *szAckMsg = mir_a2t((char *)ack->lParam);
			mir_sntprintf(job.szErrorMsg, TranslateT("Delivery failure: %s"), szAckMsg);
			job.iStatus = SQ_ERROR;
			mir_free(szAckMsg);
			KillTimer(dat->hwnd, TIMERID_MSGSEND + iFound);
			if (!(dat->dwFlags & MWF_ERRORSTATE))
				handleError(dat, iFound);
			return 0;
		}

	inform_and_discard:
		_DebugPopup(job.hContact, TranslateT("A message delivery has failed after the contacts chat window was closed. You may want to resend the last message"));
		clearJob(iFound);
		return 0;
	}

	DBEVENTINFO dbei = { sizeof(dbei) };
	dbei.eventType = EVENTTYPE_MESSAGE;
	dbei.flags = DBEF_SENT;
	dbei.szModule = GetContactProto(job.hContact);
	dbei.timestamp = time(NULL);
	dbei.cbBlob = (int)mir_strlen(job.szSendBuffer) + 1;

	if (dat)
		dat->cache->updateStats(TSessionStats::BYTES_SENT, dbei.cbBlob - 1);
	else {
		CContactCache *cc = CContactCache::getContactCache(job.hContact);
		if (cc)
			cc->updateStats(TSessionStats::BYTES_SENT, dbei.cbBlob - 1);
	}

	if (job.dwFlags & PREF_RTL)
		dbei.flags |= DBEF_RTL;
	dbei.flags |= DBEF_UTF;
	dbei.pBlob = (PBYTE)job.szSendBuffer;

	MessageWindowEvent evt = { sizeof(evt), (INT_PTR)job.hSendId, job.hContact, &dbei };
	NotifyEventHooks(PluginConfig.m_event_WriteEvent, 0, (LPARAM)&evt);

	job.szSendBuffer = (char*)dbei.pBlob;
	MEVENT hNewEvent = db_event_add(job.hContact, &dbei);

	if (m_pContainer)
		if (!nen_options.iNoSounds && !(m_pContainer->dwFlags & CNT_NOSOUND))
			SkinPlaySound("SendMsg");

	M.BroadcastMessage(DM_APPENDMCEVENT, job.hContact, LPARAM(hNewEvent));

	job.hSendId = NULL;
	job.iAcksNeeded--;

	if (job.iAcksNeeded == 0) {              // everything sent
		clearJob(iFound);
		if (dat) {
			KillTimer(dat->hwnd, TIMERID_MSGSEND + iFound);
			dat->iOpenJobs--;
		}
		m_currentIndex--;
	}
	if (dat) {
		checkQueue(dat);

		int iNextFailed = findNextFailed(dat);
		if (iNextFailed >= 0 && !(dat->dwFlags & MWF_ERRORSTATE))
			handleError(dat, iNextFailed);
		else {
			if (M.GetByte("AutoClose", 0)) {
				if (M.GetByte("adv_AutoClose_2", 0))
//.........这里部分代码省略.........
开发者ID:ybznek,项目名称:miranda-ng,代码行数:101,代码来源:sendqueue.cpp

示例11: InviteToChatDialog

INT_PTR CALLBACK InviteToChatDialog(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	InviteChatParam* param = (InviteChatParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);

	switch (uMsg) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hwndDlg);

		SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
		param = (InviteChatParam*)lParam;

		Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_YAHOO));

		SetDlgItemTextA(hwndDlg, IDC_ROOMNAME, param->room);
		SetDlgItemText(hwndDlg, IDC_MSG, TranslateT("Join My Conference..."));
		break;

	case WM_CLOSE:
		EndDialog(hwndDlg, 0);
		break;

	case WM_NCDESTROY:
		Window_FreeIcon_IcoLib(hwndDlg);
		delete param;
		break;

	case WM_NOTIFY:
		{
			NMCLISTCONTROL* nmc = (NMCLISTCONTROL*)lParam;
			if (nmc->hdr.idFrom == IDC_CCLIST) {
				switch (nmc->hdr.code) {
				case CLN_NEWCONTACT:
					if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0)
						ClistValidateContact((MCONTACT)nmc->hItem, nmc->hdr.hwndFrom, param->ppro);
					break;

				case CLN_LISTREBUILT:
					if (param)
						ClistChatPrepare(NULL, nmc->hdr.hwndFrom, param->ppro);
					break;
				}
			}
		}
		break;

	case WM_COMMAND:
		{
			switch (LOWORD(wParam)) {
			case IDC_ADDSCR:
				if (param->ppro->m_bLoggedIn) {
					TCHAR sn[64];
					GetDlgItemText(hwndDlg, IDC_EDITSCR, sn, _countof(sn));

					CLCINFOITEM cii = { 0 };
					cii.cbSize = sizeof(cii);
					cii.flags = CLCIIF_CHECKBOX | CLCIIF_BELOWCONTACTS;
					cii.pszText = sn;

					HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CCLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
					SendDlgItemMessage(hwndDlg, IDC_CCLIST, CLM_SETCHECKMARK, (LPARAM)hItem, 1);
				}
				break;

			case IDOK:
				{
					TCHAR msg[1024];
					GetDlgItemText(hwndDlg, IDC_MSG, msg, _countof(msg));

					HWND hwndList = GetDlgItem(hwndDlg, IDC_CCLIST);
					YList *who = NULL;
					clist_chat_invite_send(NULL, hwndList, who, param->room, param->ppro, msg);

					EndDialog(hwndDlg, IDOK);
					PostMessage(hwndDlg, WM_DESTROY, 0, 0);
				}
				break;

			case IDCANCEL:
				EndDialog(hwndDlg, IDCANCEL);
				PostMessage(hwndDlg, WM_DESTROY, 0, 0);
				break;
			}
		}
		break;
	}
	return FALSE;
}
开发者ID:ybznek,项目名称:miranda-ng,代码行数:87,代码来源:chat.cpp

示例12: FindWindowDlgProc

INT_PTR CALLBACK FindWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_INITDIALOG:
		SendDlgItemMessage(hwnd, IDC_SBAR, SB_SETTEXT, 0, (LPARAM)TranslateT("Enter a string to search the database for"));
		CheckDlgButton(hwnd, IDC_MODNAME, BST_CHECKED);
		CheckDlgButton(hwnd, IDC_SETTINGNAME, BST_CHECKED);
		CheckDlgButton(hwnd, IDC_SETTINGVALUE, BST_CHECKED);
		CheckDlgButton(hwnd, IDC_FOUND, BST_CHECKED);
		SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(ICO_REGEDIT)));
		SetWindowLongPtr(GetDlgItem(hwnd, IDC_REPLACE), GWLP_USERDATA, 0);
		SetWindowLongPtr(GetDlgItem(hwnd, IDC_SEARCH), GWLP_USERDATA, 0);
		SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_APPWINDOW); // taskbar icon
		TranslateDialogDefault(hwnd);
		ListView_SetExtendedListViewStyle(GetDlgItem(hwnd, IDC_LIST), 32 | LVS_EX_LABELTIP); // LVS_EX_GRIDLINES
		loadListSettings(GetDlgItem(hwnd, IDC_LIST), csResultList);
		Utils_RestoreWindowPositionNoMove(hwnd, NULL, MODULENAME, "Search_");
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDOK:
		case IDC_SEARCH:
			if (GetWindowLongPtr(GetDlgItem(hwnd, IDC_SEARCH), GWLP_USERDATA)) // stop the search
				SetWindowLongPtr(GetDlgItem(hwnd, IDC_SEARCH), GWLP_USERDATA, 0);
			else {
				wchar_t text[FLD_SIZE];
				wchar_t replace[FLD_SIZE] = { 0 };

				if (!GetDlgItemText(hwnd, IDC_TEXT, text, _countof(text)) && !IsDlgButtonChecked(hwnd, IDC_EXACT)) break;

				// empty replace is done only for exact match or entire replace
				if (LOWORD(wParam) == IDOK &&
					!GetDlgItemText(hwnd, IDC_REPLACE, replace, _countof(replace)) &&
					(!IsDlgButtonChecked(hwnd, IDC_ENTIRELY) && !IsDlgButtonChecked(hwnd, IDC_EXACT)))
					break;

				if (BST_UNCHECKED == IsDlgButtonChecked(hwnd, IDC_MODNAME) &&
					BST_UNCHECKED == IsDlgButtonChecked(hwnd, IDC_SETTINGNAME) &&
					BST_UNCHECKED == IsDlgButtonChecked(hwnd, IDC_SETTINGVALUE))
					break;

				FindInfo *fi = (FindInfo*)mir_calloc(sizeof(FindInfo));
				if (!fi)
					break;

				fi->hwnd = GetDlgItem(hwnd, IDC_LIST);
				fi->options = (IsDlgButtonChecked(hwnd, IDC_CASESENSITIVE) ? F_CASE : 0) |
					(IsDlgButtonChecked(hwnd, IDC_EXACT) ? F_EXACT : 0) |
					(IsDlgButtonChecked(hwnd, IDC_MODNAME) ? F_MODNAME : 0) |
					(IsDlgButtonChecked(hwnd, IDC_SETTINGNAME) ? F_SETNAME : 0) |
					(IsDlgButtonChecked(hwnd, IDC_SETTINGVALUE) ? F_SETVAL : 0);

				if (LOWORD(wParam) == IDOK) {

					if (IsDlgButtonChecked(hwnd, IDC_ENTIRELY))
						fi->options |= F_ENTIRE;

					fi->replace = mir_wstrdup(replace);

					SetDlgItemText(hwnd, IDOK, TranslateT("Stop"));
					EnableWindow(GetDlgItem(hwnd, IDC_SEARCH), 0);

				}
				else {
					SetDlgItemText(hwnd, IDC_SEARCH, TranslateT("Stop"));
					EnableWindow(GetDlgItem(hwnd, IDOK), 0);
				}

				fi->search = mir_wstrdup(text);

				ListView_DeleteAllItems(fi->hwnd);
				SetWindowLongPtr(GetDlgItem(hwnd, IDC_SEARCH), GWLP_USERDATA, 1);

				EnableWindow(GetDlgItem(hwnd, IDCANCEL), 0);
				mir_forkthread(FindSettings, fi);
			}
			break;

		case IDCANCEL:
			DestroyWindow(hwnd);
			break;
		}
		break;
	case WM_GETMINMAXINFO:
	{
		MINMAXINFO *mmi = (MINMAXINFO*)lParam;
		mmi->ptMinTrackSize.x = 610;
		mmi->ptMinTrackSize.y = 300;
	}
	return 0;

	case WM_SIZE:
		Utils_ResizeDialog(hwnd, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_FIND), FindDialogResize);
		break;

	case WM_NOTIFY:
		if (LOWORD(wParam) != IDC_LIST) break;
		switch (((NMHDR*)lParam)->code) {
		case NM_DBLCLK:
//.........这里部分代码省略.........
开发者ID:tweimer,项目名称:miranda-ng,代码行数:101,代码来源:findwindow.cpp

示例13: FindSettings

void __cdecl FindSettings(LPVOID param)
{
	FindInfo* fi = (FindInfo*)param;
	HWND hwndParent = GetParent(fi->hwnd);

	ModuleSettingLL ModuleList, SettingList;
	ModSetLinkLinkItem *module, *setting;

	MCONTACT hContact;
	DBVARIANT dbv = { 0 };

	int foundCount = 0, replaceCount = 0, deleteCount = 0;

	DWORD numsearch = 0, numreplace = 0;
	int NULLContactDone = 0;

	if (!fi->search || !EnumModules(&ModuleList)) {
		fi_free(fi);
		return;
	}

	_T2A search(fi->search);
	_T2A replace(fi->replace);

	// skip modules and setting names on unicode search or replace
	if (IsRealUnicode(fi->search) || IsRealUnicode(fi->replace)) {
		fi->options &= ~(F_SETNAME | F_MODNAME);
		fi->options |= F_UNICODE;
	}

	if (!(fi->options & F_UNICODE) && (fi->options & F_SETVAL)) {
		char val[16];
		numsearch = strtoul(search, nullptr, 10);
		_ultoa(numsearch, val, 10);
		if (!mir_strcmp(search, val)) {
			fi->options |= F_NUMSRCH;
			// replace numeric values only entirely
			if (replace && (fi->options & F_ENTIRE)) {
				numreplace = strtoul(replace, nullptr, 10);
				_ultoa(numreplace, val, 10);
				if (!replace[0] || !mir_strcmp(replace, val))
					fi->options |= F_NUMREPL;
			}
		}
	}

	SendDlgItemMessage(hwndParent, IDC_SBAR, SB_SETTEXT, 0, (LPARAM)TranslateT("Searching..."));

	hContact = 0;

	while (GetWindowLongPtr(GetDlgItem(hwndParent, IDC_SEARCH), GWLP_USERDATA)) {

		if (!hContact) {
			if (NULLContactDone)
				break;
			else {
				NULLContactDone = 1;
				hContact = db_find_first();
			}
		}
		else hContact = db_find_next(hContact);

		for (module = ModuleList.first; module; module = module->next) {

			if (IsModuleEmpty(hContact, module->name))
				continue;

			if (fi->options & (F_SETVAL | F_SETNAME)) {

				if (!EnumSettings(hContact, module->name, &SettingList)) {
					fi_free(fi);
					FreeModuleSettingLL(&ModuleList);
					return;
				}

				for (setting = SettingList.first; setting; setting = setting->next) {

					dbv.type = 0;
					if (db_get_s(hContact, module->name, setting->name, &dbv, 0))
						continue;

					// check in settings value				
					if (fi->options & F_SETVAL) {

						wchar_t *value = nullptr;

						switch (dbv.type) {

						case DBVT_BYTE:
						case DBVT_WORD:
						case DBVT_DWORD:
							if ((fi->options & F_NUMSRCH) && numsearch == getNumericValue(&dbv)) {
								wchar_t *val = fi->search;
								int flag = F_SETVAL;

								if (fi->options & F_NUMREPL) {
									if (replace[0]) {
										db_unset(hContact, module->name, setting->name);
										flag |= F_DELETED;
										deleteCount++;
//.........这里部分代码省略.........
开发者ID:tweimer,项目名称:miranda-ng,代码行数:101,代码来源:findwindow.cpp

示例14: DlgProcOpts_Tab3

/*
 *	callback function for tab 3 options page
 */
INT_PTR CALLBACK DlgProcOpts_Tab3(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {

	switch ( msg ) {
	case WM_INITDIALOG:
	{
		//executed once during init of each tab, on each enter to miranda options

		mirfoxMiranda.getMirfoxData().setTab3OptionsState(MFENUM_OPTIONS_INIT);

		TranslateDialogDefault(hwndDlg);

		//protocol list initialization
		HWND hAccountsList = GetDlgItem(hwndDlg, IDC3_PROTOCOLS_LIST);

		ListView_SetExtendedListViewStyleEx(hAccountsList, LVS_EX_FULLROWSELECT|LVS_EX_CHECKBOXES, LVS_EX_FULLROWSELECT|LVS_EX_CHECKBOXES);

		LVCOLUMN lvCol = {0};
		lvCol.mask = LVCF_WIDTH|LVCF_TEXT;
		lvCol.pszText=TranslateT("Protocol");
		lvCol.cx = 260;	//column width
		ListView_InsertColumn(hAccountsList, 0, &lvCol);

		LVITEM lvItem = {0};
		lvItem.mask=LVIF_TEXT|LVIF_PARAM;
		lvItem.iItem=0;
		lvItem.iSubItem=0;

		//get accounts data from mirfoxData
		boost::ptr_list<MirandaAccount> * mirandaAccountsPtr = mirfoxMiranda.getMirfoxData().getMirandaAccounts();
		boost::ptr_list<MirandaAccount>::iterator mirandaAccountsIter;
		for (mirandaAccountsIter = mirandaAccountsPtr->begin(); mirandaAccountsIter != mirandaAccountsPtr->end(); mirandaAccountsIter++){

			lvItem.pszText = mirandaAccountsIter->tszAccountName;
			//http://www.experts-exchange.com/Programming/Languages/CPP/Q_20175412.html - must duplicate string
			lvItem.lParam = (LPARAM)_strdup(mirandaAccountsIter->szModuleName);
			ListView_InsertItem(hAccountsList,&lvItem);//winapi function

			MFENUM_MIRANDAACCOUNT_STATE accountState = mirandaAccountsIter->accountState;
			if (accountState == MFENUM_MIRANDAACCOUNT_STATE_ON){
				ListView_SetCheckState(hAccountsList, lvItem.iItem, 1 );
			} else {
				ListView_SetCheckState(hAccountsList, lvItem.iItem, 0 );
			}

			lvItem.iItem++;
		}
	    //protocol list initialization - end

		mirfoxMiranda.getMirfoxData().setTab3OptionsState(MFENUM_OPTIONS_WORK);
		return FALSE;

	}
	case WM_COMMAND:
	{
		if (mirfoxMiranda.getMirfoxData().getTab3OptionsState() != MFENUM_OPTIONS_WORK){
			break; //options not inited yet
		}

		break;
	}
	case WM_NOTIFY:
	{

		//executed on each change tab at options or after [OK]

		if (mirfoxMiranda.getMirfoxData().getTab3OptionsState() != MFENUM_OPTIONS_WORK){
			break; //options not inited yet
		}


		if (((NMHDR*)lParam)->idFrom == IDC3_PROTOCOLS_LIST) {
			if (((NMHDR*)lParam)->code== LVN_ITEMCHANGED) {
				NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
				if (/*IsWindowVisible(GetDlgItem(hwndDlg,IDC_PROTOCOLLIST)) && */ ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK)) {
					SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
				}
			}
		}

		if (((LPNMHDR)lParam)->idFrom == 0 &&
			((LPNMHDR)lParam)->code == PSN_APPLY
		){
			//SaveOptions from tab3 mirfoxData to miranda database
			HWND hList = GetDlgItem(hwndDlg, IDC3_PROTOCOLS_LIST);
			LVITEM lvItem = {0};
			lvItem.mask = LVIF_PARAM;
			for (int i=0; i<ListView_GetItemCount(hList); i++) {

				lvItem.iItem = i;
				lvItem.iSubItem = 0;
				ListView_GetItem(hList, &lvItem);

				char * accountId ((char *)lvItem.lParam);
				BYTE accountStateB = (BYTE)ListView_GetCheckState(hList, lvItem.iItem);

				MFENUM_MIRANDAACCOUNT_STATE accountState;
				if (accountStateB == 0){
//.........这里部分代码省略.........
开发者ID:0xmono,项目名称:miranda-ng,代码行数:101,代码来源:MirandaOptions.cpp

示例15: WhatsAppAccountProc

INT_PTR CALLBACK WhatsAppAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
	WhatsAppProto *proto;

	switch (message) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hwnd);

		proto = reinterpret_cast<WhatsAppProto*>(lparam);
		SetWindowLongPtr(hwnd,GWLP_USERDATA,lparam);
		SendDlgItemMessage(hwnd, IDC_REG_CODE_1, EM_LIMITTEXT, 3, 0);
		SendDlgItemMessage(hwnd, IDC_REG_CODE_2, EM_LIMITTEXT, 3, 0);
		CheckDlgButton(hwnd, IDC_SSL, db_get_b(NULL, proto->ModuleName(), WHATSAPP_KEY_SSL, 0));
		DBVARIANT dbv;

		if ( !db_get_s(0,proto->ModuleName(),WHATSAPP_KEY_CC,&dbv,DBVT_ASCIIZ))
		{
			SetDlgItemTextA(hwnd,IDC_CC,dbv.pszVal);
			db_free(&dbv);
		}

		if ( !db_get_s(0,proto->ModuleName(),WHATSAPP_KEY_LOGIN,&dbv,DBVT_ASCIIZ))
		{
			SetDlgItemTextA(hwnd,IDC_LOGIN,dbv.pszVal);
			db_free(&dbv);
		}

		if ( !db_get_s(0,proto->ModuleName(),WHATSAPP_KEY_NICK,&dbv,DBVT_ASCIIZ))
		{
			SetDlgItemTextA(hwnd,IDC_NICK,dbv.pszVal);
			db_free(&dbv);
		}

		if ( !db_get_s(0,proto->ModuleName(),WHATSAPP_KEY_PASS,&dbv,DBVT_ASCIIZ))
		{
			SetDlgItemTextA(hwnd,IDC_PW,dbv.pszVal);
			db_free(&dbv);
		}

		if (!proto->isOffline()) {
			SendMessage(GetDlgItem(hwnd, IDC_CC), EM_SETREADONLY, 1, 0);
			SendMessage(GetDlgItem(hwnd, IDC_LOGIN), EM_SETREADONLY, 1, 0);
			SendMessage(GetDlgItem(hwnd, IDC_NICK), EM_SETREADONLY, 1, 0);
			SendMessage(GetDlgItem(hwnd, IDC_PW), EM_SETREADONLY, 1, 0);
			EnableWindow(GetDlgItem(hwnd, IDC_SSL), FALSE);
		}

		return TRUE;

	case WM_COMMAND:
		if (LOWORD(wparam) == IDC_BUTTON_REQUEST_CODE || LOWORD(wparam) == IDC_BUTTON_REGISTER)
		{
			proto = reinterpret_cast<WhatsAppProto*>(GetWindowLongPtr(hwnd,GWLP_USERDATA));

			char cc[5];
			GetDlgItemTextA(hwnd, IDC_CC, cc, sizeof(cc));
			char number[128];
			GetDlgItemTextA(hwnd, IDC_LOGIN, number, sizeof(number));

			if (LOWORD(wparam) == IDC_BUTTON_REQUEST_CODE)
			{
				if (MessageBox(NULL, TranslateT("An SMS with registration-code will be sent to your mobile phone.\nNotice that you are not able to use the real WhatsApp and this plugin simultaneously!\nContinue?"),
					PRODUCT_NAME, MB_YESNO) == IDYES)
				{
					proto->Register(REG_STATE_REQ_CODE, string(cc), string(number), string());
				}
			}
			else if (LOWORD(wparam) == IDC_BUTTON_REGISTER)
			{
				char code[7];
				if (SendDlgItemMessage(hwnd, IDC_REG_CODE_1, WM_GETTEXTLENGTH, 0, 0) == 3 &&
					SendDlgItemMessage(hwnd, IDC_REG_CODE_2, WM_GETTEXTLENGTH, 0, 0) == 3)
				{
					GetDlgItemTextA(hwnd, IDC_REG_CODE_1, code, 4);
					GetDlgItemTextA(hwnd, IDC_REG_CODE_2, &(code[3]), 4);
				}
				else
				{
					MessageBox(NULL, TranslateT("Please correctly specify your registration code received by SMS"), 
						PRODUCT_NAME, MB_ICONEXCLAMATION);
					return TRUE;
				}
				string pw = proto->Register(REG_STATE_REG_CODE, string(cc), string(number), string(code));
				if (!pw.empty())
				{
					proto->setString(WHATSAPP_KEY_PASS, pw.c_str());
					MessageBox(NULL, TranslateT("Your password has been set automatically.\nIf you change your password manually you may lose it and need to request a new code!"), PRODUCT_NAME, MB_ICONWARNING);
				}
			}
		}

		if ( HIWORD( wparam ) == EN_CHANGE && reinterpret_cast<HWND>(lparam) == GetFocus())
		{
			switch(LOWORD(wparam))
			{
			case IDC_CC:
			case IDC_LOGIN:
			case IDC_NICK:
			case IDC_SSL:
			case IDC_PW:
//.........这里部分代码省略.........
开发者ID:Ganster41,项目名称:miranda-ng,代码行数:101,代码来源:dialogs.cpp


注:本文中的TranslateT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。