Changeset - 2836f390b953
[Not reviewed]
0 2 0
HanzZ - 14 years ago 2011-06-19 20:40:27
hanzz.k@gmail.com
Receive VCard from PurpleAccount and fixed crash on disconnect
2 files changed with 14 insertions and 2 deletions:
0 comments (0 inline, 0 general)
backends/libpurple/main.cpp
Show inline comments
 
@@ -686,31 +686,41 @@ static void *notify_user_info(PurpleConnection *gc, const char *who, PurpleNotif
 
		vcardEntries = vcardEntries->next;
 
	}
 

	
 
	if (name == purple_account_get_username(account)) {
 
		const gchar *displayname = purple_connection_get_display_name(gc);
 
		if (!displayname) {
 
			displayname = purple_account_get_name_for_display(account);
 
		}
 

	
 
		if (displayname) {
 
			nickname = displayname;
 
		}
 

	
 
		// avatar
 
		PurpleStoredImage *avatar = purple_buddy_icons_find_account_icon(account);
 
		if (avatar) {
 
			const gchar * data = (const gchar *) purple_imgstore_get_data(avatar);
 
			size_t len = purple_imgstore_get_size(avatar);
 
			if (len < 300000 && data) {
 
				photo = Swift::createByteArray(data, len);
 
			}
 
		}
 
	}
 

	
 
	if ((!firstName.empty() || !lastName.empty()) && fullName.empty())
 
		fullName = firstName + " " + lastName;
 

	
 
	PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(gc), who);
 
	if (buddy) {
 
	if (buddy && photo.size() == 0) {
 
		gsize len;
 
		PurpleBuddyIcon *icon = NULL;
 
		icon = purple_buddy_icons_find(purple_connection_get_account(gc), name.c_str());
 
		if (icon) {
 
			const gchar * data = (gchar*)purple_buddy_icon_get_data(icon, &len);
 
			// Sometimes libpurple returns really broken pointers here
 
			// They weren't able to do anything with that and I don't know what to do too,
 
			// so it's better to hack through it by not trying to forward really broken things...
 
			if (len < 300000 && data) {
 
				photo = Swift::createByteArray(data, len);
 
// 				const gchar *ext = (gchar*)purple_buddy_icon_get_extension(icon);
 
// 				if (ext) {
include/Swiften/Server/Server.cpp
Show inline comments
 
@@ -48,25 +48,27 @@ Server::Server(
 
	stanzaChannel_ = new ServerStanzaChannel();
 
	iqRouter_ = new IQRouter(stanzaChannel_);
 
	tlsFactory = NULL;
 
}
 

	
 
Server::~Server() {
 
	stop();
 
	delete iqRouter_;
 
	delete stanzaChannel_;
 
}
 

	
 
void Server::start() {
 
	assert(!serverFromClientConnectionServer);
 
	if (serverFromClientConnectionServer) {
 
		return;
 
	}
 
	serverFromClientConnectionServer = networkFactories_->getConnectionServerFactory()->createConnectionServer(port_);
 
	serverFromClientConnectionServerSignalConnections.push_back(
 
		serverFromClientConnectionServer->onNewConnection.connect(
 
				boost::bind(&Server::handleNewClientConnection, this, _1)));
 
// 	serverFromClientConnectionServerSignalConnections.push_back(
 
// 		serverFromClientConnectionServer->onStopped.connect(
 
// 				boost::bind(&Server::handleClientConnectionServerStopped, this, _1)));
 

	
 
	serverFromClientConnectionServer->start();
 
}
 

	
 
void Server::stop() {
0 comments (0 inline, 0 general)