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


C++ CallProtoService函数代码示例

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


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

示例1: ChooseFilesThread

void __cdecl ChooseFilesThread(void* param)
{
	HWND hwndDlg = (HWND)param;
	FileDlgData *dat = (FileDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);

	TCHAR *buf = (TCHAR*)mir_alloc(sizeof(TCHAR) * 32767);
	if (buf == NULL) {
		PostMessage(hwndDlg, M_FILECHOOSEDONE, 0, NULL);
		return;
	}

	TCHAR filter[128];
	mir_tstrcpy(filter, TranslateT("All files"));
	mir_tstrcat(filter, _T(" (*)"));
	TCHAR *pfilter = filter + mir_tstrlen(filter) + 1;
	mir_tstrcpy(pfilter, _T("*"));
	pfilter = filter + mir_tstrlen(filter) + 1;
	pfilter[0] = '\0';

	OPENFILENAME ofn = { 0 };
	ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
	ofn.hwndOwner = hwndDlg;
	ofn.lpstrFilter = filter;
	ofn.lpstrFile = buf; *buf = 0;
	ofn.nMaxFile = 32767;
	ofn.Flags = OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_EXPLORER | OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
	
	char *szProto = GetContactProto(dat->hContact);
	if (!(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SINGLEFILEONLY))
		ofn.Flags |= OFN_ALLOWMULTISELECT;

	if (GetOpenFileName(&ofn))
		PostMessage(hwndDlg, M_FILECHOOSEDONE, 0, (LPARAM)buf);
	else {
		mir_free(buf);
		PostMessage(hwndDlg, M_FILECHOOSEDONE, 0, NULL);
	}
}
开发者ID:ybznek,项目名称:miranda-ng,代码行数:38,代码来源:filesenddlg.cpp

示例2: SSC_OnProtocolAck

int SSC_OnProtocolAck(WPARAM, LPARAM lParam)
{
	if (g_bMirandaIsShutdown)
		return 0;

	ACKDATA* pAckData = reinterpret_cast<ACKDATA*>(lParam);
	if (pAckData->type != ACKTYPE_STATUS || pAckData->result != ACKRESULT_SUCCESS || !pAckData->szModule)
		return 0;

	if (!g_Options.IsProtocolExcluded(pAckData->szModule)) {
		int nStatus = CallProtoService(pAckData->szModule, PS_GETSTATUS, 0, 0);
		for (size_t i = 0; i < _countof(g_aStatusCode); ++i) {
			const CMirandaStatus2SkypeStatus& ms = g_aStatusCode[i];
			if (ms.m_nMirandaStatus == nStatus) {
				int nPrevStatus;
				if ((false == g_Options.IsProtocolStatusExcluded(pAckData->szModule, nStatus))
					&& ((false == g_Options.GetSyncStatusStateFlag())
						|| (false == g_Options.GetPreviousStatus(pAckData->szModule, nPrevStatus))
						|| (nPrevStatus != nStatus))) {
							{
								mir_cslock guard(g_csStatusInfo);
								g_CurrStatusInfo.StatusIndex(i);
								g_CurrStatusInfo.Module(pAckData->szModule);
							}
							if (0 == ::PostMessage(HWND_BROADCAST, g_MsgIDSkypeControlAPIDiscover, (WPARAM)g_wndMainWindow, 0)) {
								mir_cslock guard(g_csStatusInfo);
								g_CurrStatusInfo.StatusIndex(INVALID_INDEX);
								g_CurrStatusInfo.Module(NULL);
							}
							else g_Options.SetPreviousStatus(pAckData->szModule, nStatus);
				}
				break;
			}
		}
	}

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

示例3: Proto_GetAvatarMaxSize

void Proto_GetAvatarMaxSize(const char *proto, int *width, int *height)
{
	if (ProtoServiceExists(proto, PS_GETAVATARCAPS)) {
		POINT maxSize;
		CallProtoService(proto, PS_GETAVATARCAPS, AF_MAXSIZE, (LPARAM)&maxSize);
		*width = maxSize.y;
		*height = maxSize.x;
	}
	else {
		*width = 300;
		*height = 300;
	}

	if (*width < 0)
		*width = 0;
	else if (*width > 300)
		*width = 300;

	if (*height < 0)
		*height = 0;
	else if (*height > 300)
		*height = 300;
}
开发者ID:martok,项目名称:miranda-ng,代码行数:23,代码来源:utils.cpp

示例4: SetProtocolsOffline

void SetProtocolsOffline()
{
	if ( GetSettingBool("GlobalSettings", "SetProtocolsOffline", TRUE) ) {
		PROTOACCOUNT **accounts;
		int count;
		Proto_EnumAccounts(&count, &accounts);

		for (int i = 0; i < count; i++) {
			/*if (protos[i]->type != PROTOTYPE_PROTOCOL)
				continue;*/
			if (!accounts[i]->bIsEnabled)
				continue;

			if (accounts[i]->szModuleName == NULL || accounts[i]->szModuleName[0] == '\0')
				continue;

			CallProtoService(accounts[i]->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
		}

		// Give some time to make it really offline
		Sleep(2000);
	}
}
开发者ID:kxepal,项目名称:miranda-ng,代码行数:23,代码来源:rps.cpp

示例5: ChangeAllProtoStatuses

static int ChangeAllProtoStatuses(unsigned statusMode, TCHAR *msg)
{
	for (int i=0; i < protoCount; i++)
	{
		unsigned status = CallProtoService(proto[i]->szModuleName,PS_GETSTATUS,0,0);
		if (
			(g_wMask & OPT_ONLINEONLY) ? // check "Change only if current status is Online" option
			((status == ID_STATUS_ONLINE) || (status == ID_STATUS_FREECHAT)) // process only "online" and "free for chat"
			:
			((status > ID_STATUS_OFFLINE) && (status < ID_STATUS_IDLE) && (status != ID_STATUS_INVISIBLE))) // process all existing statuses except for "invisible" & "offline"
		{
			if (g_wMask & OPT_SETONLINEBACK){ // need to save old statuses & status messages
				oldStatus[i] = status;
				if (ProtoServiceExists(proto[i]->szModuleName, PS_GETMYAWAYMSG))
					oldStatusMsg[i] = (TCHAR*)ProtoCallService(proto[i]->szModuleName, PS_GETMYAWAYMSG, 0, SGMA_TCHAR);
				else
					oldStatusMsg[i] = GetDefStatusMsg(status, proto[i]->szModuleName);
			}
			SetStatus(proto[i]->szModuleName, statusMode, msg);
		}
	}
	return 0;
}
开发者ID:MrtsComputers,项目名称:miranda-ng,代码行数:23,代码来源:BossKey.cpp

示例6: SplitmsgModulesLoaded

static int SplitmsgModulesLoaded(WPARAM wParam, LPARAM lParam)
{
	CLISTMENUITEM mi;
	PROTOCOLDESCRIPTOR **protocol;
	int protoCount, i;

	ReloadGlobals();
	RegisterIcoLibIcons();
	RegisterFontServiceFonts();
	LoadGlobalIcons();
	LoadMsgLogIcons();
	LoadProtocolIcons();
	ZeroMemory(&mi, sizeof(mi));
	mi.cbSize = sizeof(mi);
	mi.position = -2000090000;
	mi.flags = 0;
	mi.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
	mi.pszName = Translate("&Message");
	mi.pszService = MS_MSG_SENDMESSAGE;
	CallService(MS_PROTO_ENUMPROTOCOLS, (WPARAM) & protoCount, (LPARAM) & protocol);
	for (i = 0; i < protoCount; i++) {
		if (protocol[i]->type != PROTOTYPE_PROTOCOL)
			continue;
		if (CallProtoService(protocol[i]->szName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) {
			mi.pszContactOwner = protocol[i]->szName;
			hMsgMenuItem = realloc(hMsgMenuItem, (hMsgMenuItemCount + 1) * sizeof(HANDLE));
			hMsgMenuItem[hMsgMenuItemCount++] = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi);
		}
	}
	HookEvent(ME_CLIST_DOUBLECLICKED, SendMessageCommand);
	HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileySettingsChanged);
	HookEvent(ME_IEVIEW_OPTIONSCHANGED, SmileySettingsChanged);
	HookEvent(ME_AV_MYAVATARCHANGED, MyAvatarChanged);
	HookEvent(ME_AV_AVATARCHANGED, AvatarChanged);
	RestoreUnreadMessageAlerts();
	return 0;
}
开发者ID:BackupTheBerlios,项目名称:mgoodies-svn,代码行数:37,代码来源:msgs.c

示例7: convertContact

static MCONTACT convertContact(MCONTACT hContact)
{
    // Check what protocol this contact belongs to
    char szProto[100];
    if (myGetS(hContact, "Protocol", "p", szProto))
        return INVALID_CONTACT_ID;

    // Protocol installed?
    if (!IsProtocolLoaded(szProto))
        return INVALID_CONTACT_ID;

    // Is contact in database?
    char* pszUniqueSetting = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);

    // Skip protocols with no unique id setting (some non IM protocols return NULL)
    MCONTACT hDst = INVALID_CONTACT_ID;
    if (pszUniqueSetting && (INT_PTR)pszUniqueSetting != CALLSERVICE_NOTFOUND) {
        DBVARIANT dbv;
        if (!myGet(hContact, szProto, pszUniqueSetting, &dbv)) {
            switch (dbv.type) {
            case DBVT_DWORD:
                hDst = HContactFromNumericID(szProto, pszUniqueSetting, dbv.dVal);
                break;

            case DBVT_ASCIIZ:
                hDst = HContactFromID(szProto, pszUniqueSetting, _A2T(dbv.pszVal));
                break;

            case DBVT_WCHAR:
                hDst = HContactFromID(szProto, pszUniqueSetting, dbv.ptszVal);
                break;
            }
            srcDb->FreeVariant(&dbv);
        }
    }
    return hDst;
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:37,代码来源:import.cpp

示例8: Proto_GetAccount

void CSAMWindow::setCombo()
{
	PROTOACCOUNT *pdescr = Proto_GetAccount(m_parent->m_protoName);
	if (pdescr == nullptr)
		return;

	const char *szUniqueID = Proto_GetUniqueId(pdescr->szModuleName);
	if (szUniqueID == nullptr)
		return;

	DBVARIANT dbv;
	if (db_get(NULL, pdescr->szModuleName, szUniqueID, &dbv))
		return;
	db_free(&dbv);

	WPARAM iStatus;
	wchar_t tszName[100];
	CUSTOM_STATUS cs = { sizeof(cs) };
	cs.flags = CSSF_MASK_NAME | CSSF_DEFAULT_NAME | CSSF_UNICODE;
	cs.ptszName = tszName;
	cs.wParam = &iStatus;

	SendMessage(m_hCombo, CBEM_SETIMAGELIST, 0, (LPARAM)m_parent->m_icons);
	for (int i = 1; i <= m_parent->m_statusCount; i++) {
		iStatus = i;
		if (CallProtoService(pdescr->szModuleName, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) != 0)
			continue;

		COMBOBOXEXITEM cbi = { 0 };
		cbi.mask = CBEIF_TEXT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE;
		cbi.iItem = -1;
		cbi.iImage = cbi.iSelectedImage = i - 1;
		cbi.pszText = TranslateW(tszName);
		SendMessage(m_hCombo, CBEM_INSERTITEM, 0, (LPARAM)&cbi);
	}
	SendMessage(m_hCombo, CB_SETCURSEL, 0, 0); // first 0 sets selection to top
}
开发者ID:tweimer,项目名称:miranda-ng,代码行数:37,代码来源:cslist.cpp

示例9: OnProtoAck

int CDropbox::OnProtoAck(WPARAM, LPARAM lParam)
{
	ACKDATA *ack = (ACKDATA*)lParam;

	if (!mir_strcmp(ack->szModule, MODULE))
		return 0; // don't rebroadcast our own acks

	if (ack->type == ACKTYPE_STATUS) {
		WORD status = ack->lParam;
		bool canSendOffline = (CallProtoService(ack->szModule, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDOFFLINE) > 0;

		MessageWindowInputData msgwi = { sizeof(msgwi) };
		msgwi.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;

		for (MCONTACT hContact = db_find_first(ack->szModule); hContact; hContact = db_find_next(hContact, ack->szModule)) {
			msgwi.hContact = hContact;

			MessageWindowData msgw;
			msgw.cbSize = sizeof(msgw);

			if (!CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgwi, (LPARAM)&msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS) {
				BBButton bbd = { sizeof(bbd) };
				bbd.pszModuleName = MODULE;
				bbd.dwButtonID = BBB_ID_FILE_SEND;
				bbd.bbbFlags = BBSF_RELEASED;

				if (status == ID_STATUS_OFFLINE && !canSendOffline)
					bbd.bbbFlags = BBSF_DISABLED;

				CallService(MS_BB_SETBUTTONSTATE, hContact, (LPARAM)&bbd);
			}
		}
	}

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

示例10: CreateImageList

void CreateImageList(HWND hWnd)
{
	// Create and populate image list
	HIMAGELIST hImList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),	ILC_MASK | ILC_COLOR32, nProtocol, 0);

	for(NudgeElementList *n = NudgeList;n != NULL; n = n->next)
	{
		INT_PTR res = CallProtoService(n->item.ProtocolName, PS_LOADICON,PLI_PROTOCOL | PLIF_SMALL | PLIF_ICOLIB, 0);
		if(res==CALLSERVICE_NOTFOUND)
		{
			res = CallService(MS_SKIN2_GETICONBYHANDLE,0,(LPARAM)n->item.hIcoLibItem);
		}

		HICON hIcon = (HICON) res;
		ImageList_AddIcon(hImList, hIcon);
	}
	//ADD default Icon for nudge
	HICON hIcon = (HICON) LoadImage(hInst, MAKEINTRESOURCE(IDI_NUDGE), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
	ImageList_AddIcon(hImList, hIcon);
	DestroyIcon(hIcon);

	HWND hLstView = GetDlgItem(hWnd, IDC_PROTOLIST);
	TreeView_SetImageList(hLstView, hImList, TVSIL_NORMAL);
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:24,代码来源:options.cpp

示例11: getActiveContact

int CContactCache::getMaxMessageLength()
{
	MCONTACT hContact = getActiveContact();
	LPCSTR szProto = getActiveProto();
	if (szProto) {
		m_nMax = CallProtoService(szProto, PS_GETCAPS, PFLAG_MAXLENOFMESSAGE, hContact);
		if (m_nMax) {
			if (M.GetByte("autosplit", 0)) {
				if (m_hwnd)
					::SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_EXLIMITTEXT, 0, 20000);
			}
			else {
				if (m_hwnd)
					::SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_EXLIMITTEXT, 0, (LPARAM)m_nMax);
			}
		}
		else {
			if (m_hwnd)
				::SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_EXLIMITTEXT, 0, 20000);
			m_nMax = 20000;
		}
	}
	return m_nMax;
}
开发者ID:kmdtukl,项目名称:miranda-ng,代码行数:24,代码来源:contactcache.cpp

示例12: GetContactProto

int TSendContactsData::SendContacts(HWND hwndDlg)
{
	char *szProto = GetContactProto(hContact);
	int nMaxContacts = CallProtoService(szProto, PS_GETCAPS, PFLAG_MAXCONTACTSPERPACKET, (LPARAM)hContact);

	if (!nMaxContacts) {
		ShowErrorDlg(hwndDlg, "The selected contact does not support receiving contacts.", FALSE);
		return FALSE;
	}

	// hook event - we want to receive protocol acknowledgements
	HookProtoAck(hwndDlg);

	// send in packets, each of nMaxContacts contacts
	for (int j = 0; j < nContacts / nMaxContacts; j++)
		if (!SendContactsPacket(hwndDlg, aContacts + j*nMaxContacts, nMaxContacts))
			return FALSE;

	if (nContacts%nMaxContacts != 0)
		if (!SendContactsPacket(hwndDlg, aContacts + nContacts / nMaxContacts*nMaxContacts, nContacts%nMaxContacts))
			return FALSE;

	return TRUE;
}
开发者ID:MrtsComputers,项目名称:miranda-ng,代码行数:24,代码来源:send.cpp

示例13: DlgProcMirOTROptsProto

static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	HWND lv = GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS);
	int sel;

	switch (msg) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hwndDlg);
		{
			HWND cmb = GetDlgItem(hwndDlg, IDC_CMB_PROTO_POLICY);
			SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_DEFAULT));
			SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_ALWAYS));
			SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_OPP));
			SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_MANUAL));
			SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_NEVER));
			SendDlgItemMessage(hwndDlg, IDC_CMB_PROTO_POLICY, CB_SETCURSEL, (LPARAM)-1, 0);
			EnableWindow(GetDlgItem(hwndDlg, IDC_CMB_PROTO_POLICY), FALSE);
			EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_PROTO_NEWKEY), FALSE);
			EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_PROTO_FORGET), FALSE);
		}

		SendMessage(lv, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);// | LVS_EX_CHECKBOXES);
		{
			// add list columns
			LVCOLUMN lvc;
			// Initialize the LVCOLUMN structure.
			// The mask specifies that the format, width, text, and
			// subitem members of the structure are valid.
			lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
			lvc.fmt = LVCFMT_LEFT;

			lvc.iSubItem = 0;
			lvc.pszText = TranslateT(LANG_PROTO);
			lvc.cx = 85;     // width of column in pixels
			ListView_InsertColumn(lv, 0, &lvc);

			lvc.iSubItem = 1;
			lvc.pszText = TranslateT(LANG_POLICY);
			lvc.cx = 80;     // width of column in pixels
			ListView_InsertColumn(lv, 1, &lvc);

			lvc.iSubItem = 2;
			lvc.pszText = TranslateT(LANG_FINGERPRINT);
			lvc.cx = 275;     // width of column in pixels
			ListView_InsertColumn(lv, 2, &lvc);
		}
		PostMessage(hwndDlg, WMU_REFRESHPROTOLIST, 0, 0);
		return TRUE;

	case WMU_REFRESHPROTOLIST:
		ListView_DeleteAllItems(lv);
		{
			LV_ITEM item = { 0 };

			int num_protocols;
			PROTOACCOUNT **pppDesc;
			Proto_EnumAccounts(&num_protocols, &pppDesc);
			for (int i = 0; i < num_protocols; i++) {
				if (!mir_strcmp(pppDesc[i]->szModuleName, META_PROTO))
					continue;
				if ((CallProtoService(pppDesc[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) == 0)
					continue;

				item.mask = LVIF_TEXT | LVIF_PARAM;
				item.pszText = pppDesc[i]->tszAccountName;
				item.lParam = (LPARAM)pppDesc[i]->szModuleName;
				int ilvItem = ListView_InsertItem(lv, &item);

				ListView_SetItemText(lv, ilvItem, 1, (TCHAR*)policy_to_string(db_get_dw(0, MODULENAME"_ProtoPol", pppDesc[i]->szModuleName, CONTACT_DEFAULT_POLICY)));

				char fprint[45];
				if (otrl_privkey_fingerprint(otr_user_state, fprint, pppDesc[i]->szModuleName, pppDesc[i]->szModuleName)) {
					TCHAR *temp = mir_a2t(fprint);
					ListView_SetItemText(lv, ilvItem, 2, temp);
					mir_free(temp);
				}
			}
		}
		return TRUE;

	case WM_COMMAND:
		switch (HIWORD(wParam)) {
		case BN_CLICKED:
			switch (LOWORD(wParam)) {
			case IDC_BTN_PROTO_NEWKEY:
				sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS));
				if (sel != -1) {
					PROTOREGENKEYOPTIONS *opts = new PROTOREGENKEYOPTIONS();
					opts->refresh = hwndDlg;
					ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 0, opts->proto, _countof(opts->proto));
					CloseHandle((HANDLE)_beginthreadex(0, 0, regen_key_thread, opts, 0, 0));
				}
				break;
			
			case IDC_BTN_PROTO_FORGET:
				sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS));
				if (sel != -1) {
					TCHAR buff_proto[128];
					ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 0, buff_proto, _countof(buff_proto));
					TCHAR buff[512];
//.........这里部分代码省略.........
开发者ID:Seldom,项目名称:miranda-ng,代码行数:101,代码来源:options.cpp

示例14: addEvent

INT addEvent(WPARAM hContact, LPARAM hDBEvent)
{
	BOOL fEnabled = db_get_b(NULL, protocolname, KEY_ENABLED, 1);
	if (!fEnabled || !hContact || !hDBEvent)
		return FALSE;	/// unspecifyed error

	char* pszProto = GetContactProto(hContact);
	int status = CallProtoService(pszProto, PS_GETSTATUS, 0, 0);
	if (status == ID_STATUS_ONLINE || status == ID_STATUS_FREECHAT || status == ID_STATUS_INVISIBLE)
		return FALSE;

	DBEVENTINFO dbei = {sizeof(dbei)};
	db_event_get(hDBEvent, &dbei); /// detect size of msg

	if ((dbei.eventType != EVENTTYPE_MESSAGE) || (dbei.flags == DBEF_READ))
		return FALSE; /// we need EVENTTYPE_MESSAGE event..
	else
	{	/// needed event has occured..
		DBVARIANT dbv;

		if (!dbei.cbBlob)	/// invalid size
			return FALSE;

		if (db_get_ts(hContact,"Protocol","p",&dbv))
			// Contact with no protocol ?!!
			return FALSE;
		else
			db_free(&dbv);

		if(db_get_b(hContact, "CList", "NotOnList", 0))
			return FALSE;

		if(db_get_b(hContact, protocolname, "TurnedOn", 0))
			return FALSE;

		if (!( dbei.flags & DBEF_SENT))
		{
			int timeBetween=time(NULL)-db_get_dw(hContact,protocolname,"LastReplyTS",0);
			if (timeBetween>interval || db_get_w(hContact,protocolname,"LastStatus",0)!=status)
			{
				char szStatus[6]={0};
				int msgLen=1;
				int isQun=db_get_b(hContact,pszProto,"IsQun",0);
				if (isQun)
					return FALSE;

				mir_snprintf(szStatus,_countof(szStatus),"%d",status);
				if (!db_get_ts(NULL,protocolname,szStatus,&dbv))
				{
					if (*dbv.ptszVal)
					{
						DBVARIANT dbvHead={0}, dbvNick={0};
						CMString ptszTemp;
						TCHAR *ptszTemp2;

						db_get_ts(hContact,pszProto,"Nick",&dbvNick);
						if (mir_tstrcmp(dbvNick.ptszVal, NULL) == 0)
						{
							db_free(&dbvNick);
							return FALSE;
						}

						msgLen += (int)mir_tstrlen(dbv.ptszVal);
						if (!db_get_ts(NULL,protocolname,KEY_HEADING,&dbvHead))
						{
							ptszTemp = dbvHead.ptszVal;
							ptszTemp.Replace(_T("%user%"), dbvNick.ptszVal);
							msgLen += (int)(mir_tstrlen(ptszTemp));
						}
						ptszTemp2 = (TCHAR*)mir_alloc(sizeof(TCHAR) * (msgLen+5));
						mir_sntprintf(ptszTemp2, msgLen+5, _T("%s\r\n\r\n%s"), ptszTemp.c_str(), dbv.ptszVal);
						if (ServiceExists(MS_VARS_FORMATSTRING))
						{
							FORMATINFO fi = { 0 };
							fi.cbSize = sizeof(fi);
							fi.flags = FIF_TCHAR;
							fi.tszFormat = ptszTemp2;
							ptszTemp = (TCHAR*)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
						}
						else ptszTemp = Utils_ReplaceVarsT(ptszTemp2);
						
						T2Utf pszUtf(ptszTemp);
						CallContactService(hContact, PSS_MESSAGE, 0, pszUtf);

						dbei.cbSize = sizeof(dbei);
						dbei.eventType = EVENTTYPE_MESSAGE;
						dbei.flags = DBEF_UTF | DBEF_SENT; //DBEF_READ;
						dbei.szModule = pszProto;
						dbei.timestamp = time(NULL);
						dbei.cbBlob = (int)mir_strlen(pszUtf) + 1;
						dbei.pBlob = (PBYTE)pszUtf;
						db_event_add(hContact, &dbei);

						mir_free(ptszTemp2);
						if (dbvNick.ptszVal)
							db_free(&dbvNick);
						if (dbvHead.ptszVal)
							db_free(&dbvHead);
					}
					db_free(&dbv);
//.........这里部分代码省略.........
开发者ID:kmdtukl,项目名称:miranda-ng,代码行数:101,代码来源:Main.cpp

示例15: DlgProcGenOpts

INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_USER+1:
		{
			HANDLE hContact = (HANDLE) wParam;
			DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *) lParam;
			if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL && lstrcmpiA(ws->szModule, "CList") == 0 && lstrcmpiA(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg)) {
				CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0);
		  }
		  break;
	  }
  case WM_DESTROY:
		UnhookEvent((HANDLE) GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
		break;
	
	case WM_INITDIALOG:
		opt_gen_opts_changed = 0;
		TranslateDialogDefault(hwndDlg);
		SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED, hwndDlg, WM_USER + 1));
		CheckDlgButton(hwndDlg, IDC_ONTOP, cfg::getByte("CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
		CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, cfg::getByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
		CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, cfg::getByte("CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
		CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, cfg::getByte("CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED);
		CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, cfg::getByte("CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
		{
			DWORD caps = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS1, 0);
			if (!(caps & CLUIF_HIDEEMPTYGROUPS))
				ShowWindow(GetDlgItem(hwndDlg, IDC_HIDEEMPTYGROUPS), SW_HIDE);
			if (!(caps & CLUIF_DISABLEGROUPS))
				ShowWindow(GetDlgItem(hwndDlg, IDC_DISABLEGROUPS), SW_HIDE);
			if (caps & CLUIF_HASONTOPOPTION)
				ShowWindow(GetDlgItem(hwndDlg, IDC_ONTOP), SW_HIDE);
			if (caps & CLUIF_HASAUTOHIDEOPTION) {
			}
		}

		CheckDlgButton(hwndDlg, IDC_SHOWBUTTONBAR, cfg::dat.dwFlags & CLUI_FRAME_SHOWTOPBUTTONS);
		CheckDlgButton(hwndDlg, IDC_SHOWBOTTOMBUTTONS, cfg::dat.dwFlags & CLUI_FRAME_SHOWBOTTOMBUTTONS);
		CheckDlgButton(hwndDlg, IDC_CLISTSUNKEN, cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN);
		CheckDlgButton(hwndDlg, IDC_EVENTAREAAUTOHIDE, cfg::dat.dwFlags & CLUI_FRAME_AUTOHIDENOTIFY);
		CheckDlgButton(hwndDlg, IDC_EVENTAREASUNKEN, (cfg::dat.dwFlags & CLUI_FRAME_EVENTAREASUNKEN) ? BST_CHECKED : BST_UNCHECKED);

		CheckDlgButton(hwndDlg, IDC_ONECLK, cfg::getByte("CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
		CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, cfg::getByte("CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
		CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, !cfg::getByte("CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
		CheckDlgButton(hwndDlg, IDC_DONTCYCLE, cfg::getByte("CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
		CheckDlgButton(hwndDlg, IDC_CYCLE, cfg::getByte("CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
		CheckDlgButton(hwndDlg, IDC_MULTITRAY, cfg::getByte("CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
		CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, cfg::getByte("CList", "DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
		CheckDlgButton(hwndDlg, IDC_ICONBLINK, cfg::getByte("CList", "NoIconBlink", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
		if (IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE)) {
			Utils::enableDlgControl(hwndDlg, IDC_CYCLETIMESPIN, FALSE);
			Utils::enableDlgControl(hwndDlg, IDC_CYCLETIME, FALSE);
			Utils::enableDlgControl(hwndDlg, IDC_ALWAYSMULTI, FALSE);
		}
		if (IsDlgButtonChecked(hwndDlg, IDC_CYCLE)) {
			Utils::enableDlgControl(hwndDlg, IDC_PRIMARYSTATUS, FALSE);
			Utils::enableDlgControl(hwndDlg, IDC_ALWAYSMULTI, FALSE);
		}
		if (IsDlgButtonChecked(hwndDlg, IDC_MULTITRAY)) {
			Utils::enableDlgControl(hwndDlg, IDC_CYCLETIMESPIN, FALSE);
			Utils::enableDlgControl(hwndDlg, IDC_CYCLETIME, FALSE);
			Utils::enableDlgControl(hwndDlg, IDC_PRIMARYSTATUS, FALSE);
		}
		SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETRANGE, 0, MAKELONG(120, 1));
		SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0, MAKELONG(cfg::getWord("CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0)); {
			int i, count, item;
			PROTOACCOUNT **accs;
			DBVARIANT dbv = {
				DBVT_DELETED
			};
			DBGetContactSetting(NULL, "CList", "PrimaryStatus", &dbv);
			ProtoEnumAccounts( &count, &accs );
			item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM) TranslateT("Global"));
			SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM) 0);
			for (i = 0; i < count; i++) {
				if ( !IsAccountEnabled(accs[i]) || CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
					continue;
				
				item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM) accs[i]->tszAccountName);
				SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)accs[i] );
				if (dbv.type == DBVT_ASCIIZ && !lstrcmpA(dbv.pszVal, accs[i]->szModuleName ))
					SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, item, 0);
			}
		}
		if (-1 == (int) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0))
			SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, 0, 0);
		SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETBUDDY, (WPARAM) GetDlgItem(hwndDlg, IDC_BLINKTIME), 0);       // set buddy            
		SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE, 0, MAKELONG(0x3FFF, 250));
		SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(cfg::getWord("CList", "IconFlashTime", 550), 0));
		CheckDlgButton(hwndDlg, IDC_NOTRAYINFOTIPS, cfg::dat.bNoTrayTips ? 1 : 0);
		CheckDlgButton(hwndDlg, IDC_APPLYLASTVIEWMODE, cfg::getByte("CList", "AutoApplyLastViewMode", 0) ? 1 : 0);
		return TRUE;

	case WM_COMMAND:
		if (LOWORD(wParam) == IDC_DONTCYCLE || LOWORD(wParam) == IDC_CYCLE || LOWORD(wParam) == IDC_MULTITRAY) {
			Utils::enableDlgControl(hwndDlg, IDC_PRIMARYSTATUS, IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE));
			Utils::enableDlgControl(hwndDlg, IDC_CYCLETIME, IsDlgButtonChecked(hwndDlg, IDC_CYCLE));
			Utils::enableDlgControl(hwndDlg, IDC_CYCLETIMESPIN, IsDlgButtonChecked(hwndDlg, IDC_CYCLE));
//.........这里部分代码省略.........
开发者ID:raoergsls,项目名称:miranda,代码行数:101,代码来源:clistopts.cpp


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