コード例 #1
0
ファイル: main.cpp プロジェクト: MrtsComputers/miranda-ng
int GetValueW(HANDLE hContact, const char* szModule, const char* szSetting, WCHAR* Value, int length)
{
	DBVARIANT dbv = { 0 };
	WCHAR *wc;
	int len;

	if (Value && length >= 10 && !GetSetting(hContact, szModule, szSetting, &dbv)) {
		switch (dbv.type) {
		case DBVT_UTF8:
			len = (int)strlen(dbv.pszVal) + 1;
			wc = (WCHAR*)_alloca(length*sizeof(WCHAR));
			MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, len);
			wcsncpy((WCHAR*)Value, wc, length);
			break;

		case DBVT_ASCIIZ:
			len = (int)strlen(dbv.pszVal) + 1;
			wc = (WCHAR*)_alloca(len*sizeof(WCHAR));
			MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, wc, len);
			wcsncpy((WCHAR*)Value, wc, length);
			break;

		case DBVT_DWORD:
			_itow(dbv.dVal, Value, 10);
			break;

		case DBVT_BYTE:
			_itow(dbv.bVal, Value, 10);
			break;

		case DBVT_WORD:
			_itow(dbv.wVal, Value, 10);
			break;
		}

		db_free(&dbv);

		Value[length - 1] = 0;
		return 1;
	}

	if (Value)
		Value[0] = 0;

	return 0;
}
コード例 #2
0
ファイル: mir_options.cpp プロジェクト: kmdtukl/miranda-ng
static TCHAR* MyDBGetContactSettingTString(MCONTACT hContact, char* module, char* setting, TCHAR* out, size_t len, TCHAR *def)
{
	DBVARIANT dbv = { 0 };

	out[0] = _T('\0');

	if (!db_get_ts(hContact, module, setting, &dbv)) {
		mir_tstrncpy(out, dbv.ptszVal, (int)len);
		db_free(&dbv);
	}
	else {
		if (def != NULL)
			mir_tstrncpy(out, def, (int)len);
	}

	return out;
}
コード例 #3
0
ファイル: data.cpp プロジェクト: ybznek/miranda-ng
TCHAR *Protocol::GetListeningTo()
{
	if (!CanGetListeningTo()) {
		lcopystr(listening_to, _T(""), _countof(listening_to));
		return listening_to;
	}

	DBVARIANT dbv = { 0 };
	if (db_get_ts(NULL, name, "ListeningTo", &dbv)) {
		lcopystr(listening_to, _T(""), _countof(listening_to));
		return listening_to;
	}

	lcopystr(listening_to, dbv.ptszVal, _countof(listening_to));
	db_free(&dbv);
	return listening_to;
}
コード例 #4
0
ファイル: clist.cpp プロジェクト: 0xmono/miranda-ng
MCONTACT CIrcProto::CList_SetOffline(CONTACT *user)
{
	MCONTACT hContact = CList_FindContact(user);
	if (hContact) {
		DBVARIANT dbv;
		if (!getTString(hContact, "Default", &dbv)) {
			setString(hContact, "User", "");
			setString(hContact, "Host", "");
			setTString(hContact, "Nick", dbv.ptszVal);
			setWord(hContact, "Status", ID_STATUS_OFFLINE);
			db_free(&dbv);
			return hContact;
		}
	}

	return 0;
}
コード例 #5
0
static void CheckUpdate()
{
	// already converted?
	int compat = db_get_b(NULL, "Compatibility", "TabChatFonts", 0);
	if (compat >= 3)
		return;

	if (compat == 0) {
		LIST<char> szSettings(120);

		DBCONTACTENUMSETTINGS dbces = { 0 };
		dbces.szModule = CHAT_OLDFONTMODULE;
		dbces.pfnEnumProc = CopyChatSetting;
		dbces.lParam = (LPARAM)&szSettings;
		CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);

		DBVARIANT dbv;
		for (int i = szSettings.getCount() - 1; i >= 0; i--) {
			char *p = szSettings[i];
			db_get(NULL, CHAT_OLDFONTMODULE, p, &dbv);
			db_set(NULL, CHATFONT_MODULE, p, &dbv);
			db_free(&dbv);
			mir_free(p);
		}

		CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)CHAT_OLDFONTMODULE);
		compat++;
	}

	if (compat == 1) {
		DWORD oldBackColor = db_get_dw(0, FONTMODULE, "BkgColourMUC", SRMSGDEFSET_BKGCOLOUR);
		db_set_dw(NULL, CHAT_MODULE, "ColorLogBG", oldBackColor);
		db_unset(0, FONTMODULE, "BkgColourMUC");
		compat++;
	}

	if (compat == 2) {
		COLORREF color0 = M.GetDword(CHAT_MODULE, "NickColor2", 0);
		COLORREF color2 = M.GetDword(CHAT_MODULE, "NickColor0", 0);
		db_set_dw(NULL, CHAT_MODULE, "NickColor0", color0);
		db_set_dw(NULL, CHAT_MODULE, "NickColor2", color2);
		compat++;
	}

	db_set_b(NULL, "Compatibility", "TabChatFonts", 3);
}
コード例 #6
0
ファイル: main.c プロジェクト: AndrienkoF/KPIRepo
int main(){
	const int size = 4;
	leadingList_t * newLeadingList = leadingList_new(size);
	db_t * newDb = db_new("database.db");

	int countSize = db_getSize(newDb);

	leading_t * newLeading;

	db_readList(newDb, newLeadingList);
	leadingList_print(newLeadingList);

	leading_free(newLeading );
	leadingList_free(newLeadingList);
	db_free(newDb);
    return 0;
}
コード例 #7
0
ファイル: proto.cpp プロジェクト: Seldom/miranda-ng
void TwitterProto::SendSuccess(void *p)
{
	if (p == 0)
		return;
	send_direct *data = static_cast<send_direct*>(p);

	DBVARIANT dbv;
	if (!db_get_s(data->hContact, m_szModuleName, TWITTER_KEY_UN, &dbv)) {
		mir_cslock s(twitter_lock_);
		twit_.send_direct(dbv.pszVal, data->msg);

		ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)data->msgid, 0);
		db_free(&dbv);
	}

	delete data;
}
コード例 #8
0
void __cdecl GGPROTO::getawaymsgthread(void *arg)
{
	DBVARIANT dbv;

	MCONTACT hContact = (MCONTACT) arg;
	debugLogA("getawaymsgthread(): started");
	gg_sleep(100, FALSE, "getawaymsgthread", 106, 1);
	if (!db_get_s(hContact, "CList", GG_KEY_STATUSDESCR, &dbv, DBVT_TCHAR))
	{
		ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal);
		debugLog(_T("getawaymsgthread(): Reading away msg <%s>."), dbv.ptszVal);
		db_free(&dbv);
	} else {
		ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0);
	}
	debugLogA("getawaymsgthread(): end");
}
コード例 #9
0
ファイル: utils.cpp プロジェクト: Seldom/miranda-ng
short int isDbZero(MCONTACT hContact, const char *module_name, const char *setting_name)
{
	DBVARIANT dbv;
	if (!db_get(hContact, module_name, setting_name, &dbv)) {
		short int res = 0;
		switch (dbv.type) {
			case DBVT_BYTE: res = dbv.bVal == 0; break;
			case DBVT_WORD: res = dbv.wVal == 0; break;
			case DBVT_DWORD: res = dbv.dVal == 0; break;
			case DBVT_BLOB: res = dbv.cpbVal == 0; break;
			default: res = dbv.pszVal[0] == 0; break;
		}
		db_free(&dbv);
		return res;
	}
	return -1;
}
コード例 #10
0
char *TemplateHTMLBuilder::getAvatar(MCONTACT hContact, const char* szProto)
{
	DBVARIANT dbv;
	TCHAR tmpPath[MAX_PATH];
	TCHAR *result = NULL;

	if (Options::getAvatarServiceFlags() == Options::AVATARSERVICE_PRESENT) {
		struct avatarCacheEntry *ace = NULL;
		if (hContact == NULL) {
			ace = (struct avatarCacheEntry *)CallService(MS_AV_GETMYAVATAR, 0, (LPARAM)szProto);
		} else {
			ace = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, hContact, 0);
		}
		if (ace!=NULL) {
			if ( ace->cbSize == sizeof(avatarCacheEntry))
				result = ace->szFilename;
			else {
				// compatibility: in M0.9 it will always be char*
				MultiByteToWideChar( CP_ACP, 0, (char*)ace->szFilename, -1, tmpPath, SIZEOF(tmpPath));
				
			}
		}
	}
	if (!db_get_ts(hContact, "ContactPhoto", "File", &dbv)) {
		if (_tcslen(dbv.ptszVal) > 0) {
			TCHAR* ext = _tcsrchr(dbv.ptszVal, '.');
			if (ext && lstrcmpi(ext, _T(".xml")) == 0) {
				result = ( TCHAR* )getFlashAvatar(dbv.ptszVal, (hContact == NULL) ? 1 : 0);
			} else {
				if (result == NULL) {
					/* relative -> absolute */
					_tcscpy (tmpPath, dbv.ptszVal);
					if ( _tcsncmp(tmpPath, _T("http://"), 7))
						PathToAbsoluteT(dbv.ptszVal, tmpPath);

					result = tmpPath;
				}
			}
		}
		db_free(&dbv);
	}
	char* res = mir_utf8encodeT(result);
	Utils::convertPath(res);
	return res;
}
コード例 #11
0
ファイル: service.c プロジェクト: 0xmono/miranda-ng
static int
service_contact_channel_settings(WPARAM wParam, LPARAM lParam)
{
	HANDLE hContact = (HANDLE)wParam;
	if(hContact && contacts_is_chatroom_contact(hContact)) {
		DBVARIANT dbv;
		if(!db_get(hContact, VQCHAT_PROTO, "Nick", &dbv)) {
			/* show channel settings (skip '#' at the beginning) */
			char * channel = util_loc2utf(dbv.pszVal + 1);
			chatroom_channel_show_settings_dlg(channel);

			free(channel);
			db_free(&dbv);
		}
	}

	return 0;
}
コード例 #12
0
int WhatsAppProto::RequestFriendship(WPARAM wParam, LPARAM lParam)
{
    if (wParam == NULL || isOffline())
        return 0;

    MCONTACT hContact = MCONTACT(wParam);

    DBVARIANT dbv;
    if ( !getString(hContact, WHATSAPP_KEY_ID, &dbv))
    {
        std::string id(dbv.pszVal);
        this->connection->sendQueryLastOnline(id);
        this->connection->sendPresenceSubscriptionRequest(id);
        db_free(&dbv);
    }

    return 0;
}
コード例 #13
0
ファイル: xsn_main.cpp プロジェクト: kmdtukl/miranda-ng
static int ProcessEvent(WPARAM hContact, LPARAM lParam)
{
	if (!isReceiveMessage(lParam))
		return 0;

	isIgnoreSound = db_get_b(hContact, SETTINGSNAME, SETTINGSIGNOREKEY, 0);
	DBVARIANT dbv;
	if (!isIgnoreSound && !db_get_ts(hContact, SETTINGSNAME, SETTINGSKEY, &dbv)) {
		TCHAR PlaySoundPath[MAX_PATH] = { 0 };
		PathToAbsoluteT(dbv.ptszVal, PlaySoundPath);
		isOwnSound = 0;
		SkinPlaySoundFile(PlaySoundPath);
		db_free(&dbv);
		isOwnSound = 1;
	}

	return 0;
}
コード例 #14
0
ファイル: filerecvdlg.cpp プロジェクト: Ganster41/miranda-ng
void GetReceivedFilesDir(TCHAR *szDir, int cchDir)
{
	TCHAR szTemp[MAX_PATH]; szTemp[0] = 0;

	DBVARIANT dbv;
	if (!db_get_ts(NULL, "SRFile", "RecvFilesDirAdv", &dbv)) {
		if (lstrlen(dbv.ptszVal) > 0)
			lstrcpyn(szTemp, dbv.ptszVal, SIZEOF(szTemp));
		db_free(&dbv);
	}

	if (!szTemp[0])
		mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%mydocuments%%\\%s"), TranslateT("My received files"));

	patchDir(szTemp, SIZEOF(szTemp));
	RemoveInvalidPathChars(szTemp);
	lstrcpyn(szDir, szTemp, cchDir);
}
コード例 #15
0
ファイル: main.cpp プロジェクト: truefriend-cz/miranda-ng
INT_PTR AddToPounce(WPARAM wParam, LPARAM lParam)
{
	MCONTACT hContact = wParam;
	TCHAR* message = (TCHAR*)lParam;
	DBVARIANT dbv;
	if (!db_get_ts(hContact, modname, "PounceMsg",&dbv))
	{
		TCHAR* newPounce = (TCHAR*)mir_alloc(mir_tstrlen(dbv.ptszVal) + mir_tstrlen(message) + 1);
		if (!newPounce) return 1;
		mir_tstrcpy(newPounce, dbv.ptszVal);
		mir_tstrcat(newPounce, message);
		db_set_ws(hContact, modname, "PounceMsg", newPounce);
		mir_free(newPounce);
		db_free(&dbv);
	}
	else AddSimpleMessage(hContact, (LPARAM)message);
	return 0;
}
コード例 #16
0
ファイル: proto.cpp プロジェクト: Ganster41/miranda-ng
int __cdecl CYahooProto::UserIsTyping(MCONTACT hContact, int type)
{
	if (!m_bLoggedIn)
		return 0;

	char *szProto = GetContactProto(hContact);
	if (szProto == NULL || strcmp(szProto, m_szModuleName))
		return 0;

	DBVARIANT dbv;
	if (!getString(hContact, YAHOO_LOGINID, &dbv)) {
		if (type == PROTOTYPE_SELFTYPING_OFF || type == PROTOTYPE_SELFTYPING_ON) {
			sendtyping(dbv.pszVal, getWord(hContact, "yprotoid", 0), type == PROTOTYPE_SELFTYPING_ON ? 1 : 0);
		}
		db_free(&dbv);
	}
	return 0;
}
コード例 #17
0
ファイル: proto.cpp プロジェクト: martok/miranda-ng
int __cdecl CAimProto::UserIsTyping(MCONTACT hContact, int type)
{
	if (state != 1) return 0;

	if (getWord(hContact, AIM_KEY_ST, ID_STATUS_OFFLINE) == ID_STATUS_ONTHEPHONE)
		return 0;

	DBVARIANT dbv;
	if (!getBool(hContact, AIM_KEY_BLS, false) && !getString(hContact, AIM_KEY_SN, &dbv))
	{
		if (type == PROTOTYPE_SELFTYPING_ON)
			aim_typing_notification(hServerConn, seqno, dbv.pszVal, 0x0002);
		else if (type == PROTOTYPE_SELFTYPING_OFF)
			aim_typing_notification(hServerConn, seqno, dbv.pszVal, 0x0000);
		db_free(&dbv);
	}
	return 0;
}
コード例 #18
0
ファイル: game.c プロジェクト: revarbat/fuzzball
int
init_game(const char *infile, const char *outfile)
{
	FILE *f;

	if ((f = fopen(MACRO_FILE, "rb")) == NULL)
		log_status("INIT: Macro storage file %s is tweaked.", MACRO_FILE);
	else {
		macroload(f);
		fclose(f);
	}

	in_filename = (char *) string_dup(infile);
	if ((input_file = fopen(infile, "rb")) == NULL)
		return -1;

	db_free();
	init_primitives();			/* init muf compiler */
	mesg_init();				/* init mpi interpreter */
	SRANDOM(getpid());			/* init random number generator */

	/* ok, read the db in */
	log_status("LOADING: %s", infile);
	fprintf(stderr, "LOADING: %s\n", infile);
	if (db_read(input_file) < 0)
		return -1;
	log_status("LOADING: %s (done)", infile);
	fprintf(stderr, "LOADING: %s (done)\n", infile);

	/* set up dumper */
	if (dumpfile)
		free((void *) dumpfile);
	dumpfile = alloc_string(outfile);

	if (!db_conversion_flag) {
		/* initialize the _sys/startuptime property */
		add_property((dbref) 0, "_sys/startuptime", NULL, (int) time((time_t *) NULL));
		add_property((dbref) 0, "_sys/maxpennies", NULL, tp_max_pennies);
		add_property((dbref) 0, "_sys/dumpinterval", NULL, tp_dump_interval);
		add_property((dbref) 0, "_sys/max_connects", NULL, 0);
	}

	return 0;
}
コード例 #19
0
ファイル: services.cpp プロジェクト: truefriend-cz/miranda-ng
int CAimProto::OnDbSettingChanged(WPARAM hContact, LPARAM lParam)
{
	DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;

	if (mir_strcmp(cws->szModule, MOD_KEY_CL) == 0 && m_state == 1 && hContact) {
		if (mir_strcmp(cws->szSetting, AIM_KEY_NL) == 0) {
			if (cws->value.type == DBVT_DELETED) {
				DBVARIANT dbv;
				if (!db_get_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0]) {
					add_contact_to_group(hContact, dbv.pszVal);
					db_free(&dbv);
				}
				else
					add_contact_to_group(hContact, AIM_DEFAULT_GROUP);
			}
		}
		else if (mir_strcmp(cws->szSetting, "MyHandle") == 0) {
			char *name;
			switch (cws->value.type) {
			case DBVT_DELETED:
				set_local_nick(hContact, NULL, NULL);
				break;

			case DBVT_ASCIIZ:
				name = mir_utf8encode(cws->value.pszVal);
				set_local_nick(hContact, name, NULL);
				mir_free(name);
				break;

			case DBVT_UTF8:
				set_local_nick(hContact, cws->value.pszVal, NULL);
				break;

			case DBVT_WCHAR:
				name = mir_utf8encodeW(cws->value.pwszVal);
				set_local_nick(hContact, name, NULL);
				mir_free(name);
				break;
			}
		}
	}

	return 0;
}
コード例 #20
0
ファイル: contacts.cpp プロジェクト: martok/miranda-ng
MCONTACT find_contactT(TCHAR *name)
{
	int tCompareResult;
	DBVARIANT dbv;

	// already on list?
	for (MCONTACT hContact = db_find_first(SKYPE_PROTONAME); hContact != NULL; hContact = db_find_next(hContact,SKYPE_PROTONAME))
	{
		if (db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0)
		{
			if (db_get_ts(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) continue;
			tCompareResult = _tcscmp(dbv.ptszVal, name);
			db_free(&dbv);
			if (tCompareResult) continue;
			return hContact; // already there, return handle
		}
	}
	return NULL;
}
コード例 #21
0
void CYahooProto::ext_got_picture_upload(const char *me, const char *url, unsigned int ts)
{
	int cksum = 0;
	DBVARIANT dbv;

	LOG(("[ext_yahoo_got_picture_upload] url: %s timestamp: %d", url, ts));

	if (!url) {
		LOG(("[ext_yahoo_got_picture_upload] Problem with upload?"));
		return;
	}


	cksum = getDword("TMPAvatarHash", 0);
	if (cksum != 0) {
		LOG(("[ext_yahoo_got_picture_upload] Updating Checksum to: %d", cksum));
		setDword("AvatarHash", cksum);
		delSetting("TMPAvatarHash");

		// This is only meant for message sessions, but we don't got those in miranda yet
		//YAHOO_bcast_picture_checksum(cksum);
		yahoo_send_picture_checksum(m_id, NULL, cksum);

		// need to tell the stupid Yahoo that our icon updated
		//YAHOO_bcast_picture_update(2);
	}
	else
		cksum = getDword("AvatarHash", 0);

	setString("AvatarURL", url);
	//YAHOO_SetDword("AvatarExpires", ts);

	if (!getString("AvatarInv", &dbv)) {
		LOG(("[ext_yahoo_got_picture_upload] Buddy: %s told us this is bad??", dbv.pszVal));

		LOG(("[ext_yahoo_got_picture] Sending url: %s checksum: %d to '%s'!", url, cksum, dbv.pszVal));
		//void yahoo_send_picture_info(int id, const char *me, const char *who, const char *pic_url, int cksum)
		yahoo_send_picture_info(m_id, dbv.pszVal, 2, url, cksum);

		delSetting("AvatarInv");
		db_free(&dbv);
	}
}
コード例 #22
0
ファイル: main.c プロジェクト: josephg/sharedb
int main(int argc, const char *argv[]) {
  database db;
  db_init(&db);
  
  uv_loop_t *loop = uv_default_loop();
  uv_tcp_t server = {};
  net_listen(&server, &db, loop, 8766);
  
  uv_timer_t t;
  uv_timer_init(loop, &t);
//  uv_timer_start(&t, timer_cb, 0, 1000);
  
  printf("Listening on port 8766\n");
  
  uv_set_process_title("shared");
  uv_run(loop);
  
  db_free(&db);
}
コード例 #23
0
ファイル: utils.cpp プロジェクト: biddyweb/miranda-ng
int GetStringFromDatabase(char *szSettingName, const wchar_t *szError, TCHAR *szResult, size_t size)
{
	size_t len;
	DBVARIANT dbv;
	if (db_get_ws(NULL, ModuleName, szSettingName, &dbv) == 0) {
		size_t tmp = _tcslen(dbv.ptszVal);
		len = (tmp < size - 1) ? tmp : size - 1;
		_tcsncpy(szResult, dbv.ptszVal, len);
		szResult[len] = '\0';
		db_free(&dbv);
		return 0;
	}

	size_t tmp = _tcslen(szError);
	len = (tmp < size - 1) ? tmp : size - 1;
	_tcsncpy(szResult, szError, len);
	szResult[len] = '\0';
	return 1;
}
コード例 #24
0
ファイル: weather_data.cpp プロジェクト: Seldom/miranda-ng
void DBDataManage(MCONTACT hContact, WORD Mode, WPARAM wParam, LPARAM)
{
	LIST<char> arSettings(10);

	// get all the settings and stored them in a temporary list
	DBCONTACTENUMSETTINGS dbces;
	dbces.lParam = (LPARAM)&arSettings;
	dbces.pfnEnumProc = GetWeatherDataFromDB;
	dbces.szModule = WEATHERCONDITION;
	CallService(MS_DB_CONTACT_ENUMSETTINGS, hContact, (LPARAM)&dbces);

	// begin deleting settings
	for (int i = arSettings.getCount() - 1; i >= 0; i--) {
		char *szSetting = arSettings[i];

		DBVARIANT dbv;
		if (!db_get_ts(hContact, WEATHERCONDITION, szSetting, &dbv)) {
			switch (Mode) {
			case WDBM_REMOVE:
				db_unset(hContact, WEATHERCONDITION, szSetting);
				break;

			case WDBM_DETAILDISPLAY:
				// skip the "WeatherInfo" variable
				if (!mir_strcmp(szSetting, "WeatherInfo") || !mir_strcmp(szSetting, "Ignore") || szSetting[0] == '#')
					continue;

				HWND hList = GetDlgItem((HWND)wParam, IDC_DATALIST);
				LV_ITEM lvi = { 0 };
				lvi.mask = LVIF_TEXT | LVIF_PARAM;
				lvi.lParam = i;
				lvi.pszText = TranslateTS(_A2T(szSetting));
				lvi.iItem = ListView_InsertItem(hList, &lvi);
				lvi.pszText = dbv.ptszVal;
				ListView_SetItemText(hList, lvi.iItem, 1, dbv.ptszVal);
				break;
			}
			db_free(&dbv);
		}
		mir_free(szSetting);
	}
}
コード例 #25
0
ファイル: services.cpp プロジェクト: truefriend-cz/miranda-ng
int CAimProto::OnWindowEvent(WPARAM, LPARAM lParam)
{
	MessageWindowEventData* msgEvData = (MessageWindowEventData*)lParam;

	if (msgEvData->uType == MSG_WINDOW_EVT_CLOSE) {
		if (m_state != 1 || !is_my_contact(msgEvData->hContact))
			return 0;

		if (getWord(msgEvData->hContact, AIM_KEY_ST, ID_STATUS_OFFLINE) == ID_STATUS_ONTHEPHONE)
			return 0;

		DBVARIANT dbv;
		if (!getBool(msgEvData->hContact, AIM_KEY_BLS, false) && !getString(msgEvData->hContact, AIM_KEY_SN, &dbv)) {
			if (_stricmp(dbv.pszVal, SYSTEM_BUDDY))
				aim_typing_notification(m_hServerConn, m_seqno, dbv.pszVal, 0x000f);
			db_free(&dbv);
		}
	}
	return 0;
}
コード例 #26
0
ファイル: renamemodule.cpp プロジェクト: tweimer/miranda-ng
int renameModule(MCONTACT hContact, const char *oldName, const char *newName)
{
	ModuleSettingLL settinglist;
	if (IsModuleEmpty(hContact, oldName) || !EnumSettings(hContact, oldName, &settinglist))
		return 0;

	int cnt = 0;

	for (ModSetLinkLinkItem *setting = settinglist.first; setting; setting = setting->next) {
		DBVARIANT dbv;
		if (!db_get_s(hContact, oldName, setting->name, &dbv, 0)) {
			db_set(hContact, newName, setting->name, &dbv);
			db_unset(hContact, oldName, setting->name);
			db_free(&dbv);
			cnt++;
		}
	}
	FreeModuleSettingLL(&settinglist);
	return cnt;
}
コード例 #27
0
ファイル: msn_chat.cpp プロジェクト: Seldom/miranda-ng
void CMsnProto::MSN_GCRefreshThreadsInfo(void)
{
	CMStringA buf;
	MCONTACT hContact;
	int nThreads = 0;

	for (hContact = db_find_first(m_szModuleName); hContact;
	hContact = db_find_next(hContact, m_szModuleName)) {
		if (isChatRoom(hContact) != 0) {
			DBVARIANT dbv;
			if (getString(hContact, "ChatRoomID", &dbv) == 0) {
				buf.AppendFormat("<thread><id>%s</id></thread>", dbv.pszVal);
				nThreads++;
				db_free(&dbv);
			}
		}
	}
	if (nThreads)
		msnNsThread->sendPacketPayload("GET", "MSGR\\THREADS", "<threads>%s</threads>", buf);
}
コード例 #28
0
ファイル: contacts.cpp プロジェクト: Seldom/miranda-ng
int TwitterProto::OnContactDeleted(WPARAM wParam, LPARAM)
{
	MCONTACT hContact = (MCONTACT)wParam;
	if (m_iStatus != ID_STATUS_ONLINE)
		return 0;

	if (!IsMyContact(hContact))
		return 0;

	DBVARIANT dbv;
	if (!getString(hContact, TWITTER_KEY_UN, &dbv)) {
		if (in_chat_)
			DeleteChatContact(dbv.pszVal);

		mir_cslock s(twitter_lock_);
		twit_.remove_friend(dbv.pszVal); // Be careful about this until Miranda is fixed
		db_free(&dbv);
	}
	return 0;
}
コード例 #29
0
ファイル: xstatus.cpp プロジェクト: MrtsComputers/miranda-ng
TCHAR *GetIcqXStatus(HANDLE hContact, char *szProto, char *szValue, TCHAR *buff, int bufflen)
{
	DBVARIANT dbv;
	buff[0] = 0;

	int statusID = db_get_b(hContact, szProto, "XStatusId", -1);
	if (statusID != -1) {
		if (!db_get_ts(hContact, szProto, szValue, &dbv)) {
			if ((strcmp(szValue, "XStatusName") == 0) && dbv.ptszVal[0] == 0)
				GetDefaultXstatusName(statusID, szProto, buff, bufflen);
			else
				_tcsncpy(buff, dbv.ptszVal, bufflen);

			buff[bufflen - 1] = 0;
			db_free(&dbv);
		}
	}

	return buff;
}
コード例 #30
0
/* Removes NotOnList settings from contacts with Delete setting present */
void RemoveNotOnListSettings()
{
	DBVARIANT dbv;
	char protoName[256] = {0};
	HANDLE hContact = db_find_first();
	strcpy(protoName, "proto_");
	while (hContact != NULL) {
		if (db_get_s(hContact, "Protocol", "p", &dbv) == 0) {
			strcat(protoName, dbv.pszVal);
			if (_getOptB(protoName, 0) != 0) {
				if (db_get_b(hContact, "CList", "Delete", 0) == 1) {
					db_unset(hContact, "CList", "NotOnList");
				}
			}
			db_free(&dbv);
		}
		protoName[6] = 0;
		hContact = db_find_next(hContact);
	}
}