diff options
Diffstat (limited to 'protocols/Tlen/src')
| -rw-r--r-- | protocols/Tlen/src/jabber_iqid.cpp | 14 | ||||
| -rw-r--r-- | protocols/Tlen/src/jabber_opt.cpp | 2 | ||||
| -rw-r--r-- | protocols/Tlen/src/jabber_thread.cpp | 19 | ||||
| -rw-r--r-- | protocols/Tlen/src/tlen.cpp | 24 | ||||
| -rw-r--r-- | protocols/Tlen/src/tlen_muc.cpp | 44 | ||||
| -rw-r--r-- | protocols/Tlen/src/tlen_picture.cpp | 12 | ||||
| -rw-r--r-- | protocols/Tlen/src/tlen_voice.cpp | 14 | 
7 files changed, 65 insertions, 64 deletions
diff --git a/protocols/Tlen/src/jabber_iqid.cpp b/protocols/Tlen/src/jabber_iqid.cpp index 4e39b0fe06..3a6cb87ec5 100644 --- a/protocols/Tlen/src/jabber_iqid.cpp +++ b/protocols/Tlen/src/jabber_iqid.cpp @@ -54,7 +54,7 @@ void JabberIqResultAuth(TlenProtocol *proto, XmlNode *iqNode)  		char text[128];
  		JabberSend(proto, "</s>");
 -		_snprintf(text, sizeof(text), "%s %s@%s.", TranslateT("Authentication failed for"), proto->threadData->username, proto->threadData->server);
 +		mir_snprintf(text, sizeof(text), "%s %s@%s.", TranslateT("Authentication failed for"), proto->threadData->username, proto->threadData->server);
  		MessageBoxA(NULL, text, Translate("Tlen Authentication"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
  		ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
  		proto->threadData = NULL;	// To disallow auto reconnect
 @@ -257,9 +257,9 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)  		if ((jid=JabberXmlGetAttrValue(itemNode, "jid")) != NULL) {
  			if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) return;
  			if (strchr(jid, '@') != NULL) {
 -				sprintf(text, "%s", jid);
 +				mir_snprintf(text, SIZEOF(text), "%s", jid);
  			} else {
 -				sprintf(text, "%s@%s", jid, dbv.pszVal);	// Add @tlen.pl
 +				mir_snprintf(text, SIZEOF(text),  "%s@%s", jid, dbv.pszVal);	// Add @tlen.pl
  			}
  			db_free(&dbv);
  			if ((hContact=JabberHContactFromJID(proto, text)) == NULL) {
 @@ -419,9 +419,9 @@ void JabberIqResultSearch(TlenProtocol *proto, XmlNode *iqNode)  				if (!strcmp(itemNode->name, "item")) {
  					if ((jid=JabberXmlGetAttrValue(itemNode, "jid")) != NULL) {
  						if (strchr(jid, '@') != NULL) {
 -							_snprintf(jsr.jid, sizeof(jsr.jid), "%s", jid);
 +							mir_snprintf(jsr.jid, sizeof(jsr.jid), "%s", jid);
  						} else {
 -							_snprintf(jsr.jid, sizeof(jsr.jid), "%s@%s", jid, dbv.pszVal);
 +							mir_snprintf(jsr.jid, sizeof(jsr.jid), "%s@%s", jid, dbv.pszVal);
  						}
  						jsr.jid[sizeof(jsr.jid)-1] = '\0';
  						jsr.hdr.id = mir_a2t(jid);
 @@ -467,9 +467,9 @@ void JabberIqResultSearch(TlenProtocol *proto, XmlNode *iqNode)  			if (proto->searchJID != NULL) {
  				if (!found) {
  					if (strchr(proto->searchJID, '@') != NULL) {
 -						_snprintf(jsr.jid, sizeof(jsr.jid), "%s", proto->searchJID);
 +						mir_snprintf(jsr.jid, sizeof(jsr.jid), "%s", proto->searchJID);
  					} else {
 -						_snprintf(jsr.jid, sizeof(jsr.jid), "%s@%s", proto->searchJID, dbv.pszVal);
 +						mir_snprintf(jsr.jid, sizeof(jsr.jid), "%s@%s", proto->searchJID, dbv.pszVal);
  					}
  					jsr.jid[sizeof(jsr.jid)-1] = '\0';
  					jsr.hdr.nick = mir_tstrdup(TEXT(""));
 diff --git a/protocols/Tlen/src/jabber_opt.cpp b/protocols/Tlen/src/jabber_opt.cpp index 7201c3d2b5..ccdb6369d9 100644 --- a/protocols/Tlen/src/jabber_opt.cpp +++ b/protocols/Tlen/src/jabber_opt.cpp @@ -636,7 +636,7 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,  					} else {
  						delay=GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE);
  					}
 -					_snprintf(title, sizeof(title), Translate("%s mail"), proto->m_szModuleName);
 +					mir_snprintf(title, sizeof(title), Translate("%s mail"), proto->m_szModuleName);
  					MailPopupPreview((DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0),
  									(DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0),
  									title,
 diff --git a/protocols/Tlen/src/jabber_thread.cpp b/protocols/Tlen/src/jabber_thread.cpp index 67499c7995..ab6130d1c5 100644 --- a/protocols/Tlen/src/jabber_thread.cpp +++ b/protocols/Tlen/src/jabber_thread.cpp @@ -72,7 +72,7 @@ static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa  	switch (msg) {
  	case WM_INITDIALOG:
  		TranslateDialogDefault(hwndDlg);
 -		sprintf(text, "%s %s", Translate("Enter password for"), (char *) lParam);
 +		mir_snprintf(text, SIZEOF(text), "%s %s", Translate("Enter password for"), (char *) lParam);
  		SetDlgItemTextA(hwndDlg, IDC_JID, text);
  		return TRUE;
  	case WM_COMMAND:
 @@ -204,7 +204,7 @@ void __cdecl JabberServerThread(ThreadData *info)  		return;
  	}
 -	_snprintf(jidStr, sizeof(jidStr), "%s@%s", info->username, info->server);
 +	mir_snprintf(jidStr, sizeof(jidStr), "%s@%s", info->username, info->server);
  	db_set_s(NULL, info->proto->m_szModuleName, "jid", jidStr);
  	if (!db_get(NULL, info->proto->m_szModuleName, "ManualHost", &dbv)) {
 @@ -401,7 +401,7 @@ static void TlenSendAuth(TlenProtocol *proto) {  	char *str;
  	char text[128];
  	str = TlenPasswordHash(proto->threadData->password);
 -	sprintf(text, "%s%s", proto->threadData->streamId, str);
 +	mir_snprintf(text, SIZEOF(text), "%s%s", proto->threadData->streamId, str);
  	mir_free(str);
  	str = JabberSha1(text);
  	if ((p=JabberTextEncode(proto->threadData->username)) != NULL) {
 @@ -624,8 +624,9 @@ static void JabberProcessMessage(XmlNode *node, ThreadData *info)  				if ((bodyNode=JabberXmlGetChild(node, "body")) != NULL) {
  					if (bodyNode->text != NULL) {
  						if ((subjectNode=JabberXmlGetChild(node, "subject")) != NULL && subjectNode->text != NULL && subjectNode->text[0] != '\0') {
 -							p = (char *) mir_alloc(strlen(subjectNode->text)+strlen(bodyNode->text)+5);
 -							sprintf(p, "%s\r\n%s", subjectNode->text, bodyNode->text);
 +							int size = strlen(subjectNode->text)+strlen(bodyNode->text)+5;
 +							p = (char *)mir_alloc(size);
 +							mir_snprintf(p, size, "%s\r\n%s", subjectNode->text, bodyNode->text);
  							localMessage = JabberTextDecode(p);
  							mir_free(p);
  						} else {
 @@ -962,7 +963,7 @@ static void TlenProcessW(XmlNode *node, ThreadData *info)  	if ((f=JabberXmlGetAttrValue(node, "f")) != NULL) {
  		char webContactName[128];
 -		sprintf(webContactName, Translate("%s Web Messages"), info->proto->m_szModuleName);
 +		mir_snprintf(webContactName, SIZEOF(webContactName), Translate("%s Web Messages"), info->proto->m_szModuleName);
  		if ((hContact=JabberHContactFromJID(info->proto, webContactName)) == NULL) {
  			hContact = JabberDBCreateContact(info->proto, webContactName, webContactName, TRUE);
  		}
 @@ -1260,7 +1261,7 @@ static void TlenProcessP(XmlNode *node, ThreadData *info)  			} else {
  				n = mir_strdup(Translate("Private conference"));// JabberNickFromJID(f);
  			}
 -			sprintf(jid, "%s/%s", f, info->username);
 +			mir_snprintf(jid, SIZEOF(jid), "%s/%s", f, info->username);
  //			if (!db_get(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) {
  				// always real username
  //				sprintf(jid, "%s/%s", f, dbv.pszVal);
 @@ -1290,9 +1291,9 @@ static void TlenProcessV(XmlNode *node, ThreadData *info)  	if ((from=JabberXmlGetAttrValue(node, "f")) != NULL) {
  		if (strchr(from, '@') == NULL) {
 -			_snprintf(jid, sizeof(jid), "%s@%s", from, info->server);
 +			mir_snprintf(jid, sizeof(jid), "%s@%s", from, info->server);
  		} else {
 -			_snprintf(jid, sizeof(jid), "%s", from);
 +			mir_snprintf(jid, sizeof(jid), "%s", from);
  		}
  		if ((e=JabberXmlGetAttrValue(node, "e")) != NULL) {
  			if (!strcmp(e, "1")) {
 diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index aeb79f6927..9e1f4bc1d4 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -242,7 +242,7 @@ INT_PTR TlenMenuHandleInbox(void *ptr, LPARAM wParam, LPARAM lParam)  	}
  	mir_free(login);
  	mir_free(password);
 -	_snprintf(szFileName, sizeof(szFileName), "http://poczta.o2.pl/login.html?sid=%s", cookie);
 +	mir_snprintf(szFileName, sizeof(szFileName), "http://poczta.o2.pl/login.html?sid=%s", cookie);
  	CallService(MS_UTILS_OPENURL, (WPARAM) 1, (LPARAM) szFileName);
  	return 0;
  }
 @@ -258,11 +258,11 @@ int TlenOnModulesLoaded(void *ptr, WPARAM wParam, LPARAM lParam)  			db_set_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
  	TlenMUCInit(proto);
 -	sprintf(str, "%s", LPGEN("Incoming mail"));
 +	mir_snprintf(str, SIZEOF(str), "%s", LPGEN("Incoming mail"));
  	SkinAddNewSoundEx("TlenMailNotify", proto->m_szModuleName, str);
 -	sprintf(str, "%s", LPGEN("Alert"));
 +	mir_snprintf(str, SIZEOF(str), "%s", LPGEN("Alert"));
  	SkinAddNewSoundEx("TlenAlertNotify", proto->m_szModuleName, str);
 -	sprintf(str, "%s", LPGEN("Voice chat"));
 +	mir_snprintf(str, SIZEOF(str), "%s", LPGEN("Voice chat"));
  	SkinAddNewSoundEx("TlenVoiceNotify", proto->m_szModuleName, str);
  	HookEventObj_Ex(ME_USERINFO_INITIALISE, proto, TlenUserInfoInit);
 @@ -305,7 +305,7 @@ static void initMenuItems(TlenProtocol *proto)  	proto->hMenuChats = NULL;
  	if (ServiceExists(MS_MUCC_NEW_WINDOW))
  	{
 -		sprintf(text, "%s/MainMenuChats", proto->m_szModuleName);
 +		mir_snprintf(text, SIZEOF(text), "%s/MainMenuChats", proto->m_szModuleName);
  		CreateServiceFunction_Ex(text, proto, TlenMUCMenuHandleChats);
  		mi.pszName = LPGEN("Tlen Chats");
  		mi.position = 2000050001;
 @@ -316,7 +316,7 @@ static void initMenuItems(TlenProtocol *proto)  	}
  	// "Multi-User Conference"
 -	sprintf(text, "%s/MainMenuMUC", proto->m_szModuleName);
 +	mir_snprintf(text, SIZEOF(text), "%s/MainMenuMUC", proto->m_szModuleName);
  	CreateServiceFunction_Ex(text, proto, TlenMUCMenuHandleMUC);
  	mi.pszName = LPGEN("Multi-User Conference");
  	mi.position = 2000050002;
 @@ -325,7 +325,7 @@ static void initMenuItems(TlenProtocol *proto)  	proto->hMenuMUC = Menu_AddMainMenuItem(&mi);
  	Menu_ModifyItem(proto->hMenuMUC, &clmi);
 -	sprintf(text, "%s/MainMenuInbox", proto->m_szModuleName);
 +	mir_snprintf(text, SIZEOF(text), "%s/MainMenuInbox", proto->m_szModuleName);
  	CreateServiceFunction_Ex(text, proto, TlenMenuHandleInbox);
  	mi.pszName = LPGEN("Tlen Mail");
  	mi.position = 2000050003;
 @@ -336,7 +336,7 @@ static void initMenuItems(TlenProtocol *proto)  	mi.hParentMenu = NULL;
  	// "Send picture"
 -	sprintf(text, "%s/SendPicture", proto->m_szModuleName);
 +	mir_snprintf(text, SIZEOF(text), "%s/SendPicture", proto->m_szModuleName);
  	CreateServiceFunction_Ex(text, proto, TlenContactMenuHandleSendPicture);
  	mi.pszName = LPGEN("Send picture");
  	mi.position = -2000019030;
 @@ -345,7 +345,7 @@ static void initMenuItems(TlenProtocol *proto)  	proto->hMenuPicture = Menu_AddContactMenuItem(&mi);
  	// "Invite to MUC"
 -	sprintf(text, "%s/ContactMenuMUC", proto->m_szModuleName);
 +	mir_snprintf(text, SIZEOF(text), "%s/ContactMenuMUC", proto->m_szModuleName);
  	CreateServiceFunction_Ex(text, proto, TlenMUCContactMenuHandleMUC);
  	mi.pszName = LPGEN("Multi-User Conference");
  	mi.position = -2000019020;
 @@ -354,7 +354,7 @@ static void initMenuItems(TlenProtocol *proto)  	proto->hMenuContactMUC = Menu_AddContactMenuItem(&mi);
  	// "Invite to voice chat"
 -	sprintf(text, "%s/ContactMenuVoice", proto->m_szModuleName);
 +	mir_snprintf(text, SIZEOF(text), "%s/ContactMenuVoice", proto->m_szModuleName);
  	CreateServiceFunction_Ex(text, proto, TlenVoiceContactMenuHandleVoice);
  	mi.pszName = LPGEN("Voice Chat");
  	mi.position = -2000019010;
 @@ -363,7 +363,7 @@ static void initMenuItems(TlenProtocol *proto)  	proto->hMenuContactVoice = Menu_AddContactMenuItem(&mi);
  	// "Request authorization"
 -	sprintf(text, "%s/RequestAuth", proto->m_szModuleName);
 +	mir_snprintf(text, SIZEOF(text), "%s/RequestAuth", proto->m_szModuleName);
  	CreateServiceFunction_Ex(text, proto, TlenContactMenuHandleRequestAuth);
  	mi.pszName = LPGEN("Request authorization");
  	mi.position = -2000001001;
 @@ -372,7 +372,7 @@ static void initMenuItems(TlenProtocol *proto)  	proto->hMenuContactRequestAuth = Menu_AddContactMenuItem(&mi);
  	// "Grant authorization"
 -	sprintf(text, "%s/GrantAuth", proto->m_szModuleName);
 +	mir_snprintf(text, SIZEOF(text), "%s/GrantAuth", proto->m_szModuleName);
  	CreateServiceFunction_Ex(text, proto, TlenContactMenuHandleGrantAuth);
  	mi.pszName = LPGEN("Grant authorization");
  	mi.position = -2000001000;
 diff --git a/protocols/Tlen/src/tlen_muc.cpp b/protocols/Tlen/src/tlen_muc.cpp index 9498f12ead..507a4fa6cc 100644 --- a/protocols/Tlen/src/tlen_muc.cpp +++ b/protocols/Tlen/src/tlen_muc.cpp @@ -73,7 +73,7 @@ static char *getDisplayName(TlenProtocol *proto, const char *id)  	HANDLE hContact;
  	DBVARIANT dbv;
  	if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
 -		_snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
 +		mir_snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
  		db_free(&dbv);
  		if (((hContact=JabberHContactFromJID(proto, jid)) != NULL) || !strcmp(id, proto->threadData->username)) {
  			ZeroMemory(&ci, sizeof(ci));
 @@ -248,7 +248,7 @@ static int TlenMUCHandleEvent(void *ptr, WPARAM wParam, LPARAM lParam)  						if (!isSelf(proto, mucce->pszID, nick)) {
  							if (nick[0] == '~' || item->nick != NULL) {
  								char str[256];
 -								sprintf(str, "%s/%s", mucce->pszID, nick);
 +								mir_snprintf(str, SIZEOF(str), "%s/%s", mucce->pszID, nick);
  								hContact = JabberDBCreateContact(proto, str, nick, TRUE); //(char *)mucce->pszUID
  								db_set_b(hContact, proto->m_szModuleName, "bChat", TRUE);
  								CallService(MS_MSG_SENDMESSAGE, (WPARAM) hContact, (LPARAM) NULL);
 @@ -256,7 +256,7 @@ static int TlenMUCHandleEvent(void *ptr, WPARAM wParam, LPARAM lParam)  								DBVARIANT dbv;
  								if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
  									char str[512];
 -									_snprintf(str, sizeof(str), "%s@%s", nick, dbv.pszVal);
 +									mir_snprintf(str, sizeof(str), "%s@%s", nick, dbv.pszVal);
  									db_free(&dbv);
  									hContact = JabberDBCreateContact(proto, str, nick, TRUE);
  									CallService(MS_MSG_SENDMESSAGE, (WPARAM) hContact, (LPARAM) NULL);
 @@ -289,7 +289,7 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r  		char jid[256];
  		DBVARIANT dbv;
  		if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
 -			_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
 +			mir_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
  			db_free(&dbv);
  		} else {
  			strcpy(jid, from);
 @@ -301,7 +301,7 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r  		JABBER_LIST_ITEM *item;
  		DBVARIANT dbv;
  		if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
 -			_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
 +			mir_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
  			db_free(&dbv);
  		} else {
  			strcpy(jid, from);
 @@ -361,7 +361,7 @@ int TlenMUCRecvPresence(TlenProtocol *proto, const char *from, int status, int f  		if (flags & USER_FLAGS_REGISTERED) mucce.dwFlags |= MUCC_EF_USER_REGISTERED;
  		if (status == ID_STATUS_OFFLINE && mucce.bIsMe && kick != NULL) {
  			mucce.iType = MUCC_EVENT_ERROR;
 -			sprintf(str, Translate("You have been kicked. Reason: %s "), kick);
 +			mir_snprintf(str, SIZEOF(str), Translate("You have been kicked. Reason: %s "), kick);
  			mucce.pszText = str;
  		}
  		CallService(MS_MUCC_EVENT, 0, (LPARAM) &mucce);
 @@ -458,45 +458,45 @@ int TlenMUCRecvError(TlenProtocol *proto, const char *from, XmlNode *errorNode)  	errCode = atoi(JabberXmlGetAttrValue(errorNode, "code"));
  	switch (errCode) {
  		case 403:
 -			sprintf(str, Translate("You cannot join this chat room, because you are banned."));
 +			mir_snprintf(str, SIZEOF(str), Translate("You cannot join this chat room, because you are banned."));
  			break;
  		case 404:
 -			sprintf(str, Translate("Chat room not found."));
 +			mir_snprintf(str, SIZEOF(str), Translate("Chat room not found."));
  			break;
  		case 407:
 -			sprintf(str, Translate("This is a private chat room and you are not one of the members."));
 +			mir_snprintf(str, SIZEOF(str), Translate("This is a private chat room and you are not one of the members."));
  			break;
  		case 408:
 -			sprintf(str, Translate("You cannot send any message unless you join this chat room."));
 +			mir_snprintf(str, SIZEOF(str), Translate("You cannot send any message unless you join this chat room."));
  			break;
  		case 410:
 -			sprintf(str, Translate("Chat room with already created."));
 +			mir_snprintf(str, SIZEOF(str), Translate("Chat room with already created."));
  			break;
  		case 411:
 -			sprintf(str, Translate("Nickname '%s' is already registered."),
 +			mir_snprintf(str, SIZEOF(str), Translate("Nickname '%s' is already registered."),
  				JabberXmlGetAttrValue(errorNode, "n"));
  			break;
  		case 412:
 -			sprintf(str, Translate("Nickname already in use, please try another one. Hint: '%s' is free."),
 +			mir_snprintf(str, SIZEOF(str), Translate("Nickname already in use, please try another one. Hint: '%s' is free."),
  				JabberXmlGetAttrValue(errorNode, "free"));
  			break;
  		case 413:
 -			sprintf(str, Translate("You cannot register more than %s nicknames."),
 +			mir_snprintf(str, SIZEOF(str), Translate("You cannot register more than %s nicknames."),
  				JabberXmlGetAttrValue(errorNode, "num"));
  			break;
  		case 414:
 -			sprintf(str, Translate("You cannot create more than %s chat rooms."),
 +			mir_snprintf(str, SIZEOF(str), Translate("You cannot create more than %s chat rooms."),
  				JabberXmlGetAttrValue(errorNode, "num"));
  			break;
  		case 415:
 -			sprintf(str, Translate("You cannot join more than %s chat rooms."),
 +			mir_snprintf(str, SIZEOF(str), Translate("You cannot join more than %s chat rooms."),
  				JabberXmlGetAttrValue(errorNode, "num"));
  			break;
  		case 601:
 -			sprintf(str, Translate("Anonymous nicknames are not allowed in this chat room."));
 +			mir_snprintf(str, SIZEOF(str), Translate("Anonymous nicknames are not allowed in this chat room."));
  			break;
  		default:
 -			sprintf(str, Translate("Unknown error code : %d"), errCode);
 +			mir_snprintf(str, SIZEOF(str), Translate("Unknown error code : %d"), errCode);
  			break;
  	}
  	mucce.pszText = str;
 @@ -549,9 +549,9 @@ static int TlenMUCSendPresence(TlenProtocol *proto, const char *roomID, const ch  		return 1;
  	}
  	if (nick != NULL) {
 -		_snprintf(str, sizeof(str), "%s/%s", roomID, nick);
 +		mir_snprintf(str, sizeof(str), "%s/%s", roomID, nick);
  	} else {
 -		_snprintf(str, sizeof(str), "%s", roomID);
 +		mir_snprintf(str, sizeof(str), "%s", roomID);
  	}
  	if ((jid = JabberTextEncode(str)) != NULL) {
  		switch (desiredStatus) {
 @@ -625,7 +625,7 @@ static int TlenMUCSendQuery(TlenProtocol *proto, int type, const char *parent, i  	if (type == 3) { // find chat room by name
  		char serialId[32];
  		JABBER_LIST_ITEM *item;
 -		sprintf(serialId, JABBER_IQID"%d", JabberSerialNext(proto));
 +		mir_snprintf(serialId, SIZEOF(serialId), JABBER_IQID"%d", JabberSerialNext(proto));
  		item = JabberListAdd(proto, LIST_SEARCH, serialId);
  		item->roomName = mir_strdup(parent);
  		JabberSend(proto, "<iq to='c' type='3' n='%s' id='%s'/>", parent, serialId);
 @@ -1056,7 +1056,7 @@ INT_PTR TlenMUCContactMenuHandleMUC(void *ptr, LPARAM wParam, LPARAM lParam)  	if ((hContact=(HANDLE) wParam) != NULL && proto->isOnline) {
  		if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
  			char serialId[32];
 -			sprintf(serialId, JABBER_IQID"%d", JabberSerialNext(proto));
 +			mir_snprintf(serialId, SIZEOF(serialId), JABBER_IQID"%d", JabberSerialNext(proto));
  			item = JabberListAdd(proto, LIST_INVITATIONS, serialId);
  			item->nick = mir_strdup(dbv.pszVal);
  			JabberSend(proto, "<p to='c' tp='c' id='%s'/>", serialId);
 diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp index 41a5315480..f6d896aa2e 100644 --- a/protocols/Tlen/src/tlen_picture.cpp +++ b/protocols/Tlen/src/tlen_picture.cpp @@ -34,7 +34,7 @@ static void LogPictureMessage(TlenProtocol *proto, const char *jid, const char *  {
  	char message[1024];
  	const char *msg = isSent ? LPGEN("Image sent file://%s") : LPGEN("Image received file://%s");
 -	_snprintf(message, sizeof(message), Translate(msg), filename);
 +	mir_snprintf(message, sizeof(message), Translate(msg), filename);
  	TlenLogMessage(proto, JabberHContactFromJID(proto, jid), isSent ? DBEF_SENT : 0, message);
  }
 @@ -49,7 +49,7 @@ static void TlenPsPostThread(void *ptr) {  		DWORD ret;
  		item->ft->s = socket;
  		item->ft->hFileEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
 -		_snprintf(header, sizeof(header), "<pic auth='%s' t='p' to='%s' size='%d' idt='%s'/>", proto->threadData->username, item->ft->jid, item->ft->fileTotalSize, item->jid);
 +		mir_snprintf(header, sizeof(header), "<pic auth='%s' t='p' to='%s' size='%d' idt='%s'/>", proto->threadData->username, item->ft->jid, item->ft->fileTotalSize, item->jid);
  		JabberWsSend(proto, socket, header, (int)strlen(header));
  		ret = WaitForSingleObject(item->ft->hFileEvent, 1000 * 60 * 5);
  		if (ret == WAIT_OBJECT_0) {
 @@ -58,7 +58,7 @@ static void TlenPsPostThread(void *ptr) {  				int i;
  				char header[512];
  				char fileBuffer[2048];
 -				_snprintf(header, sizeof(header), "<pic st='%s' idt='%s'/>", item->ft->iqId, item->jid);
 +				mir_snprintf(header, sizeof(header), "<pic st='%s' idt='%s'/>", item->ft->iqId, item->jid);
  				JabberWsSend(proto, socket, header, (int)strlen(header));
  				JabberLog(proto, "Sending picture data...");
  				for (i = item->ft->filesSize[0]; i > 0; ) {
 @@ -114,7 +114,7 @@ static void TlenPsGetThread(void *ptr) {  			char header[512];
  			char fileBuffer[2048];
  			JabberXmlInitState(&xmlState);
 -			_snprintf(header, sizeof(header), "<pic auth='%s' t='g' to='%s' pid='1001' idt='%s' rt='%s'/>", proto->threadData->username, item->ft->jid, item->jid, item->ft->id2);
 +			mir_snprintf(header, sizeof(header), "<pic auth='%s' t='g' to='%s' pid='1001' idt='%s' rt='%s'/>", proto->threadData->username, item->ft->jid, item->jid, item->ft->id2);
  			JabberWsSend(proto, socket, header, (int)strlen(header));
  			JabberLog(proto, "Reveiving picture data...");
  			{
 @@ -221,7 +221,7 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) {  			char fileName[MAX_PATH];
  			char *ext = JabberXmlGetAttrValue(node, "ext");
  			char *tmpPath = Utils_ReplaceVars( "%miranda_userdata%" );
 -			int tPathLen = mir_snprintf( fileName, MAX_PATH, "%s\\Images\\Tlen", tmpPath );
 +			int tPathLen = mir_snprintf(fileName, MAX_PATH, "%s\\Images\\Tlen", tmpPath);
  			long oldSize = 0, lSize = atol(size);
  			DWORD dwAttributes = GetFileAttributesA( fileName );
  			if ( dwAttributes == 0xffffffff || ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ) == 0 )
 @@ -284,7 +284,7 @@ BOOL SendPicture(TlenProtocol *proto, HANDLE hContact) {  					char idStr[10];
  					char fileBuffer[2048];
  					int id = JabberSerialNext(proto);
 -					_snprintf(idStr, sizeof(idStr), "%d", id);
 +					mir_snprintf(idStr, sizeof(idStr), "%d", id);
  					item = JabberListAdd(proto, LIST_PICTURE, idStr);
  					item->ft = TlenFileCreateFT(proto, jid);
  					item->ft->files = (char **) mir_alloc(sizeof(char *));
 diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index 6dacafe655..ccf735ead5 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -516,7 +516,7 @@ static void TlenVoiceReceiveParse(TLEN_FILE_TRANSFER *ft)  		}
  		{
  			char ttt[2048];
 -			sprintf(ttt, "%s %d %d ", statusTxt, ft->proto->framesAvailableForPlayback, ft->proto->availOverrunValue);
 +			mir_snprintf(ttt, SIZEOF(ttt), "%s %d %d ", statusTxt, ft->proto->framesAvailableForPlayback, ft->proto->availOverrunValue);
  			SetDlgItemTextA(ft->proto->voiceDlgHWND, IDC_STATUS, ttt);
  		}
  		TlenP2PPacketFree(packet);
 @@ -710,7 +710,7 @@ INT_PTR TlenVoiceContactMenuHandleVoice(void *ptr, LPARAM wParam, LPARAM lParam)  	if ((hContact=(HANDLE) wParam) != NULL) {
  		if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
  			char serialId[32];
 -			sprintf(serialId, "%d", JabberSerialNext(proto));
 +			mir_snprintf(serialId, SIZEOF(serialId), "%d", JabberSerialNext(proto));
  			if ((item = JabberListAdd(proto, LIST_VOICE, serialId)) != NULL) {
  				ft = TlenFileCreateFT(proto, dbv.pszVal);
  				ft->iqId = mir_strdup(serialId);
 @@ -871,7 +871,7 @@ static INT_PTR CALLBACK TlenVoiceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,  					} else {
  						fv = 0;
  					}
 -					sprintf(str, "%.1f kB/s", fv / 1024);
 +					mir_snprintf(str, SIZEOF(str), "%.1f kB/s", fv / 1024);
  					SetDlgItemTextA(hwndDlg, IDC_BYTESOUT, str);
  					if (proto->playbackControl != NULL) {
  						fv = (float)proto->playbackControl->bytesSum;
 @@ -879,7 +879,7 @@ static INT_PTR CALLBACK TlenVoiceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,  					} else {
  						fv = 0;
  					}
 -					sprintf(str, "%.1f kB/s", fv / 1024);
 +					mir_snprintf(str, SIZEOF(str), "%.1f kB/s", fv / 1024);
  					SetDlgItemTextA(hwndDlg, IDC_BYTESIN, str);
  			}
  			break;
 @@ -954,7 +954,7 @@ static char *getDisplayName(TlenProtocol *proto, const char *id)  	HANDLE hContact;
  	DBVARIANT dbv;
  	if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
 -		_snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
 +		mir_snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
  		db_free(&dbv);
  		if ((hContact=JabberHContactFromJID(proto, jid)) != NULL) {
  			return mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0));
 @@ -1035,7 +1035,7 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from)  				char jid[256];
  				DBVARIANT dbv;
  				if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
 -					_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
 +					mir_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
  					db_free(&dbv);
  				} else {
  					strcpy(jid, from);
 @@ -1046,7 +1046,7 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from)  				char jid[256];
  				DBVARIANT dbv;
  				if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
 -					_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
 +					mir_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
  					db_free(&dbv);
  				} else {
  					strcpy(jid, from);
  | 
