pidgin.openq: 30343dc1: Code clean
ccpaging at pidgin.im
ccpaging at pidgin.im
Wed Dec 3 23:20:46 EST 2008
-----------------------------------------------------------------
Revision: 30343dc1443705dfa4b4f57fafac357e5c9f4831
Ancestor: c71808eb5bca5b5749933bdcf77e62422ec35ef3
Author: ccpaging at pidgin.im
Date: 2008-11-11T07:17:48
Branch: im.pidgin.pidgin.openq
URL: http://d.pidgin.im/viewmtn/revision/info/30343dc1443705dfa4b4f57fafac357e5c9f4831
Modified files:
libpurple/protocols/qq/qq.c
ChangeLog:
Code clean
-------------- next part --------------
============================================================
--- libpurple/protocols/qq/qq.c 939188f0e1ae79ec4538a046dd114f09495d569b
+++ libpurple/protocols/qq/qq.c 7cef0b77f1596fd61d31792fe53dc3b6f0de3f4e
@@ -94,7 +94,7 @@ static void server_list_create(PurpleAcc
PurpleConnection *gc;
qq_data *qd;
PurpleProxyInfo *gpi;
- const gchar *user_server;
+ const gchar *custom_server;
gc = purple_account_get_connection(account);
g_return_if_fail(gc != NULL && gc->proto_data != NULL);
@@ -104,10 +104,10 @@ static void server_list_create(PurpleAcc
qd->use_tcp = purple_account_get_bool(account, "use_tcp", TRUE);
- user_server = purple_account_get_string(account, "server", NULL);
- purple_debug_info("QQ", "Select server '%s'\n", user_server);
- if ( (user_server != NULL && strlen(user_server) > 0) && strcasecmp(user_server, "auto") != 0) {
- qd->servers = g_list_append(qd->servers, g_strdup(user_server));
+ custom_server = purple_account_get_string(account, "server", NULL);
+ purple_debug_info("QQ", "Select server '%s'\n", custom_server);
+ if ( (custom_server != NULL && strlen(custom_server) > 0) && strcasecmp(custom_server, "auto") != 0) {
+ qd->servers = g_list_append(qd->servers, g_strdup(custom_server));
return;
}
@@ -442,110 +442,6 @@ static void qq_change_status(PurpleAccou
qq_request_change_status(gc, 0);
}
-static void qq_add_deny(PurpleConnection *gc, const char *who)
-{
- qq_data *qd;
- g_return_if_fail(NULL != gc && NULL != gc->proto_data);
-
- qd = (qq_data *) gc->proto_data;
- if (!qd->is_login)
- return;
-
- if (!who || who[0] == '\0')
- return;
-
- purple_debug_info("QQ", "Add deny for %s\n", who);
-}
-
-static void qq_rem_deny(PurpleConnection *gc, const char *who)
-{
- qq_data *qd;
- g_return_if_fail(NULL != gc && NULL != gc->proto_data);
-
- qd = (qq_data *) gc->proto_data;
- if (!qd->is_login)
- return;
-
- if (!who || who[0] == '\0')
- return;
-
- purple_debug_info("QQ", "Rem deny for %s\n", who);
-}
-
-static void qq_set_permit_deny(PurpleConnection *gc)
-{
- PurpleAccount *account;
- GSList *deny;
-
- purple_debug_info("QQ", "Set permit deny\n");
- account = purple_connection_get_account(gc);
- switch (account->perm_deny)
- {
- case PURPLE_PRIVACY_ALLOW_ALL:
- for (deny = account->deny; deny; deny = deny->next)
- qq_rem_deny(gc, deny->data);
- break;
-
- case PURPLE_PRIVACY_ALLOW_BUDDYLIST:
- case PURPLE_PRIVACY_ALLOW_USERS:
- case PURPLE_PRIVACY_DENY_USERS:
- case PURPLE_PRIVACY_DENY_ALL:
- for (deny = account->deny; deny; deny = deny->next)
- qq_add_deny(gc, deny->data);
- break;
- }
-}
-
-/* IMPORTANT: PurpleConvImFlags -> PurpleMessageFlags */
-/* send an instant msg to a buddy */
-static gint qq_send_im(PurpleConnection *gc, const gchar *who, const gchar *message, PurpleMessageFlags flags)
-{
- gint type, uid_to;
- gchar *msg, *msg_with_qq_smiley;
- qq_data *qd;
-
- g_return_val_if_fail(who != NULL, -1);
-
- qd = (qq_data *) gc->proto_data;
-
- g_return_val_if_fail(strlen(message) <= QQ_MSG_IM_MAX, -E2BIG);
-
- type = (flags == PURPLE_MESSAGE_AUTO_RESP ? QQ_IM_AUTO_REPLY : QQ_IM_TEXT);
- uid_to = purple_name_to_uid(who);
-
- /* if msg is to myself, bypass the network */
- if (uid_to == qd->uid) {
- serv_got_im(gc, who, message, flags, time(NULL));
- } else {
- msg = utf8_to_qq(message, QQ_CHARSET_DEFAULT);
- msg_with_qq_smiley = purple_smiley_to_qq(msg);
- qq_request_send_im(gc, uid_to, msg_with_qq_smiley, type);
- g_free(msg);
- g_free(msg_with_qq_smiley);
- }
-
- return 1;
-}
-
-/* send a chat msg to a QQ Qun */
-static int qq_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags)
-{
- gchar *msg, *msg_with_qq_smiley;
- guint32 room_id = id;
-
- g_return_val_if_fail(message != NULL, -1);
- g_return_val_if_fail(strlen(message) <= QQ_MSG_IM_MAX, -E2BIG);
-
- purple_debug_info("QQ_MESG", "Send qun mesg in utf8: %s\n", message);
- msg = utf8_to_qq(message, QQ_CHARSET_DEFAULT);
- msg_with_qq_smiley = purple_smiley_to_qq(msg);
- qq_request_room_send_im(gc, room_id, msg_with_qq_smiley);
- g_free(msg);
- g_free(msg_with_qq_smiley);
-
- return 1;
-}
-
/* send packet to get who's detailed information */
static void qq_show_buddy_info(PurpleConnection *gc, const gchar *who)
{
@@ -809,7 +705,7 @@ static void action_chat_quit(PurpleBlist
g_return_if_fail(components != NULL);
num_str = g_hash_table_lookup(components, QQ_ROOM_KEY_INTERNAL_ID);
- room_id = strtol(num_str, NULL, 10);
+ room_id = strtoul(num_str, NULL, 10);
g_return_if_fail(room_id != 0);
qq_room_quit(gc, room_id);
@@ -828,7 +724,7 @@ static void action_chat_get_info(PurpleB
g_return_if_fail(components != NULL);
num_str = g_hash_table_lookup(components, QQ_ROOM_KEY_INTERNAL_ID);
- room_id = strtol(num_str, NULL, 10);
+ room_id = strtoul(num_str, NULL, 10);
g_return_if_fail(room_id != 0);
qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, room_id, NULL, 0,
@@ -1041,26 +937,26 @@ static PurplePluginProtocolInfo prpl_inf
qq_status_types, /* away_states */
qq_blist_node_menu, /* blist_node_menu */
qq_chat_info, /* chat_info */
- qq_chat_info_defaults, /* chat_info_defaults */
- qq_login, /* open */
- qq_close, /* close */
- qq_send_im, /* send_im */
+ qq_chat_info_defaults, /* chat_info_defaults */
+ qq_login, /* open */
+ qq_close, /* close */
+ qq_send_im, /* send_im */
NULL, /* set_info */
NULL, /* send_typing */
- qq_show_buddy_info, /* get_info */
- qq_change_status, /* change status */
+ qq_show_buddy_info, /* get_info */
+ qq_change_status, /* change status */
NULL, /* set_idle */
NULL, /* change_passwd */
- qq_add_buddy, /* add_buddy */
+ qq_add_buddy, /* add_buddy */
NULL, /* add_buddies */
- qq_remove_buddy, /* remove_buddy */
+ qq_remove_buddy, /* remove_buddy */
NULL, /* remove_buddies */
NULL, /* add_permit */
- qq_add_deny, /* add_deny */
+ NULL, /* add_deny */
NULL, /* rem_permit */
NULL, /* rem_deny */
- qq_set_permit_deny, /* set_permit_deny */
- qq_group_join, /* join_chat */
+ NULL, /* set_permit_deny */
+ qq_group_join, /* join_chat */
NULL, /* reject chat invite */
NULL, /* get_chat_name */
NULL, /* chat_invite */
@@ -1079,11 +975,11 @@ static PurplePluginProtocolInfo prpl_inf
NULL, /* normalize */
qq_set_custom_icon,
NULL, /* remove_group */
- qq_get_chat_buddy_real_name, /* get_cb_real_name */
+ qq_get_chat_buddy_real_name, /* get_cb_real_name */
NULL, /* set_chat_topic */
NULL, /* find_blist_chat */
- qq_roomlist_get_list, /* roomlist_get_list */
- qq_roomlist_cancel, /* roomlist_cancel */
+ qq_roomlist_get_list, /* roomlist_get_list */
+ qq_roomlist_cancel, /* roomlist_cancel */
NULL, /* roomlist_expand_category */
NULL, /* can_receive_file */
NULL, /* qq_send_file send_file */
@@ -1213,7 +1109,7 @@ static void init_plugin(PurplePlugin *pl
purple_prefs_add_none("/plugins/prpl/qq");
purple_prefs_add_bool("/plugins/prpl/qq/show_status_by_icon", TRUE);
purple_prefs_add_bool("/plugins/prpl/qq/show_fake_video", FALSE);
- purple_prefs_add_bool("/plugins/prpl/qq/auto_popup_conversation", FALSE);
+ purple_prefs_add_bool("/plugins/prpl/qq/auto_popup_conversation", TRUE);
purple_prefs_add_bool("/plugins/prpl/qq/auto_get_authorize_info", TRUE);
purple_prefs_add_int("/plugins/prpl/qq/resend_interval", 3);
purple_prefs_add_int("/plugins/prpl/qq/resend_times", 10);
More information about the Commits
mailing list