soc.2009.transport: 18d7ac22: Add friends from Myspace automatically o...

hanzz at soc.pidgin.im hanzz at soc.pidgin.im
Fri Jul 24 06:51:12 EDT 2009


-----------------------------------------------------------------
Revision: 18d7ac229999438305ba16a23dc0f64350780009
Ancestor: 7beacfd228068bfddfb7eee062286c10d84254fe
Author: hanzz at soc.pidgin.im
Date: 2009-07-24T08:21:23
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/18d7ac229999438305ba16a23dc0f64350780009

Modified files:
        protocols/myspace.cpp protocols/myspace.h

ChangeLog: 

Add friends from Myspace automatically on connect

-------------- next part --------------
============================================================
--- protocols/myspace.cpp	71f20c57506affaccb875068693b1b94be4a5d63
+++ protocols/myspace.cpp	fd60ec4cf5db33e9fb39c0c66312e3022b82154f
@@ -81,3 +81,28 @@ std::string MyspaceProtocol::text(const 
 		return "Enter your Myspace name and password:";
 	return "not defined";
 }
+
+void MyspaceProtocol::onConnected(User *user) {
+	if (purple_account_get_connection(user->account())) {
+		PurpleConnection *gc = purple_account_get_connection(user->account());
+		PurplePlugin *plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? gc->prpl : NULL;
+		if (plugin && PURPLE_PLUGIN_HAS_ACTIONS(plugin)) {
+			PurplePluginAction *action = NULL;
+			GList *actions, *l;
+
+			actions = PURPLE_PLUGIN_ACTIONS(plugin, gc);
+
+			for (l = actions; l != NULL; l = l->next) {
+				if (l->data) {
+					action = (PurplePluginAction *) l->data;
+					action->plugin = plugin;
+					action->context = gc;
+					if ((std::string) action->label == "Add friends from MySpace.com") {
+						action->callback(action);
+					}
+					purple_plugin_action_free(action);
+				}
+			}
+		}
+	}
+}
============================================================
--- protocols/myspace.h	290823f72ab052ab7d281372d1e31832d6deeeb4
+++ protocols/myspace.h	322d6e78cdca5c5c0f122ab3062bb98c4c039f82
@@ -44,6 +44,7 @@ class MyspaceProtocol : AbstractProtocol
 // 		std::string userSearchAction() { return "Search for buddies..."; }
 		
 		std::string replace(std::string &str, const char *string_to_replace, const char *new_string);
+		void onConnected(User *user);
 // 		std::string userSearchColumn() { return "ID"; }
 	
 	private:


More information about the Commits mailing list