Mercurial > pidgin
diff libpurple/protocols/silc/silc.c @ 31999:3899615cef8a
Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
author | andrew.victor@mxit.com |
---|---|
date | Tue, 30 Aug 2011 20:21:33 +0000 |
parents | a5b556ac1de5 |
children | a9f13cb4e945 |
line wrap: on
line diff
--- a/libpurple/protocols/silc/silc.c Tue Aug 30 20:03:11 2011 +0000 +++ b/libpurple/protocols/silc/silc.c Tue Aug 30 20:21:33 2011 +0000 @@ -78,7 +78,7 @@ const char *state; if (gc != NULL) - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (status == NULL) return; @@ -125,7 +125,7 @@ static void silcpurple_keepalive(PurpleConnection *gc) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); silc_packet_send(sg->conn->stream, SILC_PACKET_HEARTBEAT, 0, NULL, 0); } @@ -180,7 +180,7 @@ { SilcClient client = (SilcClient)context; PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcPurpleTask ptask = NULL; if (added) { @@ -252,7 +252,7 @@ struct utsname u; #endif - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); switch (status) { case SILC_CLIENT_CONN_SUCCESS: @@ -367,7 +367,7 @@ SilcClientConnectionParams params; const char *dfile; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (status != SILC_SOCKET_OK) { purple_connection_error(gc, @@ -376,7 +376,7 @@ silc_pkcs_public_key_free(sg->public_key); silc_pkcs_private_key_free(sg->private_key); silc_free(sg); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); return; } @@ -415,7 +415,7 @@ g_return_if_fail(gc != NULL); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (source < 0) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, @@ -423,7 +423,7 @@ silc_pkcs_public_key_free(sg->public_key); silc_pkcs_private_key_free(sg->private_key); silc_free(sg); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); return; } @@ -449,7 +449,7 @@ { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); return; } @@ -457,7 +457,7 @@ static void silcpurple_got_password_cb(PurpleConnection *gc, PurpleRequestFields *fields) { - SilcPurple sg = (SilcPurple)gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); char pkd[256], prd[256]; const char *password; @@ -473,7 +473,7 @@ if (!password || !*password) { purple_notify_error(gc, NULL, _("Password is required to sign on."), NULL); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); return; } @@ -492,7 +492,7 @@ &sg->public_key, &sg->private_key)) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to load SILC key pair")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); return; } @@ -505,10 +505,10 @@ /* The password prompt dialog doesn't get disposed if the account disconnects */ if (!PURPLE_CONNECTION_IS_VALID(gc)) return; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to load SILC key pair")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); } @@ -537,7 +537,7 @@ } purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to load SILC key pair")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); return; } @@ -558,7 +558,7 @@ gc = account->gc; if (!gc) return; - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); memset(¶ms, 0, sizeof(params)); strcat(params.nickname_format, "%n#a"); @@ -612,14 +612,14 @@ sg->client = client; sg->gc = gc; sg->account = account; - gc->proto_data = sg; + purple_connection_set_protocol_data(gc, sg); /* Init SILC client */ if (!silc_client_init(client, username, hostname, realname, silcpurple_running, sg)) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to initialize SILC protocol")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); silc_free(hostname); g_free(username); @@ -632,7 +632,7 @@ if (!silcpurple_check_silc_dir(gc)) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Error loading SILC key pair")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); return; } @@ -669,7 +669,7 @@ static void silcpurple_close(PurpleConnection *gc) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); #if __SILC_TOOLKIT_VERSION >= SILC_VERSION(1,1,1) SilcPurpleTask task; #endif /* __SILC_TOOLKIT_VERSION */ @@ -733,7 +733,7 @@ static void silcpurple_attrs_cb(PurpleConnection *gc, PurpleRequestFields *fields) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; PurpleRequestField *f; @@ -744,7 +744,7 @@ SilcVCardStruct vcard; const char *val; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg) return; @@ -905,7 +905,7 @@ silcpurple_attrs(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; PurpleRequestFields *fields; @@ -922,7 +922,7 @@ gboolean device = TRUE; char status[1024], tz[16]; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg) return; @@ -1072,7 +1072,7 @@ if (!gc) return; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg) return; @@ -1090,7 +1090,7 @@ if (!gc) return; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg) return; @@ -1125,7 +1125,7 @@ int keylen = SILCPURPLE_DEF_PKCS_LEN; SilcPublicKey public_key; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg) return; @@ -1208,7 +1208,7 @@ silcpurple_create_keypair(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); PurpleRequestFields *fields; PurpleRequestFieldGroup *g; PurpleRequestField *f; @@ -1356,7 +1356,7 @@ void *context) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcPurpleIM im = context; PurpleConversation *convo; char tmp[256]; @@ -1433,7 +1433,7 @@ silcpurple_send_im(PurpleConnection *gc, const char *who, const char *message, PurpleMessageFlags flags) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcDList clients; @@ -1718,7 +1718,7 @@ if (gc == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return PURPLE_CMD_RET_FAILED; @@ -1747,7 +1747,7 @@ if (gc == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return PURPLE_CMD_RET_FAILED; @@ -1769,10 +1769,10 @@ gc = purple_conversation_get_gc(conv); - if (gc == NULL || !args || gc->proto_data == NULL) + if (gc == NULL || !args || purple_connection_get_protocol_data(gc) == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (args[0]) chname = args[0]; @@ -1823,7 +1823,7 @@ if (gc == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return PURPLE_CMD_RET_FAILED; @@ -1855,7 +1855,7 @@ if (gc == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return PURPLE_CMD_RET_FAILED; @@ -1892,7 +1892,7 @@ if (gc == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return PURPLE_CMD_RET_FAILED;