soc.2009.transport: b4db7439: Various segfaults fixed

hanzz at soc.pidgin.im hanzz at soc.pidgin.im
Sun Jun 28 05:30:36 EDT 2009


-----------------------------------------------------------------
Revision: b4db7439c09b662a506e4c446ae5beff026b9519
Ancestor: 55c67b894bae146fea86ed3fefb3621c7336e094
Author: hanzz at soc.pidgin.im
Date: 2009-06-28T09:28:22
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/b4db7439c09b662a506e4c446ae5beff026b9519

Modified files:
        adhochandler.cpp user.cpp vcardhandler.cpp

ChangeLog: 

Various segfaults fixed

-------------- next part --------------
============================================================
--- adhochandler.cpp	491dd8be979373ef53d6db37699342819df2218f
+++ adhochandler.cpp	a5cd707dc7750bd7b8ee2d2071d9cc6a1d03d6a4
@@ -64,7 +64,7 @@ Disco::ItemList GlooxAdhocHandler::handl
 			User *user = main->userManager()->getUserByJID(from);
 			if (user) {
 				for(std::map<std::string, adhocCommand>::iterator u = m_handlers.begin(); u != m_handlers.end() ; u++) {
-					lst.push_back( new Disco::Item( main->jid(),"transport_" + (*u).first, (std::string) tr(user->getLang(), (*u).second.name) ) );
+					lst.push_back( new Disco::Item( main->jid(), (*u).first, (std::string) tr(user->getLang(), (*u).second.name) ) );
 				}
 				if (user->isConnected() && purple_account_get_connection(user->account())) {
 					PurpleConnection *gc = purple_account_get_connection(user->account());
============================================================
--- user.cpp	96a494556e90fcb447d9af976d3c7532abdca3d2
+++ user.cpp	6b9f78a930e2ee9ceaf063e69d41af8b04280e5b
@@ -41,9 +41,8 @@ static void sendXhtmlTag(Tag *tag, Tag *
 static void sendXhtmlTag(Tag *tag, Tag *stanzaTag) {
 	Tag *html = new Tag("html");
 	html->addAttribute("xmlns", "http://jabber.org/protocol/xhtml-im");
-	Tag *body = new Tag("body");
+	Tag *body = tag->clone();
 	body->addAttribute("xmlns", "http://www.w3.org/1999/xhtml");
-	body->addChild(tag->clone());
 	html->addChild(body);
 	stanzaTag->addChild(html);
 	GlooxMessageHandler::instance()->j->send(stanzaTag);
@@ -546,8 +545,9 @@ void User::purpleConversationWriteIM(Pur
 	
 	std::string name = (std::string) purple_conversation_get_name(conv);
 	
-	int pos = name.find("/");
-	name.erase(pos, name.length() - pos);
+	size_t pos = name.find("/");
+	if (pos != std::string::npos)
+		name.erase((int) pos, name.length() - (int) pos);
 	
 	if (name.empty())
 		return;
@@ -597,7 +597,7 @@ void User::purpleConversationWriteIM(Pur
 	}
 	Log().Get("TEST") << m << " " << message;
 	if (hasFeature(GLOOX_FEATURE_XHTML_IM) && m != message) {
-		p->parser()->getTag(m, sendXhtmlTag, stanzaTag);
+		p->parser()->getTag("<body>" + m + "</body>", sendXhtmlTag, stanzaTag);
 		g_free(newline);
 		g_free(strip);
 		return;
@@ -859,7 +859,7 @@ void User::connect(){
 	purple_account_set_password(m_account,m_password.c_str());
 	Log().Get(m_jid) << "UIN:" << m_username << " PASSWORD:" << m_password;
 
-	if (p->configuration->useProxy) {
+	if (p->configuration().useProxy) {
 		PurpleProxyInfo *info = purple_proxy_info_new();
 		purple_proxy_info_set_type(info, PURPLE_PROXY_USE_ENVVAR);
 		info->username = NULL;
============================================================
--- vcardhandler.cpp	2231b8a1af82c0273dffec4ccee3021c92853fda
+++ vcardhandler.cpp	5968722b388b7c0fb2a588a84b425dc76d83b53d
@@ -142,7 +142,7 @@ void GlooxVCardHandler::userInfoArrived(
 
 		Tag *vcard = p->protocol()->getVCardTag(user, vcardEntries);
 		if (!vcard) {
-			Tag *vcard = new Tag( "vCard" );
+			vcard = new Tag( "vCard" );
 			vcard->addAttribute( "xmlns", "vcard-temp" );
 		}
 


More information about the Commits mailing list