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


C++ DBWriteContactSettingDword函数代码示例

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


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

示例1: Meta_Assign

void Meta_Assign(HANDLE hSub, HANDLE hMeta) {
    metaMap[hMeta].add(hSub);
    DBWriteContactSettingDword(hSub, MODULE, "ParentMetaID", DBGetContactSettingDword(hMeta, MODULE, META_ID, -1));
    DBWriteContactSettingDword(hSub, MODULE, "Handle", (DWORD)hMeta);
    DBWriteContactSettingByte(hSub, MODULE, "IsSubcontact", 1);
    if(MetaEnabled()) {
        if(!meta_group_hack_disabled)
            DBWriteContactSettingByte(hSub, "CList", "Hidden", 1);
    } else // shouldn't happen, as the menu option is hidden when metas are disabled...
        DBWriteContactSettingByte(hMeta, "CList", "Hidden", 1);

    CallService(MS_IGNORE_IGNORE, (WPARAM)hSub, (WPARAM)IGNOREEVENT_USERONLINE);

    DBVARIANT dbv;
    if(DBGetContactSettingUTF8String(hMeta, "CList", "MyHandle", &dbv)) {
        if(!DBGetContactSettingUTF8String(hSub, "CList", "MyHandle", &dbv)) {
            DBWriteContactSettingUTF8String(hMeta, "CList", "MyHandle", dbv.pszVal);
            DBFreeVariant(&dbv);
        }
    } else
        DBFreeVariant(&dbv);

    if(DBGetContactSettingUTF8String(hMeta, MODULE, "Nick", &dbv)) {
        char *subProto = ContactProto(hSub);
        if(subProto) {
            if(!DBGetContactSettingUTF8String(hSub, subProto, "Nick", &dbv)) {
                DBWriteContactSettingUTF8String(hMeta, MODULE, "Nick", dbv.pszVal);
                DBFreeVariant(&dbv);
            }
        }
    } else
        DBFreeVariant(&dbv);

    FireSubcontactsChanged(hMeta);
}
开发者ID:sje397,项目名称:sje-miranda-plugins,代码行数:35,代码来源:core_functions.cpp

示例2: ApplyChanges

/** Scans the \c CHANGES and call the appropriate function for each change.
*
* @param chg : Structure holding all the change info (See CHANGES).
*/
void ApplyChanges(CHANGES *chg)
{
	HANDLE most_online;
	int i;

	// remove removed contacts
	for(i = 0; i < chg->num_deleted; i++) {
		Meta_Delete((WPARAM)chg->hDeletedContacts[i], 0);
		if(chg->hDeletedContacts[i] == chg->hDefaultContact)
			chg->hDefaultContact = 0;
		if(chg->hDeletedContacts[i] == chg->hOfflineContact)
			chg->hOfflineContact = 0;
	}

	// set contact positions
	for(i = 0; i < chg->num_contacts; i++) {
		if(Meta_GetContactNumber(chg->hContact[i]) != i)
			Meta_SwapContacts(chg->hMeta, Meta_GetContactNumber(chg->hContact[i]), i);
	}

	NotifyEventHooks(hSubcontactsChanged, (WPARAM)chg->hMeta, (LPARAM)chg->hDefaultContact);

	// set default
	if(chg->hDefaultContact)
		DBWriteContactSettingDword(chg->hMeta, META_PROTO, "Default", Meta_GetContactNumber(chg->hDefaultContact));
	else
		DBWriteContactSettingDword(chg->hMeta, META_PROTO, "Default", 0);
	NotifyEventHooks(hEventDefaultChanged, (WPARAM)chg->hMeta, (LPARAM)chg->hDefaultContact);

	// set offline
	if(chg->hOfflineContact)
		DBWriteContactSettingDword(chg->hMeta, META_PROTO, "OfflineSend", Meta_GetContactNumber(chg->hOfflineContact));
	else
		DBWriteContactSettingDword(chg->hMeta, META_PROTO, "OfflineSend", (DWORD)-1);

	// fix nick
	most_online = Meta_GetMostOnline(chg->hMeta);
	Meta_CopyContactNick(chg->hMeta, most_online);

	// fix status
	Meta_FixStatus(chg->hMeta);

	// fix avatar
	most_online = Meta_GetMostOnlineSupporting(chg->hMeta, PFLAGNUM_4, PF4_AVATARS);
	if(most_online) {
		PROTO_AVATAR_INFORMATION AI;

		AI.cbSize = sizeof(AI);
		AI.hContact = chg->hMeta;
		AI.format = PA_FORMAT_UNKNOWN;
		strcpy(AI.filename, "X");

		if((int)CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&AI) == GAIR_SUCCESS)
	        DBWriteContactSettingString(chg->hMeta, "ContactPhoto", "File",AI.filename);
	}

	if(MetaAPI_GetForceState((WPARAM)chg->hMeta, 0) != chg->force_default)
		MetaAPI_ForceDefault((WPARAM)chg->hMeta, 0);
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:63,代码来源:edit.c

示例3: SavePosition

void SavePosition(HWND hwnd, char *wndName)
{
	RECT rc;
	char buffer[512];
	GetWindowRect(hwnd, &rc);
	mir_snprintf(buffer, SIZEOF(buffer), "%sPosX", wndName);
	DBWriteContactSettingDword(0, __INTERNAL_NAME, buffer, rc.left);
	mir_snprintf(buffer, SIZEOF(buffer), "%sPosY", wndName);
	DBWriteContactSettingDword(0, __INTERNAL_NAME, buffer, rc.top);
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:10,代码来源:Utils.cpp

示例4: Meta_Convert

/** Convert the contact chosen into a MetaContact.
*
* Create a new MetaContact, remove the selected contact from the \c CList
* and attach it to the MetaContact.
*
* @param wParam :	\c HANDLE to the contact that has been chosen.
* @param lParam :	Allways set to 0.
*/
INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam)
{
	HANDLE hMetaContact;
	DBVARIANT dbv;
	char *group = 0;//, *proto;
		
	// Get some information about the selected contact.
//	proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0);
	if(!DBGetContactSettingStringUtf((HANDLE)wParam,"CList","Group",&dbv)) {
		group = _strdup(dbv.pszVal);
		DBFreeVariant(&dbv);
	}

	// Create a new metacontact
	hMetaContact = (HANDLE)CallService(MS_DB_CONTACT_ADD,0,0);
			
	// Add the info for the metacontact
	if(hMetaContact)
	{

		DBWriteContactSettingDword(hMetaContact,META_PROTO,META_ID,nextMetaID);
		DBWriteContactSettingDword(hMetaContact,META_PROTO,"NumContacts",0);
		DBWriteContactSettingDword(NULL,META_PROTO,"NextMetaID",++nextMetaID);

		// Add the MetaContact protocol to the new meta contact
		CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )hMetaContact, ( LPARAM )META_PROTO );

		if(group) {
			if(ServiceExists(MS_DB_CONTACT_GETSETTING_STR))
				DBWriteContactSettingStringUtf(hMetaContact,"CList","Group",group);
			else
				DBWriteContactSettingString(hMetaContact,"CList","Group",group);
		}
		
		// Assign the contact to the MetaContact just created (and make default).
		if(!Meta_Assign((HANDLE)wParam,hMetaContact,TRUE)) {
			MessageBox(0,Translate("There was a problem in assigning the contact to the MetaContact"),Translate("Error"),MB_ICONEXCLAMATION);
			CallService(MS_DB_CONTACT_DELETE, (WPARAM)hMetaContact, 0);
			return 0;
		}

		// hide the contact if clist groups disabled (shouldn't create one anyway since menus disabled)
		if(!Meta_IsEnabled())
			DBWriteContactSettingByte(hMetaContact, "CList", "Hidden", 1);

	}

	//	Update the graphics
	CallService(MS_CLUI_SORTLIST,0,0);

	free(group);
	return (int)hMetaContact;
}
开发者ID:darkscout,项目名称:sje-miranda-plugins,代码行数:61,代码来源:meta_menu.c

示例5: SaveOptions

void SaveOptions() {
	DBWriteContactSettingDword(0, MODULE, "DefaultTimeout", options.default_timeout);
	DBWriteContactSettingDword(0, MODULE, "WinWidth", options.win_width);
	DBWriteContactSettingDword(0, MODULE, "WinMaxHeight", options.win_max_height);
	DBWriteContactSettingByte(0, MODULE, "Location", (BYTE)options.location);
	DBWriteContactSettingByte(0, MODULE, "Opacity", (BYTE)options.opacity);
	DBWriteContactSettingByte(0, MODULE, "Border", (options.border ? 1 : 0));
	DBWriteContactSettingByte(0, MODULE, "RoundCorners", (options.round ? 1 : 0));
	DBWriteContactSettingByte(0, MODULE, "AvatarRoundCorners", (options.av_round ? 1 : 0));
	DBWriteContactSettingByte(0, MODULE, "Animate", (options.animate ? 1 : 0));
	DBWriteContactSettingByte(0, MODULE, "TransparentBg", (options.trans_bg ? 1 : 0));
	DBWriteContactSettingByte(0, MODULE, "UseMimMonitor", (options.use_mim_monitor ? 1 : 0));
	DBWriteContactSettingByte(0, MODULE, "RightIcon", (options.right_icon ? 1 : 0));
	if(ServiceExists(MS_AV_DRAWAVATAR))
		DBWriteContactSettingByte(0, MODULE, "AVLayout", (BYTE)options.av_layout);
	DBWriteContactSettingDword(0, MODULE, "AVSize", options.av_size);
	DBWriteContactSettingDword(0, MODULE, "TextIndent", options.text_indent);
	DBWriteContactSettingByte(0, MODULE, "GlobalHover", (options.global_hover ? 1 : 0));
	DBWriteContactSettingByte(0, MODULE, "TimeLayout", (BYTE)options.time_layout);

	char buff[128];
	for(int i = 0; i < 9; i++) {
		sprintf(buff, "DisableStatus%d", i - 1);
		DBWriteContactSettingByte(0, MODULE, buff, options.disable_status[i] ? 1 : 0);
	}
	DBWriteContactSettingByte(0, MODULE, "DisableFullScreen", (options.disable_full_screen ? 1 : 0));
	DBWriteContactSettingByte(0, MODULE, "DropShadow", (options.drop_shadow ? 1 : 0));
	DBWriteContactSettingDword(0, MODULE, "SidebarWidth", options.sb_width);
	DBWriteContactSettingDword(0, MODULE, "Padding", options.padding);
	DBWriteContactSettingDword(0, MODULE, "AvatarPadding", options.av_padding);
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:31,代码来源:options.cpp

示例6: ModulesLoaded

int ModulesLoaded(WPARAM wParam, LPARAM lParam) 
{
	InitFonts();
	InitUpdaterSupport();

	hAvChangeEvent = HookEvent(ME_AV_AVATARCHANGED, AvatarChanged);
	hShowTipEvent = HookEvent(ME_CLC_SHOWINFOTIP, ShowTipHook);
	hHideTipEvent = HookEvent(ME_CLC_HIDEINFOTIP, HideTipHook);
	hAckEvent = HookEvent(ME_PROTO_ACK, ProtoAck);

	hFramesSBShow = HookEvent(ME_CLIST_FRAMES_SB_SHOW_TOOLTIP, FramesShowSBTip);
	hFramesSBHide = HookEvent(ME_CLIST_FRAMES_SB_HIDE_TOOLTIP, FramesHideSBTip);

	hFolderChanged = HookEvent(ME_FOLDERS_PATH_CHANGED, ReloadSkinFolder);

	hSkinFolder = FoldersRegisterCustomPathT(MODULE, "Tipper skins", MIRANDA_PATHT _T("\\") _T(DEFAULT_SKIN_FOLDER));
	FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, SIZEOF(SKIN_FOLDER), _T(DEFAULT_SKIN_FOLDER));

	InitTipperSmileys();
	LoadOptions(); 
	ReloadFont(0, 0);
	ParseSkinFile(opt.szSkinName, true, false);

	// set 'time-in'
	CallService(MS_CLC_SETINFOTIPHOVERTIME, opt.iTimeIn, 0);

	// set Miranda start timestamp
	DBWriteContactSettingDword(0, MODULE, "MirandaStartTS", (DWORD)time(0));

	// get MetaContacts module name
	if (ServiceExists(MS_MC_GETPROTOCOLNAME))
		strcpy(szMetaModuleName, (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0));

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

示例7: write_ping_address

void write_ping_address(PINGADDRESS *i) {
	bool is_contact = (bool)(CallService(MS_DB_CONTACT_IS, (WPARAM)i->hContact, 0) != 0);

	if(!is_contact) {
		//MessageBox(0, "Creating contact", "Ping", MB_OK);
		i->hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0);
		CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )i->hContact, ( LPARAM )PROTO );	
		CallService(MS_IGNORE_IGNORE, (WPARAM)i->hContact, (WPARAM)IGNOREEVENT_USERONLINE);
	}
	DBWriteContactSettingString(i->hContact, PROTO, "Address", i->pszName);
	set_changing_clist_handle(TRUE);
	DBWriteContactSettingString(i->hContact, "CList", "MyHandle", i->pszLabel);
	set_changing_clist_handle(FALSE);
	DBWriteContactSettingString(i->hContact, PROTO, "Nick", i->pszLabel);
	DBWriteContactSettingWord(i->hContact, PROTO, "Status", i->status);
	DBWriteContactSettingDword(i->hContact, PROTO, "Port", i->port);
	DBWriteContactSettingString(i->hContact, PROTO, "Proto", i->pszProto);
	if(strlen(i->pszCommand))
		DBWriteContactSettingString(i->hContact, PROTO, "Command", i->pszCommand);
	else
		DBDeleteContactSetting(i->hContact, PROTO, "Command");
	if(strlen(i->pszParams))
		DBWriteContactSettingString(i->hContact, PROTO, "CommandParams", i->pszParams);
	else
		DBDeleteContactSetting(i->hContact, PROTO, "CommandParams");
	DBWriteContactSettingWord(i->hContact, PROTO, "SetStatus", i->set_status);
	DBWriteContactSettingWord(i->hContact, PROTO, "GetStatus", i->get_status);
	DBWriteContactSettingWord(i->hContact, PROTO, "Index", i->index);
	if(strlen(i->pszCListGroup))
		DBWriteContactSettingString(i->hContact, "CList", "Group", i->pszCListGroup);
	else
		DBDeleteContactSetting(i->hContact, "CList", "Group");
}
开发者ID:darkscout,项目名称:sje-miranda-plugins,代码行数:33,代码来源:pinglist.cpp

示例8: getSettingName

void MirandaSkinnedDialog::setSettting(const char *name, int val, bool global)
{
	char setting[SETTING_NAME_SIZE];
	getSettingName(setting, name, global);

	DBWriteContactSettingDword(NULL, getModule(), setting, val);
}
开发者ID:Robyer,项目名称:miranda-plugins,代码行数:7,代码来源:MirandaSkinnedDialog.cpp

示例9: ForkThread

int FacebookProto::RemoveFriend(WPARAM wParam,LPARAM lParam)
{
	if (wParam == NULL)
	{ // self contact
	//	CallService(MS_UTILS_OPENURL,1,reinterpret_cast<LPARAM>(FACEBOOK_URL_PROFILE));
		return 0;
	}
	
	if (isOffline())
		return 0;

	if (MessageBox( 0, TranslateT("Are you sure?"), TranslateT("Delete contact from server list"), MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2 ) != IDYES)
		return 0;

	HANDLE hContact = reinterpret_cast<HANDLE>(wParam);

	DBVARIANT dbv;			
	if( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) )
	{
		if (!isOffline()) {
			std::string* id = new std::string(dbv.pszVal);
			ForkThread( &FacebookProto::DeleteContactFromServer, this, ( void* )id );
			DBFreeVariant(&dbv);

			if ( !DBGetContactSettingDword(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, 0) )
				DBWriteContactSettingDword(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, ::time(NULL));
		}
	}

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

示例10: addWindow

static void addWindow(HANDLE hContact) 
{
	CLISTFrame Frame = {0};
	HWND hWnd;
	DBVARIANT dbv;
	char winname[512];
	DWORD frameID;

	DBGetContactSettingString(hContact, WEATHERPROTONAME, "Nick", &dbv);
	mir_snprintf(winname, sizeof(winname), "Weather: %s", dbv.pszVal);
	DBFreeVariant(&dbv);

	hWnd = CreateWindow("WeatherFrame", "", WS_CHILD | WS_VISIBLE, 
		0, 0, 10, 10, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL, hInst, hContact);

	Frame.name = winname;
	Frame.cbSize = sizeof(Frame);
	Frame.hWnd = hWnd;
	Frame.align = alBottom;
	Frame.Flags = F_VISIBLE|F_NOBORDER;
	Frame.height = 32;

	WindowList_Add(hMwinWindowList, hWnd, hContact);

	frameID = CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&Frame, 0);
	DBWriteContactSettingDword(hContact, WEATHERPROTONAME, "mwin", frameID);
	DBWriteContactSettingByte(hContact, "CList", "Hidden", TRUE);
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:28,代码来源:weather_mwin.c

示例11: Convert

static BOOL Convert(HANDLE hContact, char* module, char* setting, int value, int toType) // 0 = byte, 1 = word, 2 = dword, 3 = string
{
    int Result = 1;
	char temp[64];

	switch (toType)
	{
		case 0:
			if (value > 0xFF)
				Result = 0;
			else
				DBWriteContactSettingByte(hContact, module, setting, (BYTE)value);
		break;
		case 1:
			if (value > 0xFFFF)
				Result = 0;
			else
				DBWriteContactSettingWord(hContact, module, setting, (WORD)value);
		break;
		case 2:
			DBWriteContactSettingDword(hContact, module, setting, (DWORD)value);
		break;
		case 3:
			DBDeleteContactSetting(hContact, module, setting);
			DBWriteContactSettingString(hContact, module, setting, itoa(value,temp,10));
		break;
	}
	return Result;
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:29,代码来源:addeditsettingsdlg.cpp

示例12: UpgradeCheck

void UpgradeCheck(void)
{
    DWORD dwVersion = DBGetContactSettingDword(NULL, "Chat", "OldVersion", PLUGIN_MAKE_VERSION(0,2,9,9));
    if (	pluginInfo.version > dwVersion)
    {
        if (dwVersion < PLUGIN_MAKE_VERSION(0,3,0,0))
        {
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font18");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font18Col");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font18Set");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font18Size");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font18Sty");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font19");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font19Col");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font19Set");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font19Size");
            DBDeleteContactSetting(NULL, "ChatFonts",	"Font19Sty");
            DBDeleteContactSetting(NULL, "Chat",		"ColorNicklistLines");
            DBDeleteContactSetting(NULL, "Chat",		"NicklistIndent");
            DBDeleteContactSetting(NULL, "Chat",		"NicklistRowDist");
            DBDeleteContactSetting(NULL, "Chat",		"ShowFormatButtons");
            DBDeleteContactSetting(NULL, "Chat",		"ShowLines");
            DBDeleteContactSetting(NULL, "Chat",		"ShowName");
            DBDeleteContactSetting(NULL, "Chat",		"ShowTopButtons");
            DBDeleteContactSetting(NULL, "Chat",		"SplitterX");
            DBDeleteContactSetting(NULL, "Chat",		"SplitterY");
            DBDeleteContactSetting(NULL, "Chat",		"IconFlags");
            DBDeleteContactSetting(NULL, "Chat",		"LogIndentEnabled");
        }
    }

    DBWriteContactSettingDword(NULL, "Chat", "OldVersion", pluginInfo.version);
}
开发者ID:raoergsls,项目名称:miranda,代码行数:33,代码来源:main.c

示例13: SaveTree

static int SaveTree(HWND hwndDlg)
{
	TVITEM tvi;
	int count;
	TCHAR idstr[100];
	char menuItemName[256], DBString[256], MenuNameItems[256];
	int menupos;
	int MenuObjectId, runtimepos;
	TIntMenuObject* pimo;
	MenuItemOptData* iod;
	HWND hTree = GetDlgItem( hwndDlg, IDC_MENUITEMS );

	if ( !GetCurrentMenuObjectID( hwndDlg, &MenuObjectId ))
		return 0;

	tvi.hItem = TreeView_GetRoot( hTree );
	tvi.cchTextMax = 99;
	tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_HANDLE;
	tvi.pszText = idstr;
	count = 0;

	menupos = GetMenuObjbyId( MenuObjectId );
	if ( menupos == -1 )
		return -1;

	pimo = g_menus[menupos];

	mir_snprintf( MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->Name);
	runtimepos = 100;

	while ( tvi.hItem != NULL ) {
		TreeView_GetItem( hTree, &tvi );
		iod = ( MenuItemOptData* )tvi.lParam;
		if ( iod->pimi ) {
			GetMenuItemName( iod->pimi, menuItemName, sizeof( menuItemName ));

			mir_snprintf( DBString, SIZEOF(DBString), "%s_visible", menuItemName );
			DBWriteContactSettingByte( NULL, MenuNameItems, DBString, iod->show );

			mir_snprintf( DBString, SIZEOF(DBString), "%s_pos", menuItemName );
			DBWriteContactSettingDword( NULL, MenuNameItems, DBString, runtimepos );

			mir_snprintf( DBString, SIZEOF(DBString), "%s_name", menuItemName );
			if ( lstrcmp( iod->name, iod->defname ) != 0 )
				DBWriteContactSettingTString( NULL, MenuNameItems, DBString, iod->name );
			else
				DBDeleteContactSetting( NULL, MenuNameItems, DBString );

			runtimepos += 100;
		}

		if ( iod->name && !_tcscmp( iod->name, STR_SEPARATOR) && iod->show )
			runtimepos += SEPARATORPOSITIONINTERVAL;

		tvi.hItem = TreeView_GetNextSibling( hTree, tvi.hItem );
		count++;
	}
	return 1;
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:59,代码来源:genmenuopt.cpp

示例14: Unignore

static INT_PTR Unignore(WPARAM wParam,LPARAM lParam)
{
	DWORD mask=GetMask((HANDLE)wParam);
	if((lParam<1 || lParam>IGNOREEVENT_MAX) && lParam!=IGNOREEVENT_ALL) return 1;
	if(lParam==IGNOREEVENT_ALL) mask=0;
	else mask&=~(1<<(lParam-1));
	DBWriteContactSettingDword((HANDLE)wParam,"Ignore","Mask1",mask);
	return 0;
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:9,代码来源:ignore.cpp

示例15: sttSaveAvatar

static int sttSaveAvatar()
{
	FILE* in;
	SHA1Context sha;
//	MD5Context md5;
	unsigned char buf[ 512 ];
	char tFileName[ MAX_PATH ];
	int i, pictureType;
	int bIsFirst = 1;
	struct _stat statbuf;
	uint8_t digest[20];

	if (_stat(szFileName, &statbuf)) return 1;
	if (statbuf.st_size > 6 * 1024) return 1;
	
	TlenGetAvatarFileName( NULL, tFileName, sizeof tFileName );
	if ( CopyFileA( szFileName, tFileName, FALSE ) == FALSE ) {
		JabberLog( "Copy failed with error %d", GetLastError() );
		return 1;
	}
	SHA1Reset(&sha);
//	md5_init(&md5);
	in = fopen( tFileName, "rb" );
	if ( in == NULL )
		return 1;

	while( !feof( in )) {
		int bytes = fread( buf, 1, sizeof buf, in );
		if ( bIsFirst ) {
			pictureType = JabberGetPictureType( buf );
			bIsFirst = 0;
		}
		SHA1Input(&sha, buf, bytes);
//		md5_update(&md5, buf, bytes);
	}
	fclose( in );
	if ( pictureType == PA_FORMAT_UNKNOWN )
		return 1;
	SHA1Result(&sha, digest);
//	md5_finalize(&md5);
	for (i=0;i<20;i++) {
//		unsigned int val = (md5.state[i>>2] >> 8*(i%4)) & 0xFF;
		sprintf( buf+( i<<1 ), "%02x", digest[i]);
	}
	DBWriteContactSettingString(NULL, jabberProtoName, "AvatarHash", buf);
	DBWriteContactSettingDword(NULL, jabberProtoName, "AvatarFormat", pictureType);
	if (userAvatarHash != NULL) {
		free (userAvatarHash);
		userAvatarHash = NULL;
	}
	userAvatarHash = strdup(buf);
	userAvatarFormat = pictureType;
	TlenGetAvatarFileName(NULL, szFileName, MAX_PATH);
	if ( strcmp( szFileName, tFileName ))
		MoveFileA( tFileName, szFileName );
	return 0;
}
开发者ID:BackupTheBerlios,项目名称:mtlen-svn,代码行数:57,代码来源:tlen_userinfo.c


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