Mercurial > pidgin.yaz
diff libpurple/protocols/irc/irc.c @ 32692:0f94ec89f0bc
merged from im.pidgin.pidgin
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Mon, 26 Sep 2011 14:57:21 +0900 |
parents | ac6353ffa129 c6943fd38d44 |
children | 4a34689eeb33 |
line wrap: on
line diff
--- a/libpurple/protocols/irc/irc.c Mon Aug 29 12:59:57 2011 +0900 +++ b/libpurple/protocols/irc/irc.c Mon Sep 26 14:57:21 2011 +0900 @@ -70,11 +70,11 @@ struct irc_conn *irc; char *title; - if (gc == NULL || gc->proto_data == NULL) { + if (gc == NULL || purple_connection_get_protocol_data(gc) == NULL) { purple_debug(PURPLE_DEBUG_ERROR, "irc", "got MOTD request for NULL gc\n"); return; } - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); if (irc->motd == NULL) { purple_notify_error(gc, _("Error displaying MOTD"), _("No MOTD available"), _("There is no MOTD associated with this connection.")); @@ -100,7 +100,7 @@ static int irc_send_raw(PurpleConnection *gc, const char *buf, int len) { - struct irc_conn *irc = (struct irc_conn*)gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); if (len == -1) { len = strlen(buf); } @@ -365,7 +365,8 @@ return; } - gc->proto_data = irc = g_new0(struct irc_conn, 1); + irc = g_new0(struct irc_conn, 1); + purple_connection_set_protocol_data(gc, irc); irc->fd = -1; irc->account = account; irc->outbuf = purple_circ_buffer_new(512); @@ -415,7 +416,7 @@ char *buf, *tmp = NULL; char *server; const char *username, *realname; - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); const char *pass = purple_connection_get_password(gc); if (pass && *pass) { @@ -485,7 +486,7 @@ static void irc_login_cb(gpointer data, gint source, const gchar *error_message) { PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); if (source < 0) { gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), @@ -508,7 +509,7 @@ gpointer data) { PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); irc->gsc = NULL; @@ -517,7 +518,7 @@ static void irc_close(PurpleConnection *gc) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); if (irc == NULL) return; @@ -558,7 +559,7 @@ static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); char *plain; const char *args[2]; @@ -574,7 +575,7 @@ static void irc_get_info(PurpleConnection *gc, const char *who) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); const char *args[2]; args[0] = who; args[1] = NULL; @@ -589,7 +590,7 @@ const char *status_id = purple_status_get_id(status); g_return_if_fail(gc != NULL); - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); if (!purple_status_is_active(status)) return; @@ -606,9 +607,9 @@ } } -static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) +static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) { - struct irc_conn *irc = (struct irc_conn *)gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); struct irc_buddy *ib; const char *bname = purple_buddy_get_name(buddy); @@ -633,7 +634,7 @@ static void irc_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - struct irc_conn *irc = (struct irc_conn *)gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); struct irc_buddy *ib; ib = g_hash_table_lookup(irc->buddies, purple_buddy_get_name(buddy)); @@ -678,7 +679,7 @@ { PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); int len; if(!g_list_find(purple_connections_get_all(), gc)) { @@ -716,7 +717,7 @@ static void irc_input_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); int len; if (irc->inbuflen < irc->inbufused + IRC_INITIAL_BUFSIZE) { @@ -746,7 +747,7 @@ static void irc_chat_join (PurpleConnection *gc, GHashTable *data) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); const char *args[2]; args[0] = g_hash_table_lookup(data, "channel"); @@ -760,7 +761,7 @@ static void irc_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); PurpleConversation *convo = purple_find_chat(gc, id); const char *args[2]; @@ -776,7 +777,7 @@ static void irc_chat_leave (PurpleConnection *gc, int id) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); PurpleConversation *convo = purple_find_chat(gc, id); const char *args[2]; @@ -791,7 +792,7 @@ static int irc_chat_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); PurpleConversation *convo = purple_find_chat(gc, id); const char *args[2]; char *tmp; @@ -845,7 +846,7 @@ const char *name = NULL; struct irc_conn *irc; - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); name = purple_conversation_get_name(purple_find_chat(gc, id)); if (name == NULL) @@ -863,7 +864,7 @@ PurpleRoomlistField *f; char *buf; - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); if (irc->roomlist) purple_roomlist_unref(irc->roomlist); @@ -897,7 +898,7 @@ if (gc == NULL) return; - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); purple_roomlist_set_in_progress(list, FALSE); @@ -909,13 +910,14 @@ static void irc_keepalive(PurpleConnection *gc) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); if ((time(NULL) - irc->recv_time) > PING_TIMEOUT) irc_cmd_ping(irc, NULL, NULL, NULL); } static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_SLASH_COMMANDS_NATIVE, NULL, /* user_splits */ @@ -957,7 +959,6 @@ irc_keepalive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ NULL, /* alias_buddy */ NULL, /* group_buddy */ NULL, /* rename_group */ @@ -982,15 +983,12 @@ NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static gboolean load_plugin (PurplePlugin *plugin) {