gobjectification: 7c507b08: compile gg

sadrul at pidgin.im sadrul at pidgin.im
Thu Mar 13 04:38:17 EDT 2008


-----------------------------------------------------------------
Revision: 7c507b08162a17fd19e22740c0e4ec10613125a7
Ancestor: ca1d8ab97d6da9057c07f1caf47984b9e4f5f17d
Author: sadrul at pidgin.im
Date: 2008-03-13T06:10:13
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/7c507b08162a17fd19e22740c0e4ec10613125a7

Modified files:
        libpurple/protocols/gg/buddylist.c
        libpurple/protocols/gg/confer.c libpurple/protocols/gg/gg.c
        libpurple/protocols/gg/search.c

ChangeLog: 

compile gg

-------------- next part --------------
============================================================
--- libpurple/protocols/gg/buddylist.c	353535de7d31ded3a69e0486d86d6d22604f31e6
+++ libpurple/protocols/gg/buddylist.c	c378a7c8c65b435fd0e6429d548a14d5ccf9c228
@@ -38,7 +38,7 @@ void ggp_buddylist_send(PurpleConnection
 /* void ggp_buddylist_send(PurpleConnection *gc) {{{ */
 void ggp_buddylist_send(PurpleConnection *gc)
 {
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	PurpleAccount *account = purple_connection_get_account(gc);
 
 	PurpleBuddyList *blist;
============================================================
--- libpurple/protocols/gg/confer.c	d565bfce32db3a7dd991bf9aae27e9e1490702c8
+++ libpurple/protocols/gg/confer.c	2a0a906ee9a4adb4ef94e1f36eebb8ec25a754a0
@@ -42,7 +42,7 @@ void ggp_confer_participants_add_uin(Pur
 							 const uin_t uin)
 {
 	PurpleConversation *conv;
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	GGPChat *chat;
 	GList *l;
 	gchar *str_uin;
@@ -73,7 +73,7 @@ void ggp_confer_participants_add(PurpleC
 void ggp_confer_participants_add(PurpleConnection *gc, const gchar *chat_name,
 				 const uin_t *recipients, int count)
 {
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	GList *l;
 	gchar *str_uin;
 
@@ -111,7 +111,7 @@ const char *ggp_confer_find_by_participa
 const char *ggp_confer_find_by_participants(PurpleConnection *gc,
 					    const uin_t *recipients, int count)
 {
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	GGPChat *chat = NULL;
 	GList *l;
 	int matches;
@@ -149,7 +149,7 @@ const char *ggp_confer_add_new(PurpleCon
 /* const char *ggp_confer_add_new(PurpleConnection *gc, const char *name) {{{ */
 const char *ggp_confer_add_new(PurpleConnection *gc, const char *name)
 {
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	GGPChat *chat;
 
 	chat = g_new0(GGPChat, 1);
============================================================
--- libpurple/protocols/gg/gg.c	dcc4958ad43fc7e197f4d977e47a6f4653ea92b5
+++ libpurple/protocols/gg/gg.c	e4d0dcb87774c453830fc877ceeb7b74aa24a577
@@ -96,7 +96,7 @@ static void ggp_async_token_handler(gpoi
 static void ggp_async_token_handler(gpointer _gc, gint fd, PurpleInputCondition cond)
 {
 	PurpleConnection *gc = _gc;
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	GGPToken *token = info->token;
 	GGPTokenCallback cb;
 
@@ -173,7 +173,7 @@ static void ggp_token_request(PurpleConn
 	if (ggp_setup_proxy(account) == -1)
 		return;
 
-	info = gc->proto_data;
+	info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	if ((req = gg_token(1)) == NULL) {
 		purple_notify_error(account,
@@ -203,7 +203,7 @@ static void ggp_action_buddylist_get(Pur
 static void ggp_action_buddylist_get(PurplePluginAction *action)
 {
 	PurpleConnection *gc = (PurpleConnection *)action->context;
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	purple_debug_info("gg", "Downloading...\n");
 
@@ -220,7 +220,7 @@ static void ggp_action_buddylist_put(Pur
 static void ggp_action_buddylist_put(PurplePluginAction *action)
 {
 	PurpleConnection *gc = (PurpleConnection *)action->context;
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	char *buddylist = ggp_buddylist_dump(purple_connection_get_account(gc));
 
@@ -243,7 +243,7 @@ static void ggp_action_buddylist_delete(
 static void ggp_action_buddylist_delete(PurplePluginAction *action)
 {
 	PurpleConnection *gc = (PurpleConnection *)action->context;
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	purple_debug_info("gg", "Deleting...\n");
 
@@ -357,7 +357,7 @@ static void ggp_callback_register_accoun
 					     PurpleRequestFields *fields)
 {
 	PurpleAccount *account;
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	struct gg_http *h = NULL;
 	struct gg_pubdir *s;
 	uin_t uin;
@@ -442,7 +442,7 @@ static void ggp_callback_register_accoun
 static void ggp_callback_register_account_cancel(PurpleConnection *gc,
 						 PurpleRequestFields *fields)
 {
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	GGPToken *token = info->token;
 
 	purple_connection_destroy(gc);
@@ -464,7 +464,7 @@ static void ggp_register_user_dialog(Pur
 	PurpleRequestFieldGroup *group;
 	PurpleRequestField *field;
 
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	GGPToken *token = info->token;
 
 
@@ -518,7 +518,7 @@ static void ggp_callback_show_next(Purpl
 /* static void ggp_callback_show_next(PurpleConnection *gc, GList *row, gpointer user_data) {{{ */
 static void ggp_callback_show_next(PurpleConnection *gc, GList *row, gpointer user_data)
 {
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	GGPSearchForm *form = user_data;
 	guint32 seq;
 
@@ -564,7 +564,7 @@ static void ggp_callback_find_buddies(Pu
 /* static void ggp_callback_find_buddies(PurpleConnection *gc, PurpleRequestFields *fields) {{{ */
 static void ggp_callback_find_buddies(PurpleConnection *gc, PurpleRequestFields *fields)
 {
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	GGPSearchForm *form;
 	guint32 seq;
 
@@ -678,7 +678,7 @@ static void ggp_callback_change_passwd_o
 static void ggp_callback_change_passwd_ok(PurpleConnection *gc, PurpleRequestFields *fields)
 {
 	PurpleAccount *account;
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	struct gg_http *h;
 	gchar *cur, *p1, *p2, *t;
 
@@ -757,7 +757,7 @@ static void ggp_change_passwd_dialog(Pur
 	PurpleRequestFieldGroup *group;
 	PurpleRequestField *field;
 
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	GGPToken *token = info->token;
 
 	char *msg;
@@ -827,7 +827,7 @@ static void ggp_callback_add_to_chat_ok(
 /* static void ggp_callback_add_to_chat_ok(PurpleConnection *gc, PurpleRequestFields *fields) {{{ */
 static void ggp_callback_add_to_chat_ok(PurpleConnection *gc, PurpleRequestFields *fields)
 {
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	PurpleRequestField *field;
 	/* TODO: sel may be null. */
 	GList *sel;
@@ -858,7 +858,7 @@ static void ggp_bmenu_add_to_chat(Purple
 
 	buddy = (PurpleBuddy *)node;
 	gc = purple_account_get_connection(purple_buddy_get_account(buddy));
-	info = gc->proto_data;
+	info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	/* TODO: It tmp_buddy != 0 then stop! */
 	info->tmp_buddy = ggp_str_to_uin(purple_buddy_get_name(buddy));
@@ -904,7 +904,7 @@ static void ggp_bmenu_block(PurpleBlistN
 
 	buddy = (PurpleBuddy *)node;
 	gc = purple_account_get_connection(purple_buddy_get_account(buddy));
-	info = gc->proto_data;
+	info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	uin = ggp_str_to_uin(purple_buddy_get_name(buddy));
 
@@ -1196,7 +1196,7 @@ static void ggp_pubdir_reply_handler(Pur
 /* static void ggp_pubdir_reply_handler(PurpleConnection *gc, gg_pubdir50_t req) {{{ */
 static void ggp_pubdir_reply_handler(PurpleConnection *gc, gg_pubdir50_t req)
 {
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	GGPSearchForm *form;
 	int res_count;
 	guint32 seq;
@@ -1243,7 +1243,7 @@ static void ggp_recv_message_handler(Pur
 /* static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event *ev) {{{ */
 static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event *ev)
 {
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	PurpleConversation *conv;
 	gchar *from;
 	gchar *msg;
@@ -1302,7 +1302,7 @@ static void ggp_callback_recv(gpointer _
 static void ggp_callback_recv(gpointer _gc, gint fd, PurpleInputCondition cond)
 {
 	PurpleConnection *gc = _gc;
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	struct gg_event *ev;
 	int i;
 
@@ -1314,7 +1314,10 @@ static void ggp_callback_recv(gpointer _
 			_("Unable to read socket"));
 		return;
 	}
+#warning FIXME: uncomment!!
+#if 0
 	gc->last_received = time(NULL);
+#endif
 	switch (ev->type) {
 		case GG_EVENT_NONE:
 			/* Nothing happened. */
@@ -1432,7 +1435,7 @@ static void ggp_async_login_handler(gpoi
 
 	g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc));
 
-	info = gc->proto_data;
+	info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n",
 			info->session->check, info->session->state);
@@ -1473,13 +1476,15 @@ static void ggp_async_login_handler(gpoi
 	purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n",
 			info->session->check, info->session->state);
 
-	purple_input_remove(gc->inpa);
+	purple_input_remove(purple_object_get_int(PURPLE_OBJECT(gc),"inpa"));
 
 	/** XXX I think that this shouldn't be done if ev->type is GG_EVENT_CONN_FAILED or GG_EVENT_CONN_SUCCESS -datallah */
-	gc->inpa = purple_input_add(info->session->fd,
+	g_object_set(PURPLE_OBJECT(gc),"inpa",
+			purple_input_add(info->session->fd,
 				  (info->session->check == 1) ? PURPLE_INPUT_WRITE
 							      : PURPLE_INPUT_READ,
-				  ggp_async_login_handler, gc);
+				  ggp_async_login_handler, gc),
+			NULL);
 
 	switch (ev->type) {
 		case GG_EVENT_NONE:
@@ -1493,10 +1498,12 @@ static void ggp_async_login_handler(gpoi
 				PurpleStatus *status;
 
 				purple_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n");
-				purple_input_remove(gc->inpa);
-				gc->inpa = purple_input_add(info->session->fd,
+				purple_input_remove(purple_object_get_int(PURPLE_OBJECT(gc),"inpa"));
+				g_object_set(PURPLE_OBJECT(gc), "inpa",
+						purple_input_add(info->session->fd,
 							  PURPLE_INPUT_READ,
-							  ggp_callback_recv, gc);
+							  ggp_callback_recv, gc),
+						NULL);
 
 				/* gg_change_status(info->session, GG_STATUS_AVAIL); */
 
@@ -1510,8 +1517,8 @@ static void ggp_async_login_handler(gpoi
 			}
 			break;
 		case GG_EVENT_CONN_FAILED:
-			purple_input_remove(gc->inpa);
-			gc->inpa = 0;
+			purple_input_remove(purple_object_get_int(PURPLE_OBJECT(gc),"inpa"));
+			g_object_set(G_OBJECT(gc),"inpa",0,NULL);
 			purple_connection_error_reason (gc,
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 				_("Connection failed."));
@@ -1709,10 +1716,10 @@ static void ggp_login(PurpleAccount *acc
 	info->token = NULL;
 	info->searches = ggp_search_new();
 
-	gc->proto_data = info;
+	purple_object_set_protocol_data(PURPLE_OBJECT(gc),info);
 
 	glp->uin = ggp_get_uin(account);
-	purple_account_get_password(glp) = (char *)purple_account_get_password(account);
+	glp->password = (char *)purple_account_get_password(account);
 
 	glp->async = 1;
 	glp->status = GG_STATUS_AVAIL;
@@ -1726,8 +1733,10 @@ static void ggp_login(PurpleAccount *acc
 		g_free(glp);
 		return;
 	}
-	gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ,
-				  ggp_async_login_handler, gc);
+	g_object_set(PURPLE_OBJECT(gc),"inpa",
+			purple_input_add(info->session->fd, PURPLE_INPUT_READ,
+				  ggp_async_login_handler, gc),
+			NULL);
 }
 /* }}} */
 
@@ -1740,10 +1749,10 @@ static void ggp_close(PurpleConnection *
 		return;
 	}
 
-	if (gc->proto_data) {
+	if (purple_object_get_protocol_data(PURPLE_OBJECT(gc))) {
 		PurpleAccount *account = purple_connection_get_account(gc);
 		PurpleStatus *status;
-		GGPInfo *info = gc->proto_data;
+		GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 		status = purple_account_get_active_status(account);
 
@@ -1760,11 +1769,11 @@ static void ggp_close(PurpleConnection *
 
 		ggp_search_destroy(info->searches);
 		g_free(info);
-		gc->proto_data = NULL;
+		purple_object_set_protocol_data(PURPLE_OBJECT(gc),NULL);
 	}
 
-	if (gc->inpa > 0)
-		purple_input_remove(gc->inpa);
+	if (purple_object_get_int(PURPLE_OBJECT(gc),"inpa") > 0)
+		purple_input_remove(purple_object_get_int(PURPLE_OBJECT(gc),"inpa"));
 
 	ggp_buddylist_offline(gc);
 
@@ -1776,7 +1785,7 @@ static int ggp_send_im(PurpleConnection 
 static int ggp_send_im(PurpleConnection *gc, const char *who, const char *msg,
 		       PurpleMessageFlags flags)
 {
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	char *tmp, *plain;
 	int ret = 0;
 
@@ -1809,7 +1818,7 @@ static void ggp_get_info(PurpleConnectio
 /* static void ggp_get_info(PurpleConnection *gc, const char *name) { {{{ */
 static void ggp_get_info(PurpleConnection *gc, const char *name)
 {
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	GGPSearchForm *form;
 	guint32 seq;
 
@@ -1837,7 +1846,7 @@ static void ggp_set_status(PurpleAccount
 		return;
 
 	gc = purple_account_get_connection(account);
-	info = gc->proto_data;
+	info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	status_id = purple_status_get_id(status);
 
@@ -1888,7 +1897,7 @@ static void ggp_add_buddy(PurpleConnecti
 static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
 {
 	PurpleAccount *account;
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	gg_add_notify(info->session, ggp_str_to_uin(buddy->name));
 
@@ -1903,7 +1912,7 @@ static void ggp_remove_buddy(PurpleConne
 static void ggp_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy,
 						 PurpleGroup *group)
 {
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	gg_remove_notify(info->session, ggp_str_to_uin(buddy->name));
 }
@@ -1912,7 +1921,7 @@ static void ggp_join_chat(PurpleConnecti
 /* static void ggp_join_chat(PurpleConnection *gc, GHashTable *data) {{{ */
 static void ggp_join_chat(PurpleConnection *gc, GHashTable *data)
 {
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	GGPChat *chat;
 	char *chat_name;
 	GList *l;
@@ -1954,7 +1963,7 @@ static int ggp_chat_send(PurpleConnectio
 static int ggp_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags)
 {
 	PurpleConversation *conv;
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	GGPChat *chat = NULL;
 	GList *l;
 	char *msg, *plain;
@@ -2007,7 +2016,7 @@ static void ggp_keepalive(PurpleConnecti
 /* static void ggp_keepalive(PurpleConnection *gc) {{{ */
 static void ggp_keepalive(PurpleConnection *gc)
 {
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	/* purple_debug_info("gg", "Keeping connection alive....\n"); */
 
@@ -2027,7 +2036,7 @@ static void ggp_register_user(PurpleAcco
 	PurpleConnection *gc = purple_account_get_connection(account);
 	GGPInfo *info;
 
-	info = gc->proto_data = g_new0(GGPInfo, 1);
+	purple_object_set_protocol_data(PURPLE_OBJECT(gc), info = g_new0(GGPInfo, 1));
 
 	ggp_token_request(gc, ggp_register_user_dialog);
 }
============================================================
--- libpurple/protocols/gg/search.c	443181127a48a08efd4a129f32b65d9347622bfb
+++ libpurple/protocols/gg/search.c	c505d8f41226e57dbe6ff2f7f8c9f17de72eea0b
@@ -135,7 +135,7 @@ guint32 ggp_search_start(PurpleConnectio
 /* guint32 ggp_search_start(PurpleConnection *gc, GGPSearchForm *form) {{{ */
 guint32 ggp_search_start(PurpleConnection *gc, GGPSearchForm *form)
 {
-	GGPInfo *info = gc->proto_data;
+	GGPInfo *info = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	gg_pubdir50_t req;
 	guint seq;
 


More information about the Commits mailing list