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


C++ DBFreeVariant函数代码示例

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


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

示例1: MSN_FreeVariant

void MSN_FreeVariant(DBVARIANT* dbv)
{
	DBFreeVariant(dbv);
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:4,代码来源:msn_std.cpp

示例2: JabberIqResultSetSearch

void JabberIqResultSetSearch(XmlNode *iqNode, void *userdata)
{
	XmlNode *queryNode, *itemNode, *n;
	char *type, *jid, *str;
	int id, i, found;
	JABBER_SEARCH_RESULT jsr;
	DBVARIANT dbv;

	found = 0;
//	JabberLog("<iq/> iqIdGetSearch");
	if ((type=JabberXmlGetAttrValue(iqNode, "type")) == NULL) return;
	if ((str=JabberXmlGetAttrValue(iqNode, "id")) == NULL) return;
	id = atoi(str+strlen(JABBER_IQID));

	if (!strcmp(type, "result")) {
		if ((queryNode=JabberXmlGetChild(iqNode, "query")) == NULL) return;
		if (!DBGetContactSetting(NULL, jabberProtoName, "LoginServer", &dbv)) {
			jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
			for (i=0; i<queryNode->numChild; i++) {
				itemNode = queryNode->child[i];
				if (!strcmp(itemNode->name, "item")) {
					if ((jid=JabberXmlGetAttrValue(itemNode, "jid")) != NULL) {
						_snprintf(jsr.jid, sizeof(jsr.jid), "%[email protected]%s", jid, dbv.pszVal);
						jsr.jid[sizeof(jsr.jid)-1] = '\0';
						if ((n=JabberXmlGetChild(itemNode, "nick"))!=NULL && n->text!=NULL)
							jsr.hdr.nick = JabberTextDecode(n->text);
						else
							jsr.hdr.nick = mir_strdup("");
						if ((n=JabberXmlGetChild(itemNode, "first"))!=NULL && n->text!=NULL)
							jsr.hdr.firstName = JabberTextDecode(n->text);
						else
							jsr.hdr.firstName = mir_strdup("");
						if ((n=JabberXmlGetChild(itemNode, "last"))!=NULL && n->text!=NULL)
							jsr.hdr.lastName = JabberTextDecode(n->text);
						else
							jsr.hdr.lastName = mir_strdup("");
						if ((n=JabberXmlGetChild(itemNode, "email"))!=NULL && n->text!=NULL)
							jsr.hdr.email = JabberTextDecode(n->text);
						else
							jsr.hdr.email = mir_strdup("");
						ProtoBroadcastAck(jabberProtoName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) id, (LPARAM) &jsr);
						found = 1;
						mir_free(jsr.hdr.nick);
						mir_free(jsr.hdr.firstName);
						mir_free(jsr.hdr.lastName);
						mir_free(jsr.hdr.email);
					}
				}
			}
			if (searchJID!=NULL) {
				if (!found) {
					_snprintf(jsr.jid, sizeof(jsr.jid), "%[email protected]%s", searchJID, dbv.pszVal);
					jsr.jid[sizeof(jsr.jid)-1] = '\0';
					jsr.hdr.nick = mir_strdup("");
					jsr.hdr.firstName = mir_strdup("");
					jsr.hdr.lastName = mir_strdup("");
					jsr.hdr.email = mir_strdup("");
					ProtoBroadcastAck(jabberProtoName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) id, (LPARAM) &jsr);
					mir_free(jsr.hdr.nick);
					mir_free(jsr.hdr.firstName);
					mir_free(jsr.hdr.lastName);
					mir_free(jsr.hdr.email);
				}
				mir_free(searchJID);
				searchJID = NULL;
			}
			DBFreeVariant(&dbv);
		}
		ProtoBroadcastAck(jabberProtoName, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE) id, 0);
	}
	else if (!strcmp(type, "error")) {
		// ProtoBroadcastAck(jabberProtoName, NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE) id, 0);
		// There is no ACKRESULT_FAILED for ACKTYPE_SEARCH :) look at findadd.c
		// So we will just send a SUCCESS
		ProtoBroadcastAck(jabberProtoName, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE) id, 0);
	}
}
开发者ID:BackupTheBerlios,项目名称:mtlen-svn,代码行数:77,代码来源:jabber_iqid.c

示例3: GetWindowTitle

static TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto)
{
	DBVARIANT dbv;
	int isTemplate;
	int len, contactNameLen = 0, statusLen = 0, statusMsgLen = 0, protocolLen = 0;
	TCHAR *p, *tmplt, *szContactName = NULL, *szStatus = NULL, *szStatusMsg = NULL, *szProtocol = NULL, *title;
	TCHAR *pszNewTitleEnd = _tcsdup(TranslateT("Message Session"));
	isTemplate = 0;
	if (hContact && szProto) {
		szContactName = GetNickname(hContact, szProto);
		contactNameLen = lstrlen(szContactName);
		szStatus = strToWcs((char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0), -1, CP_ACP);
		statusLen = lstrlen(szStatus);
		if (!DBGetContactSetting(hContact, "CList", "StatusMsg",&dbv)) {
			if (strlen(dbv.pszVal) > 0) {
				int i, j;
       			szStatusMsg = strToWcs(dbv.pszVal, -1, CP_ACP);
				statusMsgLen = lstrlen(szStatusMsg);
				for (i = j = 0; i < statusMsgLen; i++) {
					if (szStatusMsg[i] == '\r') {
						continue;
					} else if (szStatusMsg[i] == '\n') {
						szStatusMsg[j++] = ' ';
					} else {
						szStatusMsg[j++] = szStatusMsg[i];
					}
				}
				szStatusMsg[j] = '\0';
				statusMsgLen = j;
			}
       		DBFreeVariant(&dbv);
		}

		if (!DBGetContactSetting(NULL, SRMMMOD, SRMSGSET_WINDOWTITLE, &dbv)) {
			isTemplate = 1;
			tmplt = strToWcs(dbv.pszVal, -1, CP_ACP);
			DBFreeVariant(&dbv);
		} else {
			int statusIcon = DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON);
			if (statusIcon) {
				tmplt = _T("%name% - ");
			} else {
				tmplt = _T("%name% (%status%) : ");
			}
		}
	} else {
		tmplt = _T("");
	}
	for (len = 0, p = tmplt; *p; p++) {
		if (*p == '%') {
			if (!_tcsncmp(p, _T("%name%"), 6)) {
				len += contactNameLen;
				p += 5;
				continue;
			} else if (!_tcsncmp(p, _T("%status%"), 8)) {
				len += statusLen;
				p += 7;
				continue;
			} else if (!_tcsncmp(p, _T("%statusmsg%"), 11)) {
				len += statusMsgLen;
				p += 10;
				continue;
			}
		}
		len++;
	}
	if (!isTemplate) {
		len += lstrlen(pszNewTitleEnd);
	}
	title = (TCHAR *)malloc(sizeof(TCHAR) * (len + 1));
	for (len = 0, p = tmplt; *p; p++) {
		if (*p == '%') {
			if (!_tcsncmp(p, _T("%name%"), 6)) {
				memcpy(title+len, szContactName, sizeof(TCHAR) * contactNameLen);
				len += contactNameLen;
				p += 5;
				continue;
			} else if (!_tcsncmp(p, _T("%status%"), 8)) {
				memcpy(title+len, szStatus, sizeof(TCHAR) * statusLen);
				len += statusLen;
				p += 7;
				continue;
			} else if (!_tcsncmp(p, _T("%statusmsg%"), 11)) {
				memcpy(title+len, szStatusMsg, sizeof(TCHAR) * statusMsgLen);
				len += statusMsgLen;
				p += 10;
				continue;
			}
		}
		title[len++] = *p;
	}
	if (!isTemplate) {
		memcpy(title+len, pszNewTitleEnd, sizeof(TCHAR) * lstrlen(pszNewTitleEnd));
		len += lstrlen(pszNewTitleEnd);
	}
	title[len] = '\0';
	if (isTemplate) {
		free(tmplt);
	}
	free(szContactName);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:mgoodies-svn,代码行数:101,代码来源:msgwindow.c

示例4: TrayIconUpdateBase

void TrayIconUpdateBase(const char *szChangedProto)
{
	int i,count,netProtoCount,changed = -1;
	PROTOACCOUNT **accs;
	int averageMode = 0;
	HWND hwnd = pcli->hwndContactList;

	if (pcli->cycleTimerId)
		KillTimer(NULL, pcli->cycleTimerId); pcli->cycleTimerId = 0;

	ProtoEnumAccounts( &count, &accs );
	for (i = 0,netProtoCount = 0; i < count; i++) {
		if ( !pcli->pfnGetProtocolVisibility( accs[i]->szModuleName ))
			continue;
		netProtoCount++;
		if (!lstrcmpA(szChangedProto, accs[i]->szModuleName ))
			pcli->cycleStep = i;
		if (averageMode == 0)
			averageMode = CallProtoService( accs[i]->szModuleName, PS_GETSTATUS, 0, 0);
		else if (averageMode != CallProtoService( accs[i]->szModuleName, PS_GETSTATUS, 0, 0)) {
			averageMode = -1; break;
		}
	}
	if (netProtoCount > 1) {
		if (averageMode > 0) {
			if (cfg::getByte("CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) {
				if (cfg::getByte("CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)) {
					HICON hIcon = 0;
					int iIcon = IconFromStatusMode(szChangedProto, averageMode, 0, &hIcon);
					if(hIcon)
						changed = pcli->pfnTrayIconSetBaseInfo(CopyIcon(hIcon), szChangedProto);
					else
						changed = pcli->pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL), szChangedProto);
				}
				else if (pcli->trayIcon && pcli->trayIcon[0].szProto != NULL) {
					pcli->pfnTrayIconDestroy(hwnd);
					pcli->pfnTrayIconInit(hwnd);
				}
				else {
					HICON hIcon = 0;
					int iIcon = IconFromStatusMode(NULL, averageMode, 0, &hIcon);

					if(hIcon)
						changed = pcli->pfnTrayIconSetBaseInfo(CopyIcon(hIcon), NULL);
					else
						changed = pcli->pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL), NULL);
				}
			} else {
				HICON hIcon = 0;
				int iIcon = IconFromStatusMode(NULL, averageMode, 0, &hIcon);

				if(hIcon)
					changed = pcli->pfnTrayIconSetBaseInfo(CopyIcon(hIcon), NULL);
				else
					changed = pcli->pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL), NULL);
			}
		} else {
			switch (cfg::getByte("CList", "TrayIcon", SETTING_TRAYICON_DEFAULT)) {
			case SETTING_TRAYICON_SINGLE:
				{
					DBVARIANT dbv = {DBVT_DELETED};
					int iIcon = 0;
					HICON hIcon = 0;
					char *szProto;
					if (cfg::getString(NULL, "CList", "PrimaryStatus", &dbv))
						szProto = NULL;
					else
						szProto = dbv.pszVal;
					iIcon = IconFromStatusMode(szProto, szProto ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0), 0, &hIcon);
					if(hIcon)
						changed = pcli->pfnTrayIconSetBaseInfo(CopyIcon(hIcon), NULL);
					else
						changed = pcli->pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL), NULL);
					DBFreeVariant(&dbv);
					break;
				}
			case SETTING_TRAYICON_CYCLE:
				{
					HICON hIcon = 0;
					int iIcon = IconFromStatusMode(szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0), 0, &hIcon);

					pcli->cycleTimerId = SetTimer(NULL, 0, cfg::getWord("CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, pcli->pfnTrayCycleTimerProc);
					if(hIcon)
						changed = pcli->pfnTrayIconSetBaseInfo(CopyIcon(hIcon), NULL);
					else
						changed = pcli->pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL), NULL);
					break;
				}
			case SETTING_TRAYICON_MULTI:
				if ( !pcli->trayIcon )
					pcli->pfnTrayIconRemove(NULL, NULL);
				else if (cfg::getByte("CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)) {
					HICON hIcon = 0;
					int iIcon = IconFromStatusMode(szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0), 0, &hIcon);

					if(hIcon)
						changed = pcli->pfnTrayIconSetBaseInfo(CopyIcon(hIcon), szChangedProto);
					else
						changed = pcli->pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL), szChangedProto);
				}
//.........这里部分代码省略.........
开发者ID:raoergsls,项目名称:miranda,代码行数:101,代码来源:clisttray.cpp

示例5: TrackChange


//.........这里部分代码省略.........
			}
		}
		else if (dbv.type != cws_new->value.type)
		{
#ifdef UNICODE
			if ( (cws_new->value.type == DBVT_UTF8 || cws_new->value.type == DBVT_ASCIIZ || cws_new->value.type == DBVT_WCHAR)
				&& (dbv.type == DBVT_UTF8 || dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR))
			{
				WCHAR tmp_cws_new[1024] = L"";
				if (cws_new->value.type == DBVT_ASCIIZ)
					MultiByteToWideChar(CP_ACP, 0, cws_new->value.pszVal, -1, tmp_cws_new, MAX_REGS(tmp_cws_new));
				else if (cws_new->value.type == DBVT_UTF8)
					MultiByteToWideChar(CP_UTF8, 0, cws_new->value.pszVal, -1, tmp_cws_new, MAX_REGS(tmp_cws_new));
				else if (cws_new->value.type == DBVT_WCHAR)
					lstrcpyn(tmp_cws_new, cws_new->value.pwszVal, MAX_REGS(tmp_cws_new));

				WCHAR tmp_dbv[1024] = L"";
				if (dbv.type == DBVT_ASCIIZ)
					MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, tmp_dbv, MAX_REGS(tmp_dbv));
				else if (dbv.type == DBVT_UTF8)
					MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, tmp_dbv, MAX_REGS(tmp_dbv));
				else if (dbv.type == DBVT_WCHAR)
					lstrcpyn(tmp_dbv, dbv.pwszVal, MAX_REGS(tmp_dbv));

				ret = (lstrcmpW(tmp_cws_new, tmp_dbv) ? CheckStr(tmp_cws_new, 1, 2) : 0);
			}
			else
#endif
			{
				ret = 1;
			}
		}
		else if (dbv.type == DBVT_BYTE)
		{
			ret = (cws_new->value.bVal != dbv.bVal ? 1 : 0);
		}
		else if (dbv.type == DBVT_WORD)
		{
			ret = (cws_new->value.wVal != dbv.wVal ? 1 : 0);
		}
		else if (dbv.type == DBVT_DWORD)
		{
			ret = (cws_new->value.dVal != dbv.dVal ? 1 : 0);
		}
		else if (dbv.type == DBVT_ASCIIZ)
		{
			ret = (strcmp(cws_new->value.pszVal, dbv.pszVal) ? CheckStr(cws_new->value.pszVal, 1, 2) : 0);
		}
#ifdef UNICODE
		else if (dbv.type == DBVT_UTF8)
		{
			ret = (strcmp(cws_new->value.pszVal, dbv.pszVal) ? CheckStr(cws_new->value.pszVal, 1, 2) : 0);
		}
		else if (dbv.type == DBVT_WCHAR)
		{
			ret = (lstrcmp(cws_new->value.pwszVal, dbv.pwszVal) ? CheckStr(cws_new->value.pwszVal, 1, 2) : 0);
		}
#endif
	}

	if (ret == 1 || (ret == 2 && !ignore_remove))
	{
		// Copy current to old
		char old_setting[256];
		mir_snprintf(old_setting, MAX_REGS(old_setting), "%sOld", cws_new->szSetting);

		if (dbv.type == DBVT_DELETED)
		{
			DBDeleteContactSetting(hContact, cws_new->szModule, old_setting);
		}
		else
		{
			DBCONTACTWRITESETTING cws_old;
			cws_old.szModule = cws_new->szModule;
			cws_old.szSetting = old_setting;
			cws_old.value = dbv;
			CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws_old);
		}


		// Copy new to current
		if (cws_new->value.type == DBVT_DELETED)
		{
			DBDeleteContactSetting(hContact, cws_new->szModule, current_setting);
		}
		else
		{
			DBCONTACTWRITESETTING cws_old;
			cws_old.szModule = cws_new->szModule;
			cws_old.szSetting = current_setting;
			cws_old.value = cws_new->value;
			CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws_old);
		}
	}

	if (found_current)
		DBFreeVariant(&dbv);

	return ret;
}
开发者ID:Robyer,项目名称:miranda-plugins,代码行数:101,代码来源:nickhistory.cpp

示例6: ModernDBFreeVariant

int __cdecl ModernDBFreeVariant(DBVARIANT *dbv)
{
	return DBFreeVariant( dbv );
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:4,代码来源:modern_commonheaders.cpp

示例7: strcpy

void TemplateHTMLBuilder::appendEvent(IEView *view, IEVIEWEVENT *event) {
	DBVARIANT dbv;
	CONTACTINFO ci;
	char szBase[1024];
	char szNoAvatar[1024];
	char szCID[32];
	char *szName = NULL;
	char *szNameIn = NULL;
	char *szNameOut = NULL;
	char *szAvatar = NULL;
	char *szAvatarIn = NULL;
	char *szAvatarOut = NULL;
	char *szText = NULL;
	char *szProto = NULL;
	const char *tmpltName[2];
	bool isGrouping = false;

	int cp = CP_ACP;
	if (event->cbSize == sizeof(IEVIEWEVENT)) {
		cp = event->codepage;
	}
	szProto = Utils::dupString((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) event->hContact, 0));
	szBase[0]='\0';
	TemplateMap *tmpm = (event->dwFlags & IEEF_RTL) ? TemplateMap::getTemplateMap("default_rtl") : TemplateMap::getTemplateMap("default");
	if (tmpm!=NULL) {
    	strcpy(szBase, tmpm->getFilename());
    	char* pathrun = szBase + strlen(szBase);
    	while ((*pathrun != '\\' && *pathrun != '/') && (pathrun > szBase)) pathrun--;
    	pathrun++;
    	*pathrun = '\0';
    	isGrouping = tmpm->isGrouping();
	}
	sprintf(szNoAvatar, "%snoavatar.jpg", szBase);
	if (Options::getTemplatesFlags() & Options::LOG_SHOW_NICKNAMES) {
		ZeroMemory(&ci, sizeof(ci));
	    ci.cbSize = sizeof(ci);
	    ci.hContact = NULL;
	    ci.szProto = szProto;
	    ci.dwFlag = CNF_DISPLAY;
		if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
	        szNameOut = encodeUTF8(ci.pszVal, NULL, false);
		}
		szNameIn = encodeUTF8((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) event->hContact, 0), NULL, false);
	} else {
        szNameOut = Utils::dupString("&nbsp;");
        szNameIn = Utils::dupString("&nbsp;");
	}
	if (!DBGetContactSetting(event->hContact, "ContactPhoto", "File",&dbv)) {
	    if (strlen(dbv.pszVal) > 0) {
       		szAvatarIn = Utils::dupString(dbv.pszVal);
		    Utils::convertPath(szAvatarIn);
	    }
       	DBFreeVariant(&dbv);
	}
	if (szAvatarIn == NULL) {
        szAvatarIn = Utils::dupString(szNoAvatar);
	}
	if (!DBGetContactSetting(NULL, "ContactPhoto", "File",&dbv)) {
	    if (strlen(dbv.pszVal) > 0) {
       		szAvatarOut = Utils::dupString(dbv.pszVal);
		    Utils::convertPath(szAvatarOut);
	    }
       	DBFreeVariant(&dbv);
	}
	if (szAvatarOut == NULL) {
        szAvatarOut = Utils::dupString(szNoAvatar);
	}
	HANDLE hDbEvent = event->hDbEventFirst;
	event->hDbEventFirst = NULL;
	for (int eventIdx = 0; hDbEvent!=NULL && (eventIdx < event->count || event->count==-1); eventIdx++) {
		int outputSize;
		char *output;
		DBEVENTINFO dbei = { 0 };
        dbei.cbSize = sizeof(dbei);
        dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM) hDbEvent, 0);
        if (dbei.cbBlob == 0xFFFFFFFF) {
            return;
		}
        dbei.pBlob = (PBYTE) malloc(dbei.cbBlob);
        CallService(MS_DB_EVENT_GET, (WPARAM)  hDbEvent, (LPARAM) & dbei);

		if (!(dbei.flags & DBEF_SENT) && (dbei.eventType == EVENTTYPE_MESSAGE )) {
			CallService(MS_DB_EVENT_MARKREAD, (WPARAM) event->hContact, (LPARAM) hDbEvent);
			CallService(MS_CLIST_REMOVEEVENT, (WPARAM) event->hContact, (LPARAM) hDbEvent);
		} else if (dbei.eventType == EVENTTYPE_STATUSCHANGE) {
			CallService(MS_DB_EVENT_MARKREAD, (WPARAM) event->hContact, (LPARAM) hDbEvent);
		}
		HANDLE hCurDbEvent = hDbEvent;
        hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM) hDbEvent, 0);
		if (!isDbEventShown(0, &dbei)) {
            free(dbei.pBlob);
	        continue;
    	}
		output = NULL;
		if (dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_STATUSCHANGE || dbei.eventType == EVENTTYPE_FILE || dbei.eventType == EVENTTYPE_URL) {
			int isSent = (dbei.flags & DBEF_SENT);
			int isHistory = (dbei.timestamp < (DWORD)getStartedTime() && (dbei.flags & DBEF_READ || dbei.flags & DBEF_SENT));
			int isGroupBreak = TRUE;
 		  	if ((Options::getTemplatesFlags() & Options::LOG_GROUP_MESSAGES) && dbei.flags == LOWORD(getLastEventType())
			  && dbei.eventType == EVENTTYPE_MESSAGE && HIWORD(getLastEventType()) == EVENTTYPE_MESSAGE
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:mgoodies-svn,代码行数:101,代码来源:TemplateHTMLBuilder.cpp

示例8: DlgProcOpts

static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {

	HWND hw;
	int sel;
	DBVARIANT dbv;

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

		SendMessage(GetDlgItem(hwndDlg, IDC_SPIN1), UDM_SETRANGE, 0, (LPARAM)MAKELONG(50, 5));
		if(!DBGetContactSetting(NULL,"WorldTime","FontSize",&dbv)
			|| !DBGetContactSetting(NULL,"CLC","Font0Size",&dbv)) 
		{
			SendMessage(GetDlgItem(hwndDlg, IDC_SPIN1), UDM_SETPOS, 0, dbv.bVal);
		}

		SendMessage(GetDlgItem(hwndDlg, IDC_SP_INDENT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(500, 0));
		SendMessage(GetDlgItem(hwndDlg, IDC_SP_INDENT), UDM_SETPOS, 0, DBGetContactSettingWord(NULL, "WorldTime", "Indent", 0));
		SendMessage(GetDlgItem(hwndDlg, IDC_SP_ROWHEIGHT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(500, 6));
		SendMessage(GetDlgItem(hwndDlg, IDC_SP_ROWHEIGHT), UDM_SETPOS, 0, DBGetContactSettingWord(NULL, "WorldTime", "RowHeight", GetSystemMetrics(SM_CYSMICON)));

		copy_listbox_items(temp_listbox_items, listbox_items);
		hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);

		for(int ili = 0; ili < temp_listbox_items.getCount(); ili++) {
			sel = SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)&temp_listbox_items[ili].pszText);
		}

		if(!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
			bool minmax = (DBGetContactSettingByte(NULL, "WorldTime", "MinMax", DEFAULT_MINMAX ? 1 : 0) == 1);
			CheckDlgButton(hwndDlg, IDC_CHK_MINMAX, minmax);
			bool hide_menu = (DBGetContactSettingByte(NULL, "WorldTime", "HideMenu", 0) == 1);
			CheckDlgButton(hwndDlg, IDC_CHK_HIDEMENU, hide_menu ? 1 : 0);
		} else {
			CheckDlgButton(hwndDlg, IDC_CHK_HIDEMENU, TRUE);
			EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_HIDEMENU), FALSE);
			EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_SHOW), FALSE);
			EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_MINMAX), FALSE);
		}

		bool set_format = (DBGetContactSettingByte(NULL, "WorldTime", "EnableTimeFormat", 0) == 1);
		CheckDlgButton(hwndDlg, IDC_CHK_FORMAT, set_format ? 1 : 0);
		bool show_icons = (DBGetContactSettingByte(NULL, "WorldTime", "ShowIcons", 1) == 1);
		CheckDlgButton(hwndDlg, IDC_CHK_ICONS, show_icons ? 1 : 0);
		DBVARIANT dbv;
		if(!DBGetContactSettingTString(NULL, "WorldTime", "TimeFormat", &dbv))
			_tcscpy(format_string, dbv.ptszVal);
		DBFreeVariant(&dbv);
		SetDlgItemText(hwndDlg, IDC_ED_FORMAT, format_string);
		if(!DBGetContactSettingTString(NULL, "WorldTime", "DateFormat", &dbv))
			_tcscpy(date_format_string, dbv.ptszVal);
		DBFreeVariant(&dbv);
		SetDlgItemText(hwndDlg, IDC_ED_DATE_FORMAT, date_format_string);

		if(!set_format) {
			hw = GetDlgItem(hwndDlg, IDC_ED_FORMAT);
			EnableWindow(hw, FALSE);
			hw = GetDlgItem(hwndDlg, IDC_ED_DATE_FORMAT);
			EnableWindow(hw, FALSE);
		}

		SendDlgItemMessage(hwndDlg, IDC_TEXTCOL, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "WorldTime", "FontCol", GetSysColor(COLOR_WINDOWTEXT)));
		SendDlgItemMessage(hwndDlg, IDC_BGCOL, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "WorldTime", "BgColour", GetSysColor(COLOR_3DFACE)));

		if(ServiceExists(MS_FONT_REGISTERT)) {
		    ShowWindow(GetDlgItem(hwndDlg, IDC_STATICH), SW_HIDE);
		    ShowWindow(GetDlgItem(hwndDlg, IDC_STATICH2), SW_HIDE);
		    ShowWindow(GetDlgItem(hwndDlg, IDC_SPIN1), SW_HIDE);
		    ShowWindow(GetDlgItem(hwndDlg, IDC_ED_FSIZE), SW_HIDE);
		    ShowWindow(GetDlgItem(hwndDlg, IDC_TEXTCOL), SW_HIDE);

			ShowWindow(GetDlgItem(hwndDlg, IDC_STATFS), SW_SHOW);

		}

		//return TRUE;
		return FALSE;
	}
	case WM_COMMAND:
		if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
			switch( LOWORD( wParam )) {
			case IDC_ED_FORMAT:
			case IDC_ED_DATE_FORMAT:
				SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			}	
		}

		if (HIWORD( wParam ) == LBN_SELCHANGE && LOWORD(wParam) == IDC_LIST_TIMES2) {
			hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
			sel = SendMessage(hw, LB_GETCURSEL, 0, 0);
			if(sel != LB_ERR) {
				hw = GetDlgItem(hwndDlg, IDC_BTN_REM);
				EnableWindow(hw, sel != -1);
				hw = GetDlgItem(hwndDlg, IDC_BTN_EDIT);
				EnableWindow(hw, sel != -1);

				hw = GetDlgItem(hwndDlg, IDC_BTN_UP);
				EnableWindow(hw, (sel > 0));
				hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
//.........这里部分代码省略.........
开发者ID:darkscout,项目名称:sje-miranda-plugins,代码行数:101,代码来源:options.cpp

示例9: ShowPopup

void ShowPopup(XSTATUSCHANGE *xsc)
{
	DBVARIANT dbv;
	char szSetting[64];

	POPUPDATAT ppd = {0};
	ppd.lchContact = xsc->hContact;

	switch(xsc->type)
	{
		case TYPE_JABBER_MOOD:
		case TYPE_JABBER_ACTIVITY:
		{
			mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", xsc->szProto, (xsc->type == TYPE_JABBER_MOOD) ? "mood" : "activity", "icon");
			if (!DBGetContactSettingString(xsc->hContact, "AdvStatus", szSetting, &dbv)) 
			{
				ppd.lchIcon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)dbv.pszVal);
				DBFreeVariant(&dbv);
			}
			break;
		}
		case TYPE_ICQ_XSTATUS:
		{
			int statusId = DBGetContactSettingByte(xsc->hContact, xsc->szProto, "XStatusId", 0);
			ppd.lchIcon = (HICON)CallProtoService(xsc->szProto, PS_ICQ_GETCUSTOMSTATUSICON, statusId, LR_SHARED);
		}
	}

	if (ppd.lchIcon == NULL)
		ppd.lchIcon = LoadSkinnedProtoIcon(xsc->szProto, DBGetContactSettingWord(xsc->hContact, xsc->szProto, "Status", ID_STATUS_ONLINE));

	switch (opt.Colors)
	{
		case POPUP_COLOR_OWN:
			ppd.colorBack = DBGetContactSettingDword(0, MODULE, "40081bg", COLOR_BG_AVAILDEFAULT);
			ppd.colorText = DBGetContactSettingDword(0, MODULE, "40081tx", COLOR_TX_DEFAULT);
			break;
		case POPUP_COLOR_WINDOWS:
			ppd.colorBack = GetSysColor(COLOR_BTNFACE);
			ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
			break;
		case POPUP_COLOR_POPUP:
			ppd.colorBack = ppd.colorText = 0;
			break;
	}


	_tcscpy(ppd.lptzContactName, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)xsc->hContact, GSMDF_TCHAR));
	if (opt.ShowGroup) //add group name to popup title
	{
		if (!DBGetContactSettingTString(xsc->hContact, "CList", "Group", &dbv))
		{
			_tcscat(ppd.lptzContactName, _T(" ("));
			_tcscat(ppd.lptzContactName, dbv.ptszVal);
			_tcscat(ppd.lptzContactName, _T(")"));
			DBFreeVariant(&dbv);
		}
	}

	// cut message if needed
	if (opt.PTruncateMsg && (opt.PMsgLen > 0) && xsc->stzText && (_tcslen(xsc->stzText) > opt.PMsgLen))
	{
		TCHAR buff[MAX_TEXT_LEN + 3];
		_tcsncpy(buff, xsc->stzText, opt.PMsgLen);
		buff[opt.PMsgLen] = 0;
		_tcscat(buff, _T("..."));
		mir_free(xsc->stzText);
		xsc->stzText = mir_tstrdup(buff);
	}

	TCHAR *Template;
	switch (xsc->action)
	{
		case NOTIFY_NEW_XSTATUS:
			Template = templates.PopupNewXstatus; break;
		case NOTIFY_NEW_MESSAGE:
			Template = templates.PopupNewMsg; break;
		case NOTIFY_REMOVE:
			Template = templates.PopupRemove; break;
	}

	TCHAR stzPopupText[2*MAX_TEXT_LEN]; 
	ReplaceVars(xsc, Template, templates.PopupDelimiter, stzPopupText);
	_tcsncpy(ppd.lptzText, stzPopupText, SIZEOF(ppd.lptzText));
	ppd.lptzText[SIZEOF(ppd.lptzText) - 1] = 0;

	ppd.PluginWindowProc = (WNDPROC)PopupDlgProc;
	ppd.iSeconds = opt.PopupTimeout; 
	PUAddPopUpT(&ppd);
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:90,代码来源:xstatus.cpp

示例10: SelectContainerDlgProc


//.........这里部分代码省略.........
                    if (lstrlen(szOldName) == lstrlen(szNewName)) {
                        MessageBox(0, CTranslator::get(CTranslator::CNT_SELECT_INUSE), _T("Error"), MB_OK | MB_ICONERROR);
                        SetFocus(GetDlgItem(hwndDlg, IDC_NEWCONTAINERNAME));
                        break;
                    }
                }
                if ((iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETCURSEL, 0, 0)) != LB_ERR) {
                    SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM) iItem, (LPARAM) szName);
                    if (!_tcsncmp(szName, _T("default"), CONTAINER_NAMELEN) || !_tcsncmp(szName, CTranslator::get(CTranslator::GEN_DEFAULT_CONTAINER_NAME), CONTAINER_NAMELEN))
                        MessageBox(hwndDlg, CTranslator::get(CTranslator::CNT_SELECT_RENAMEERROR), _T("Error"), MB_OK | MB_ICONERROR);
                    else {
                        int iIndex = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETITEMDATA, (WPARAM)iItem, 0);
                        RenameContainer(iIndex, szNewName);
                        SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_RESETCONTENT, 0, 0);
                        while (pCurrent) {
                            if (!_tcsncmp(pCurrent->szName, szName, CONTAINER_NAMELEN) && lstrlen(pCurrent->szName) == lstrlen(szName)) {
                                _tcsncpy(pCurrent->szName, szNewName, CONTAINER_NAMELEN);
                                SendMessage(pCurrent->hwnd, DM_CONFIGURECONTAINER, 0, 0);
                            }
                            pCurrent = pCurrent->pNextContainer;
                        }
                        SendMessage(hwndDlg, DM_SC_BUILDLIST, 0, 0);
                        BuildContainerMenu();
                    }
                }
            }
            break;
        }
        case IDC_CREATENEW: {
            int iLen, iItem;
            TCHAR szNewName[CONTAINER_NAMELEN], szName[CONTAINER_NAMELEN + 1];

            iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_NEWCONTAINER));
            if (iLen) {
                GetWindowText(GetDlgItem(hwndDlg, IDC_NEWCONTAINER), szNewName, CONTAINER_NAMELEN);
                iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_FINDSTRING, (WPARAM) - 1, (LPARAM) szNewName);
                if (iItem != LB_ERR || !_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
                    SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szName);
                    if (lstrlen(szName) == lstrlen(szNewName) || !_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
                        MessageBox(0, CTranslator::get(CTranslator::CNT_SELECT_INUSE), _T("Error"), MB_OK | MB_ICONERROR);
                        SetFocus(GetDlgItem(hwndDlg, IDC_NEWCONTAINER));
                        break;
                    }
                }
                if (IsWindow(hwndMsgDlg)) {
                    SendMessage(hwndMsgDlg, DM_CONTAINERSELECTED, 0, (LPARAM) szNewName);
                    if (IsWindow(hwndDlg))
                        DestroyWindow(hwndDlg);
                }
            }
            break;
        }
        case IDC_CNTLIST:
            if (HIWORD(wParam) == LBN_DBLCLK)
                SendMessage(hwndDlg, WM_COMMAND, IDOK, 0);
            break;
        }
        break;
    /*
     * fill the list box...
     */
    case DM_SC_BUILDLIST: {
        DBVARIANT dbv;
        int iCounter = 0, iItemNew;
        char *szKey = "TAB_ContainersW";
        char szValue[10];
        struct TContainerData *pContainer = 0;
        do {
            _snprintf(szValue, 8, "%d", iCounter);
            if (M->GetTString(NULL, szKey, szValue, &dbv))
                break;          // end of list
            if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR) {
                if (_tcsncmp(dbv.ptszVal, _T("**free**"), CONTAINER_NAMELEN)) {
                    iItemNew = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_ADDSTRING, 0, (LPARAM)(!_tcscmp(dbv.ptszVal, _T("default")) ?
                                                  CTranslator::get(CTranslator::GEN_DEFAULT_CONTAINER_NAME) : dbv.ptszVal));
                    if (iItemNew != LB_ERR)
                        SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_SETITEMDATA, (WPARAM)iItemNew, (LPARAM)iCounter);
                }
                DBFreeVariant(&dbv);
            }
        } while (++iCounter);

        /*
         * highlight the name of the container to which the message window currently is assigned
         */

        SendMessage(hwndMsgDlg, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
        if (pContainer) {
            LRESULT iItem;

            iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_FINDSTRING, (WPARAM) - 1, (LPARAM)(!_tcscmp(pContainer->szName, _T("default")) ?
                                       CTranslator::get(CTranslator::GEN_DEFAULT_CONTAINER_NAME) : pContainer->szName));
            if (iItem != LB_ERR)
                SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_SETCURSEL, (WPARAM) iItem, 0);
        }
    }
    break;
    }
    return FALSE;
}
开发者ID:dineshkummarc,项目名称:miranda-im-v0.9.47-src,代码行数:101,代码来源:selectcontainer.cpp

示例11: Load


//.........这里部分代码省略.........
		MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes");
		MyUpdateLayeredWindow = (BOOL (WINAPI *)(HWND, HDC, POINT *, SIZE *, HDC, POINT *, COLORREF, BLENDFUNCTION *, DWORD))GetProcAddress(hUserDll, "UpdateLayeredWindow");
		MyAnimateWindow = (BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll,"AnimateWindow");
		MyDrawTextW = (int (WINAPI *)(HDC, LPCWSTR, int, LPRECT, UINT))GetProcAddress(hUserDll,"DrawTextW");
		MyDrawTextExW = (int (WINAPI*)(HDC,LPCWSTR,int,LPRECT,UINT,LPDRAWTEXTPARAMS))GetProcAddress(hUserDll,"DrawTextExW");
		MySetWindowTextW = (BOOL (WINAPI*)(HWND, LPCWSTR))GetProcAddress(hUserDll,"SetWindowTextW");
		MySendMessageW = (LRESULT (WINAPI *)(HWND, UINT, WPARAM, LPARAM))GetProcAddress(hUserDll,"SendMessageW");
		MyCallWindowProcW = (LRESULT (WINAPI  *)(WNDPROC, HWND, UINT, WPARAM, LPARAM))GetProcAddress(hUserDll,"CallWindowProcW");
		MyCreateWindowExW = (HWND (WINAPI*)(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID))GetProcAddress(hUserDll,"CreateWindowExW");

		if (LOWORD(GetVersion())!=4) { //Windows 98, ME, 2000, XP, and later support multimonitor configuration.
			if (bResult) {
				if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
				{ //2000 or XP
					#ifdef UNICODE
						MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll,("GetMonitorInfoW"));
					#else
						MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll,("GetMonitorInfoA"));
					#endif //UNICODE
				} else
				{ //98 or ME
					// attempt to fix multimonitor on 9x
					MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll,("GetMonitorInfoA"));
					if (!MyGetMonitorInfo)
						MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll,("GetMonitorInfo"));
				}
			} //There's no need for an else branch.
			if (MyGetMonitorInfo)
				MyMonitorFromWindow = (HMONITOR (WINAPI*)(HWND,DWORD))GetProcAddress(hUserDll, ("MonitorFromWindow"));
		}
	}

	hGdiDll = LoadLibrary(_T("gdi32.dll"));
	if (hGdiDll) {
		MyGetTextExtentPoint32W = (BOOL (WINAPI *)(HDC, LPCWSTR, int, LPSIZE))GetProcAddress(hGdiDll,"GetTextExtentPoint32W");
	}
	else{
		MyGetTextExtentPoint32W = 0;
	}
	hMsimgDll = LoadLibrary(_T("msimg32.dll"));
	MyAlphaBlend = 0;
	MyTransparentBlt = 0;
	if (hMsimgDll)
	{
		MyTransparentBlt = (BOOL (WINAPI *)(HDC, int, int, int, int, HDC, int, int, int, int, UINT))
			GetProcAddress(hMsimgDll, "TransparentBlt");
		MyAlphaBlend = (BOOL (WINAPI *)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION))
			GetProcAddress(hMsimgDll, "AlphaBlend");
	}
#endif

	hDwmapiDll = LoadLibrary(_T("dwmapi.dll"));
	MyDwmEnableBlurBehindWindow = 0;
	if (hDwmapiDll) {
		MyDwmEnableBlurBehindWindow = (HRESULT (WINAPI *)(HWND, DWM_BLURBEHIND *))
			GetProcAddress(hDwmapiDll, "DwmEnableBlurBehindWindow");
	}

	PopupHistoryLoad();
	LoadPopupThread();
	if (!LoadPopupWnd2())
	{
		MessageBox(0, TranslateTS(
			_T("Error: I could not register the PopUp Window class.\r\n")
			_T("The plugin will not operate.")
			),
			_T(MODULNAME_LONG), MB_ICONSTOP|MB_OK);
		return 0; //We couldn't register our Window Class, don't hook any event: the plugin will act as if it was disabled.
	}
	RegisterOptPrevBox();

	// Register in DBEditor++
	DBVARIANT dbv;
	if (DBGetContactSetting(NULL, "KnownModules", MODULNAME, &dbv))
		DBWriteContactSettingString(NULL, "KnownModules", pluginInfoEx.shortName, MODULNAME);
	DBFreeVariant(&dbv);
	
	hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
	hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
	hOkToExit = HookEvent(ME_SYSTEM_OKTOEXIT, OkToExit);
//	hEventStatusChanged = HookEvent(ME_CLIST_STATUSMODECHANGE,StatusModeChanged);

	hbmNoAvatar = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_NOAVATAR));

	if(!OptionLoaded){
		LoadOptions();
	}

	//Service Functions
	for (int i = SIZEOF(popupServices); i--; )
		popupServices[i].handle = CreateServiceFunction(popupServices[i].name, popupServices[i].func);

	//load icons / create hook
	InitIcons();
	hIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED,IconsChanged);
	//add menu items
	InitMenuItems();

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

示例12: __declspec

/** Initializes the services provided and the link to those needed
* Called when the plugin is loaded into Miranda
*/
int __declspec(dllexport)Load(PLUGINLINK *link)
{
    PROTOCOLDESCRIPTOR pd;
    DBVARIANT dbv;

    pluginLink=link;

    mir_getMMI(&mmi);
    mir_getLP(&pluginInfo);

    os_unicode_enabled = IsUnicodeOS();

    if(ServiceExists(MS_DB_SETSETTINGRESIDENT)) { // 0.6+
        CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/Status"));
        CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/IdleTS"));
        CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/ContactCountCheck"));
        CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/Handle"));
        CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/WindowOpen"));
    }

    //set all contacts to 'offline', and initialize subcontact counter for db consistency check
    {
        HANDLE hContact = (HANDLE)CallService( MS_DB_CONTACT_FINDFIRST, 0, 0);
        char *proto;
        while(hContact != NULL) {
            //proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
            if(!DBGetContactSetting(hContact, "Protocol", "p", &dbv)) {
                proto = dbv.pszVal;
                if (proto && !lstrcmp( META_PROTO, proto)) {
                    DBWriteContactSettingWord(hContact, META_PROTO, "Status", ID_STATUS_OFFLINE);
                    DBWriteContactSettingDword(hContact, META_PROTO, "IdleTS", 0);
                    DBWriteContactSettingByte(hContact, META_PROTO, "ContactCountCheck", 0);

                    // restore any saved defaults that might have remained if miranda was closed or crashed while a convo was happening
                    if(DBGetContactSettingDword(hContact, META_PROTO, "SavedDefault", (DWORD)-1) != (DWORD)-1) {
                        DBWriteContactSettingDword(hContact, META_PROTO, "Default", DBGetContactSettingDword(hContact, META_PROTO, "SavedDefault", 0));
                        DBWriteContactSettingDword(hContact, META_PROTO, "SavedDefault", (DWORD)-1);
                    }

                }
                DBFreeVariant(&dbv);
            }

            hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
        }
    }

    Meta_ReadOptions(&options);


    // sets subcontact handles to metacontacts, and metacontact handles to subcontacts
    // (since these handles are not necessarily the same from run to run of miranda)

    // also verifies that subcontacts: have metacontacts, and that contact numbers are reasonable,
    // that metacontacts: have the correct number of subcontacts, and have reasonable defaults
    if(Meta_SetHandles()) {
        // error - db corruption
        if(!DBGetContactSettingByte(0, META_PROTO, "DisabledMessageShown", 0)) {
            MessageBox(0, Translate("Error - Database corruption.\nPlugin disabled."), Translate("MetaContacts"), MB_OK | MB_ICONERROR);
            DBWriteContactSettingByte(0, META_PROTO, "DisabledMessageShown", 1);
        }
        //Meta_HideMetaContacts(TRUE);
        return 1;
    }

    DBDeleteContactSetting(0, META_PROTO, "DisabledMessageShown");

    // add our modules to the KnownModules list
    {
        DBVARIANT dbv;
        if (DBGetContactSetting(NULL, "KnownModules", META_PROTO, &dbv))
            DBWriteContactSettingString(NULL, "KnownModules", META_PROTO, META_PROTO);
        else
            DBFreeVariant(&dbv);
    }

    ZeroMemory(&pd,sizeof(pd));
    pd.cbSize=PROTOCOLDESCRIPTOR_V3_SIZE;//sizeof(pd);

    pd.szName=META_FILTER;
    pd.type=PROTOTYPE_FILTER;
    CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);

    ZeroMemory(&pd,sizeof(pd));
    pd.cbSize=PROTOCOLDESCRIPTOR_V3_SIZE;//sizeof(pd);

    pd.szName=META_PROTO;
    pd.type = PROTOTYPE_PROTOCOL;
    CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);

    // further db setup done in modules loaded (nick [protocol string required] & clist display name)

    Meta_InitServices();

    // moved to 'modules loaded' event handler (in meta_services.c) because we need to
    // check protocol for jabber hack, and the proto modules must be loaded
    //Meta_HideLinkedContactsAndSetHandles();
//.........这里部分代码省略.........
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:101,代码来源:meta_main.c

示例13: getRealContact

void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, ProtocolSettings* protoSettings) {
	DBVARIANT dbv;
	CONTACTINFO ci;
	HANDLE hRealContact;
	char *szRealProto = NULL;
	char tempBase[1024];
	char *szBase=NULL;
	char tempStr[1024];
	char *szNoAvatar=NULL;
	char szCID[32];
	char *szName = NULL;
	char *szNameIn = NULL;
	char *szNameOut = NULL;
	char *szUIN = NULL;
	char *szUINIn = NULL;
	char *szUINOut = NULL;
	char *szNickIn = NULL;
	char *szNickOut = NULL;
	char *szStatusMsg = NULL;
	char *szAvatar = NULL;
	char *szAvatarIn = NULL;
	char *szAvatarOut = NULL;
	char *szText = NULL;
	char *szProto = NULL;
	char *szFileDesc = NULL;
	const char *tmpltName[2];
	bool isGrouping = false;
//	DWORD today = (DWORD)time(NULL);
//	today = today - today % 86400;
	if (protoSettings == NULL) {
		return;
	}
	hRealContact = getRealContact(event->hContact);
	szRealProto = getProto(hRealContact);
	szProto = getProto(event->pszProto, event->hContact);
	tempBase[0]='\0';
	TemplateMap *tmpm = getTemplateMap(protoSettings);
	if (tmpm!=NULL) {
		strcpy(tempBase, "file://");
		strcat(tempBase, tmpm->getFilename());
		char* pathrun = tempBase + strlen(tempBase);
		while ((*pathrun != '\\' && *pathrun != '/') && (pathrun > tempBase)) pathrun--;
		pathrun++;
		*pathrun = '\0';
		isGrouping = tmpm->isGrouping();
	}
	szBase = Utils::UTF8Encode(tempBase);

	if (event->hContact != NULL) {
		getUINs(event->hContact, szUINIn, szUINOut);
	}

	if (event->hContact != NULL) {
		szNameOut = getEncodedContactName(NULL, szProto, szRealProto);
		szNameIn = getEncodedContactName(event->hContact, szProto, szRealProto);
	} else {
		szNameOut = Utils::dupString("&nbsp;");
		szNameIn = Utils::dupString("&nbsp;");
	}
	sprintf(tempStr, "%snoavatar.jpg", tempBase);
	szNoAvatar = Utils::UTF8Encode(tempStr);

	if(event->hContact != NULL) {
		szAvatarIn = getAvatar(event->hContact, szRealProto);
	}
	if (szAvatarIn == NULL) {
		szAvatarIn = Utils::dupString(szNoAvatar);
	}
	szAvatarOut = getAvatar(NULL, szRealProto);
	if (szAvatarOut == NULL) {
		szAvatarOut = Utils::dupString(szNoAvatar);
	}
	if(event->hContact != NULL) {
		if (!DBGetContactSetting(event->hContact, "CList", "StatusMsg",&dbv)) {
			if (strlen(dbv.pszVal) > 0) {
				szStatusMsg = Utils::UTF8Encode(dbv.pszVal);
			}
			DBFreeVariant(&dbv);
		}
	}
	ZeroMemory(&ci, sizeof(ci));
	ci.cbSize = sizeof(ci);
	ci.hContact = event->hContact;
	ci.szProto = szProto;
	ci.dwFlag = CNF_NICK | CNF_TCHAR;
	if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
		szNickIn = encodeUTF8(event->hContact, szRealProto, ci.pszVal, ENF_NAMESMILEYS, true);
	}
	ZeroMemory(&ci, sizeof(ci));
	ci.cbSize = sizeof(ci);
	ci.hContact = NULL;
	ci.szProto = szProto;
	ci.dwFlag = CNF_NICK | CNF_TCHAR;
	if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
		szNickOut = encodeUTF8(event->hContact, szRealProto, ci.pszVal, ENF_NAMESMILEYS, true);
	}
	IEVIEWEVENTDATA* eventData = event->eventData;
	for (int eventIdx = 0; eventData!=NULL && (eventIdx < event->count || event->count==-1); eventData = eventData->next, eventIdx++) {
		int outputSize;
		char *output;
//.........这里部分代码省略.........
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:101,代码来源:TemplateHTMLBuilder.cpp

示例14: YahooUserInfoDlgProc

static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam )
{
	switch ( msg ) {
	case WM_INITDIALOG:
		// lParam is hContact
		TranslateDialogDefault( hwndDlg );

		//SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_USERDETAILS));

		
		break;

	case WM_NOTIFY:
		if (( ( LPNMHDR )lParam )->idFrom == 0 ) {
			switch (( ( LPNMHDR )lParam )->code ) {
			case PSN_PARAMCHANGED:
				SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (( PSHNOTIFY* )lParam )->lParam );
				break;
			case PSN_INFOCHANGED:
				{
					CYahooProto* ppro = (CYahooProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);

					if (!ppro)
						break;

					char* szProto;
					HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam;

					if (hContact == NULL) {
						szProto = ppro->m_szModuleName;
					} else {
						szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
					}

					if (!szProto)
						break;

					if (hContact) {
						DBVARIANT dbv;
						char z[128];
						
						if (ppro->GetString( hContact,  YAHOO_LOGINID, &dbv ) == 0) {
							strcpy(z, dbv.pszVal);
							DBFreeVariant( &dbv );
						} else {
							strcpy(z, "???");
						}
						
						SetDlgItemTextA(hwndDlg, IDC_SEARCH_ID, z);
						
						if (ppro->GetString( hContact,  "Transport", &dbv ) == 0) {
							strcpy(z, dbv.pszVal);
							DBFreeVariant( &dbv );
						} else {
							strcpy(z, "Yahoo");
						}
						
						SetDlgItemTextA(hwndDlg, IDC_SEARCH_PROTOCOL, z);
						
						if (ppro->GetString( hContact,  "MirVer", &dbv ) == 0) {
							strcpy(z, dbv.pszVal);
							DBFreeVariant( &dbv );
						} else {
							strcpy(z, "???");
						}
						
						SetDlgItemTextA(hwndDlg, IDC_NFO_CLIENT, z);
						
					} else {
					}
				}
				break;
			}	
		}
		break;

	case WM_CLOSE:
		DestroyWindow(hwndDlg);
		break;

	case WM_DESTROY:
		
		break;
	}
	return FALSE;
}
开发者ID:raoergsls,项目名称:miranda,代码行数:86,代码来源:user_info.cpp

示例15: TlenUserInfoDlgProc

static BOOL CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_INITDIALOG:
		// lParam is hContact
		TranslateDialogDefault(hwndDlg);
		SetWindowLong(hwndDlg, GWL_USERDATA, (LONG)(HANDLE) lParam);

		InitComboBox(GetDlgItem(hwndDlg, IDC_GENDER), tlenFieldGender);
		InitComboBox(GetDlgItem(hwndDlg, IDC_OCCUPATION), tlenFieldOccupation);
		InitComboBox(GetDlgItem(hwndDlg, IDC_LOOKFOR), tlenFieldLookfor);

		SendMessage(hwndDlg, WM_JABBER_REFRESH, 0, 0);
		return TRUE;
	case WM_JABBER_REFRESH:
		{
			DBVARIANT dbv;
			HANDLE hContact;
			char *jid;
			int i;
			JABBER_LIST_ITEM *item;

			JabberLog("refresh");

			SetDlgItemText(hwndDlg, IDC_INFO_JID, "");
			SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, "");
			SetFocus(GetDlgItem(hwndDlg, IDC_STATIC));
			
			hContact = (HANDLE) GetWindowLong(hwndDlg, GWL_USERDATA);
			if (!DBGetContactSetting(hContact, jabberProtoName, "FirstName", &dbv)) {
				SetDlgItemText(hwndDlg, IDC_FIRSTNAME, dbv.pszVal);
				DBFreeVariant(&dbv);
			} else SetDlgItemText(hwndDlg, IDC_FIRSTNAME, "");
			if (!DBGetContactSetting(hContact, jabberProtoName, "LastName", &dbv)) {
				SetDlgItemText(hwndDlg, IDC_LASTNAME, dbv.pszVal);
				DBFreeVariant(&dbv);
			} else SetDlgItemText(hwndDlg, IDC_LASTNAME, "");
			if (!DBGetContactSetting(hContact, jabberProtoName, "Nick", &dbv)) {
				SetDlgItemText(hwndDlg, IDC_NICKNAME, dbv.pszVal);
				DBFreeVariant(&dbv);
			} else SetDlgItemText(hwndDlg, IDC_NICKNAME, "");
			if (!DBGetContactSetting(hContact, jabberProtoName, "e-mail", &dbv)) {
				SetDlgItemText(hwndDlg, IDC_EMAIL, dbv.pszVal);
				DBFreeVariant(&dbv);
			} else SetDlgItemText(hwndDlg, IDC_EMAIL, "");
			if (!DBGetContactSetting(hContact, jabberProtoName, "Age", &dbv)) {
				SetDlgItemInt(hwndDlg, IDC_AGE, dbv.wVal, FALSE);
				DBFreeVariant(&dbv);
			} else SetDlgItemText(hwndDlg, IDC_AGE, "");
			if (!DBGetContactSetting(hContact, jabberProtoName, "City", &dbv)) {
				SetDlgItemText(hwndDlg, IDC_CITY, dbv.pszVal);
				DBFreeVariant(&dbv);
			} else SetDlgItemText(hwndDlg, IDC_CITY, "");
			if (!DBGetContactSetting(hContact, jabberProtoName, "School", &dbv)) {
				SetDlgItemText(hwndDlg, IDC_SCHOOL, dbv.pszVal);
				DBFreeVariant(&dbv);
			} else SetDlgItemText(hwndDlg, IDC_SCHOOL, "");
			switch (DBGetContactSettingByte(hContact, jabberProtoName, "Gender", '?')) {
				case 'M':
					SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_SETCURSEL, 1, 0);
					SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, Translate(tlenFieldGender[0].name));
					break;
				case 'F':
					SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_SETCURSEL, 2, 0);
					SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, Translate(tlenFieldGender[1].name));
					break;
				default:
					SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_SETCURSEL, 0, 0);
					SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, "");
					break;
			} 
			i = DBGetContactSettingWord(hContact, jabberProtoName, "Occupation", 0);
			if (i>0 && i<13) {
				SetDlgItemText(hwndDlg, IDC_OCCUPATION_TEXT, Translate(tlenFieldOccupation[i-1].name));
				SendDlgItemMessage(hwndDlg, IDC_OCCUPATION, CB_SETCURSEL, i, 0);
			} else {
				SetDlgItemText(hwndDlg, IDC_OCCUPATION_TEXT, "");
				SendDlgItemMessage(hwndDlg, IDC_OCCUPATION, CB_SETCURSEL, 0, 0);
			}
			i = DBGetContactSettingWord(hContact, jabberProtoName, "LookingFor", 0);
			if (i>0 && i<6) {
				SetDlgItemText(hwndDlg, IDC_LOOKFOR_TEXT, Translate(tlenFieldLookfor[i-1].name));
				SendDlgItemMessage(hwndDlg, IDC_LOOKFOR, CB_SETCURSEL, i, 0);
			} else {
				SetDlgItemText(hwndDlg, IDC_LOOKFOR_TEXT, "");
				SendDlgItemMessage(hwndDlg, IDC_LOOKFOR, CB_SETCURSEL, 0, 0);
			}
			i = DBGetContactSettingWord(hContact, jabberProtoName, "VoiceChat", 0);
			CheckDlgButton(hwndDlg, IDC_VOICECONVERSATIONS, i);
			i = DBGetContactSettingWord(hContact, jabberProtoName, "PublicStatus", 0);
			CheckDlgButton(hwndDlg, IDC_PUBLICSTATUS, i);
			if (!DBGetContactSetting(hContact, jabberProtoName, "jid", &dbv)) {
				jid = JabberTextDecode(dbv.pszVal);
				SetDlgItemText(hwndDlg, IDC_INFO_JID, jid);
				free(jid);
				jid = dbv.pszVal;
				if (jabberOnline) {
					if ((item=JabberListGetItemPtr(LIST_ROSTER, jid)) != NULL) {
						switch (item->subscription) {
						case SUB_BOTH:
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:mtlen-svn,代码行数:101,代码来源:tlen_userinfo.c


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