diff options
author | Evan Schoenberg <evands@pidgin.im> | 2007-12-29 06:34:59 +0000 |
---|---|---|
committer | Evan Schoenberg <evands@pidgin.im> | 2007-12-29 06:34:59 +0000 |
commit | ab54b9fc4fd6eef893b2a479caea9d1f89155c9f (patch) | |
tree | 6f560d8668f60d46564e2b1d34e45cf8c1163608 /libpurple/protocols/qq | |
parent | 765435eebfb2fe926650bb49857169263f98d90e (diff) | |
parent | 34833c5d8c3a410b19cc6d6f771b750ba42c849e (diff) | |
download | pidgin-ab54b9fc4fd6eef893b2a479caea9d1f89155c9f.tar.gz |
propagate from branch 'im.pidgin.pidgin' (head 5157ec7a2b6f7025fc0f6ed1f1093a725cfcf6f3)
to branch 'im.pidgin.pidgin.vv' (head defa6a4f45cc62c068c5225768278fcf586ac32c)
Diffstat (limited to 'libpurple/protocols/qq')
64 files changed, 211 insertions, 170 deletions
diff --git a/libpurple/protocols/qq/buddy_info.c b/libpurple/protocols/qq/buddy_info.c index 1c7dc79f61..325158a5a5 100644 --- a/libpurple/protocols/qq/buddy_info.c +++ b/libpurple/protocols/qq/buddy_info.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" @@ -306,12 +306,10 @@ static void modify_info_cancel_cb(modify_info_data *mid) g_free(mid); } -static gchar *parse_field(GList **list, gboolean choice) +static gchar *parse_field(PurpleRequestField *field, gboolean choice) { gchar *value; - PurpleRequestField *field; - field = (PurpleRequestField *) (*list)->data; if (choice) { value = g_strdup_printf("%d", purple_request_field_choice_get_value(field)); } else { @@ -321,7 +319,6 @@ static gchar *parse_field(GList **list, gboolean choice) else value = utf8_to_qq(value, QQ_CHARSET_DEFAULT); } - *list = g_list_remove_link(*list, *list); return value; } @@ -331,7 +328,7 @@ static void modify_info_ok_cb(modify_info_data *mid, PurpleRequestFields *fields { PurpleConnection *gc; qq_data *qd; - GList *list, *groups; + GList *groups; contact_info *info; gc = mid->gc; @@ -341,33 +338,76 @@ static void modify_info_ok_cb(modify_info_data *mid, PurpleRequestFields *fields info = mid->info; groups = purple_request_fields_get_groups(fields); - list = purple_request_field_group_get_fields(groups->data); - info->uid = parse_field(&list, FALSE); - info->nick = parse_field(&list, FALSE); - info->name = parse_field(&list, FALSE); - info->age = parse_field(&list, FALSE); - info->gender = parse_field(&list, TRUE); - info->country = parse_field(&list, FALSE); - info->province = parse_field(&list, FALSE); - info->city = parse_field(&list, FALSE); - groups = g_list_remove_link(groups, groups); - list = purple_request_field_group_get_fields(groups->data); - info->horoscope = parse_field(&list, TRUE); - info->occupation = parse_field(&list, FALSE); - info->zodiac = parse_field(&list, TRUE); - info->blood = parse_field(&list, TRUE); - info->college = parse_field(&list, FALSE); - info->email = parse_field(&list, FALSE); - info->address = parse_field(&list, FALSE); - info->zipcode = parse_field(&list, FALSE); - info->hp_num = parse_field(&list, FALSE); - info->tel = parse_field(&list, FALSE); - info->homepage = parse_field(&list, FALSE); - groups = g_list_remove_link(groups, groups); - list = purple_request_field_group_get_fields(groups->data); - info->intro = parse_field(&list, FALSE); - groups = g_list_remove_link(groups, groups); + while (groups != NULL) { + PurpleRequestFieldGroup *group = groups->data; + const char *g_name = purple_request_field_group_get_title(group); + GList *fields = purple_request_field_group_get_fields(group); + + if (g_name == NULL) + continue; + + while (fields != NULL) { + PurpleRequestField *field = fields->data; + const char *f_id = purple_request_field_get_id(field); + + if (!strcmp(QQ_PRIMARY_INFORMATION, g_name)) { + + if (!strcmp(f_id, "uid")) + info->uid = parse_field(field, FALSE); + else if (!strcmp(f_id, "nick")) + info->nick = parse_field(field, FALSE); + else if (!strcmp(f_id, "name")) + info->name = parse_field(field, FALSE); + else if (!strcmp(f_id, "age")) + info->age = parse_field(field, FALSE); + else if (!strcmp(f_id, "gender")) + info->gender = parse_field(field, TRUE); + else if (!strcmp(f_id, "country")) + info->country = parse_field(field, FALSE); + else if (!strcmp(f_id, "province")) + info->province = parse_field(field, FALSE); + else if (!strcmp(f_id, "city")) + info->city = parse_field(field, FALSE); + + } else if (!strcmp(QQ_ADDITIONAL_INFORMATION, g_name)) { + + if (!strcmp(f_id, "horoscope")) + info->horoscope = parse_field(field, TRUE); + else if (!strcmp(f_id, "occupation")) + info->occupation = parse_field(field, FALSE); + else if (!strcmp(f_id, "zodiac")) + info->zodiac = parse_field(field, TRUE); + else if (!strcmp(f_id, "blood")) + info->blood = parse_field(field, TRUE); + else if (!strcmp(f_id, "college")) + info->college = parse_field(field, FALSE); + else if (!strcmp(f_id, "email")) + info->email = parse_field(field, FALSE); + else if (!strcmp(f_id, "address")) + info->address = parse_field(field, FALSE); + else if (!strcmp(f_id, "zipcode")) + info->zipcode = parse_field(field, FALSE); + else if (!strcmp(f_id, "hp_num")) + info->hp_num = parse_field(field, FALSE); + else if (!strcmp(f_id, "tel")) + info->tel = parse_field(field, FALSE); + else if (!strcmp(f_id, "homepage")) + info->homepage = parse_field(field, FALSE); + + } else if (!strcmp(QQ_INTRO, g_name)) { + + if (!strcmp(f_id, "intro")) + info->intro = parse_field(field, FALSE); + + } + + fields = fields->next; + } + + groups = groups->next; + } + /* This casting looks like a horrible idea to me -DAA */ qq_send_packet_modify_info(gc, (gchar **) info); g_strfreev((gchar **) mid->info); @@ -437,6 +477,7 @@ static void create_modify_info_dialogue(PurpleConnection *gc, const contact_info add_string_field_to_group(group, "country", QQ_COUNTRY, info->country); add_string_field_to_group(group, "province", QQ_PROVINCE, info->province); add_string_field_to_group(group, "city", QQ_CITY, info->city); + group = setup_field_group(fields, QQ_ADDITIONAL_INFORMATION); add_choice_field_to_group(group, "horoscope", QQ_HOROSCOPE, info->horoscope, horoscope_names, QQ_HOROSCOPE_SIZE); add_string_field_to_group(group, "occupation", QQ_OCCUPATION, info->occupation); diff --git a/libpurple/protocols/qq/buddy_info.h b/libpurple/protocols/qq/buddy_info.h index 4176678120..7e121f5d1f 100644 --- a/libpurple/protocols/qq/buddy_info.h +++ b/libpurple/protocols/qq/buddy_info.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_BUDDY_INFO_H_ diff --git a/libpurple/protocols/qq/buddy_list.c b/libpurple/protocols/qq/buddy_list.c index 44ebf5aa12..92dacd0049 100644 --- a/libpurple/protocols/qq/buddy_list.c +++ b/libpurple/protocols/qq/buddy_list.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include <string.h> diff --git a/libpurple/protocols/qq/buddy_list.h b/libpurple/protocols/qq/buddy_list.h index 4527bc584d..c546ccd6c6 100644 --- a/libpurple/protocols/qq/buddy_list.h +++ b/libpurple/protocols/qq/buddy_list.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_BUDDY_LIST_H_ diff --git a/libpurple/protocols/qq/buddy_opt.c b/libpurple/protocols/qq/buddy_opt.c index 60e2eb85f4..417eb465fe 100644 --- a/libpurple/protocols/qq/buddy_opt.c +++ b/libpurple/protocols/qq/buddy_opt.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "debug.h" diff --git a/libpurple/protocols/qq/buddy_opt.h b/libpurple/protocols/qq/buddy_opt.h index 2c527967a3..ea8913aafc 100644 --- a/libpurple/protocols/qq/buddy_opt.h +++ b/libpurple/protocols/qq/buddy_opt.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_BUDDY_OPT_H_ diff --git a/libpurple/protocols/qq/buddy_status.c b/libpurple/protocols/qq/buddy_status.c index a662501ff6..186c48d622 100644 --- a/libpurple/protocols/qq/buddy_status.c +++ b/libpurple/protocols/qq/buddy_status.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include <string.h> diff --git a/libpurple/protocols/qq/buddy_status.h b/libpurple/protocols/qq/buddy_status.h index 509be7975e..e358c9c2e4 100644 --- a/libpurple/protocols/qq/buddy_status.h +++ b/libpurple/protocols/qq/buddy_status.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * */ diff --git a/libpurple/protocols/qq/char_conv.c b/libpurple/protocols/qq/char_conv.c index 11ab46603a..627aacd86d 100644 --- a/libpurple/protocols/qq/char_conv.c +++ b/libpurple/protocols/qq/char_conv.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "debug.h" diff --git a/libpurple/protocols/qq/char_conv.h b/libpurple/protocols/qq/char_conv.h index e2c7a6131e..fc3e671af1 100644 --- a/libpurple/protocols/qq/char_conv.h +++ b/libpurple/protocols/qq/char_conv.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_CHAR_CONV_H_ diff --git a/libpurple/protocols/qq/crypt.c b/libpurple/protocols/qq/crypt.c index 8baf8d44f7..d78cb7594a 100644 --- a/libpurple/protocols/qq/crypt.c +++ b/libpurple/protocols/qq/crypt.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * * * QQ encryption algorithm diff --git a/libpurple/protocols/qq/crypt.h b/libpurple/protocols/qq/crypt.h index 303d2cafd1..9f9ec91e13 100644 --- a/libpurple/protocols/qq/crypt.h +++ b/libpurple/protocols/qq/crypt.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_CRYPT_H_ diff --git a/libpurple/protocols/qq/file_trans.c b/libpurple/protocols/qq/file_trans.c index 376c9334b2..9fc1dbfd9c 100644 --- a/libpurple/protocols/qq/file_trans.c +++ b/libpurple/protocols/qq/file_trans.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifdef _WIN32 diff --git a/libpurple/protocols/qq/file_trans.h b/libpurple/protocols/qq/file_trans.h index 4d5626736c..18c6bd1b7b 100644 --- a/libpurple/protocols/qq/file_trans.h +++ b/libpurple/protocols/qq/file_trans.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_QQ_FILE_TRANS_H_ diff --git a/libpurple/protocols/qq/group.c b/libpurple/protocols/qq/group.c index 517c0a9366..e31e374260 100644 --- a/libpurple/protocols/qq/group.c +++ b/libpurple/protocols/qq/group.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" diff --git a/libpurple/protocols/qq/group.h b/libpurple/protocols/qq/group.h index 94a8a24576..56fe705eda 100644 --- a/libpurple/protocols/qq/group.h +++ b/libpurple/protocols/qq/group.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_GROUP_H_ diff --git a/libpurple/protocols/qq/group_conv.c b/libpurple/protocols/qq/group_conv.c index bfdcda6667..d75fe130f5 100644 --- a/libpurple/protocols/qq/group_conv.c +++ b/libpurple/protocols/qq/group_conv.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include <glib.h> diff --git a/libpurple/protocols/qq/group_conv.h b/libpurple/protocols/qq/group_conv.h index e7ff503501..ef9cfe030e 100644 --- a/libpurple/protocols/qq/group_conv.h +++ b/libpurple/protocols/qq/group_conv.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_GROUP_CONV_H_ diff --git a/libpurple/protocols/qq/group_find.c b/libpurple/protocols/qq/group_find.c index ed561e07bb..6b8ea92820 100644 --- a/libpurple/protocols/qq/group_find.c +++ b/libpurple/protocols/qq/group_find.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "qq.h" diff --git a/libpurple/protocols/qq/group_find.h b/libpurple/protocols/qq/group_find.h index 31b6d2e31f..b5d5fb714f 100644 --- a/libpurple/protocols/qq/group_find.h +++ b/libpurple/protocols/qq/group_find.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_GROUP_FIND_H_ diff --git a/libpurple/protocols/qq/group_free.c b/libpurple/protocols/qq/group_free.c index 44afd51f2b..f1eab11795 100644 --- a/libpurple/protocols/qq/group_free.c +++ b/libpurple/protocols/qq/group_free.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" diff --git a/libpurple/protocols/qq/group_free.h b/libpurple/protocols/qq/group_free.h index 6363d1c482..dc90a7e1b9 100644 --- a/libpurple/protocols/qq/group_free.h +++ b/libpurple/protocols/qq/group_free.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_GROUP_FREE_H_ diff --git a/libpurple/protocols/qq/group_im.c b/libpurple/protocols/qq/group_im.c index 41f81695dc..0cf87d3420 100644 --- a/libpurple/protocols/qq/group_im.c +++ b/libpurple/protocols/qq/group_im.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" diff --git a/libpurple/protocols/qq/group_im.h b/libpurple/protocols/qq/group_im.h index 4b46ff7ec7..4b5a373965 100644 --- a/libpurple/protocols/qq/group_im.h +++ b/libpurple/protocols/qq/group_im.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_GROUP_IM_H_ diff --git a/libpurple/protocols/qq/group_info.c b/libpurple/protocols/qq/group_info.c index 797cebf6e8..190449c23f 100644 --- a/libpurple/protocols/qq/group_info.c +++ b/libpurple/protocols/qq/group_info.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" diff --git a/libpurple/protocols/qq/group_info.h b/libpurple/protocols/qq/group_info.h index 0c611358f2..be3208440b 100644 --- a/libpurple/protocols/qq/group_info.h +++ b/libpurple/protocols/qq/group_info.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_GROUP_INFO_H_ diff --git a/libpurple/protocols/qq/group_internal.c b/libpurple/protocols/qq/group_internal.c index e6f6ead374..5af15b1a7e 100644 --- a/libpurple/protocols/qq/group_internal.c +++ b/libpurple/protocols/qq/group_internal.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" diff --git a/libpurple/protocols/qq/group_internal.h b/libpurple/protocols/qq/group_internal.h index 4ecd2dcf6a..123f5dd922 100644 --- a/libpurple/protocols/qq/group_internal.h +++ b/libpurple/protocols/qq/group_internal.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_GROUP_HASH_H_ diff --git a/libpurple/protocols/qq/group_join.c b/libpurple/protocols/qq/group_join.c index c0740dda2e..8debc1645f 100644 --- a/libpurple/protocols/qq/group_join.c +++ b/libpurple/protocols/qq/group_join.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" diff --git a/libpurple/protocols/qq/group_join.h b/libpurple/protocols/qq/group_join.h index 57158bce88..5c42e31ed5 100644 --- a/libpurple/protocols/qq/group_join.h +++ b/libpurple/protocols/qq/group_join.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_GROUP_JOIN_H_ diff --git a/libpurple/protocols/qq/group_network.c b/libpurple/protocols/qq/group_network.c index 1ae714ee23..e65f97dd40 100644 --- a/libpurple/protocols/qq/group_network.c +++ b/libpurple/protocols/qq/group_network.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" diff --git a/libpurple/protocols/qq/group_network.h b/libpurple/protocols/qq/group_network.h index 6984fd26d0..972eb95430 100644 --- a/libpurple/protocols/qq/group_network.h +++ b/libpurple/protocols/qq/group_network.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_GROUP_NETWORK_H_ diff --git a/libpurple/protocols/qq/group_opt.c b/libpurple/protocols/qq/group_opt.c index 57391696fb..76f694b091 100644 --- a/libpurple/protocols/qq/group_opt.c +++ b/libpurple/protocols/qq/group_opt.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "qq.h" @@ -39,37 +39,12 @@ #include "packet_parse.h" #include "utils.h" -/* TODO: can't we use qsort here? */ -/* This implement quick sort algorithm (low->high) */ -static void _quick_sort(gint *numbers, gint left, gint right) +static int _compare_guint32(const void *a, + const void *b) { - gint pivot, l_hold, r_hold; - - l_hold = left; - r_hold = right; - pivot = numbers[left]; - while (left < right) { - while ((numbers[right] >= pivot) && (left < right)) - right--; - if (left != right) { - numbers[left] = numbers[right]; - left++; - } - while ((numbers[left] <= pivot) && (left < right)) - left++; - if (left != right) { - numbers[right] = numbers[left]; - right--; - } - } - numbers[left] = pivot; - pivot = left; - left = l_hold; - right = r_hold; - if (left < pivot) - _quick_sort(numbers, left, pivot - 1); - if (right > pivot) - _quick_sort(numbers, pivot + 1, right); + const guint32 *x = a; + const guint32 *y = b; + return (*x - *y); } static void _sort(guint32 *list) @@ -77,7 +52,7 @@ static void _sort(guint32 *list) gint i; for (i = 0; list[i] < 0xffffffff; i++) {; } - _quick_sort((gint *) list, 0, i - 1); + qsort (list, i, sizeof (guint32), _compare_guint32); } static void _qq_group_member_opt(PurpleConnection *gc, qq_group *group, gint operation, guint32 *members) diff --git a/libpurple/protocols/qq/group_opt.h b/libpurple/protocols/qq/group_opt.h index 699ffb58c4..4aa09a7e0d 100644 --- a/libpurple/protocols/qq/group_opt.h +++ b/libpurple/protocols/qq/group_opt.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_GROUP_OPT_H_ diff --git a/libpurple/protocols/qq/group_search.c b/libpurple/protocols/qq/group_search.c index 8a55c870f7..fe5789b928 100644 --- a/libpurple/protocols/qq/group_search.c +++ b/libpurple/protocols/qq/group_search.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" diff --git a/libpurple/protocols/qq/group_search.h b/libpurple/protocols/qq/group_search.h index eaeec1423b..46b889a2fc 100644 --- a/libpurple/protocols/qq/group_search.h +++ b/libpurple/protocols/qq/group_search.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_GROUP_SEARCH_H_ diff --git a/libpurple/protocols/qq/header_info.c b/libpurple/protocols/qq/header_info.c index 45792763a4..8366dd1bef 100644 --- a/libpurple/protocols/qq/header_info.c +++ b/libpurple/protocols/qq/header_info.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" @@ -35,6 +35,7 @@ #define QQ_CLIENT_0B35 0x0b35 /* GB QQ2003iii build 0304 (offical release) */ #define QQ_CLIENT_0B37 0x0b37 /* GB QQ2003iii build 0304 (April 05 updates) */ #define QQ_CLIENT_0E1B 0x0e1b /* QQ2005? QQ2006? */ +#define QQ_CLIENT_0E35 0x0e35 /* EN QQ2005 V05.0.200.020 */ #define QQ_CLIENT_0F15 0x0f15 /* QQ2006 Spring Festival build */ #define QQ_CLIENT_0F5F 0x0f5f /* QQ2006 final build */ @@ -115,6 +116,8 @@ const gchar *qq_get_source_str(gint source) return "GB QQ2003iii build 0304 (April 5 update)"; case QQ_CLIENT_0E1B: return "QQ2005 or QQ2006"; + case QQ_CLIENT_0E35: + return "En QQ2005 V05.0.200.020"; case QQ_CLIENT_0F15: return "QQ2006 Spring Festival build"; case QQ_CLIENT_0F5F: diff --git a/libpurple/protocols/qq/header_info.h b/libpurple/protocols/qq/header_info.h index 2d2872e37a..d56daf7e97 100644 --- a/libpurple/protocols/qq/header_info.h +++ b/libpurple/protocols/qq/header_info.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_HEADER_INFO_H_ @@ -33,7 +33,7 @@ #define QQ_PACKET_TAG 0x02 /* all QQ text packets starts with it */ #define QQ_PACKET_TAIL 0x03 /* all QQ text packets end with it */ -#define QQ_CLIENT 0x0E1B +#define QQ_CLIENT 0x0d55 /* list of known QQ commands */ enum { diff --git a/libpurple/protocols/qq/im.c b/libpurple/protocols/qq/im.c index ddf893edc5..158126e990 100644 --- a/libpurple/protocols/qq/im.c +++ b/libpurple/protocols/qq/im.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" diff --git a/libpurple/protocols/qq/im.h b/libpurple/protocols/qq/im.h index 4f167529e3..bbdda78fd5 100644 --- a/libpurple/protocols/qq/im.h +++ b/libpurple/protocols/qq/im.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_IM_H_ diff --git a/libpurple/protocols/qq/keep_alive.c b/libpurple/protocols/qq/keep_alive.c index eae0266f01..afc7d1bc75 100644 --- a/libpurple/protocols/qq/keep_alive.c +++ b/libpurple/protocols/qq/keep_alive.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * * * OICQ encryption algorithm @@ -84,7 +84,8 @@ void qq_process_keep_alive_reply(guint8 *buf, gint buf_len, PurpleConnection *gc /* segments[0] and segment[1] are all 0x30 ("0") */ qd->all_online = strtol(segments[2], NULL, 10); if(0 == qd->all_online) - purple_connection_error(gc, _("Keep alive error")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Keep alive error")); g_free(qd->my_ip); qd->my_ip = g_strdup(segments[3]); qd->my_port = strtol(segments[4], NULL, 10); diff --git a/libpurple/protocols/qq/keep_alive.h b/libpurple/protocols/qq/keep_alive.h index 4c65f0f348..cddba2fdcc 100644 --- a/libpurple/protocols/qq/keep_alive.h +++ b/libpurple/protocols/qq/keep_alive.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * */ diff --git a/libpurple/protocols/qq/login_logout.c b/libpurple/protocols/qq/login_logout.c index 234af3c439..b9552bd364 100644 --- a/libpurple/protocols/qq/login_logout.c +++ b/libpurple/protocols/qq/login_logout.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "debug.h" @@ -380,33 +380,33 @@ static void qq_send_packet_login(PurpleConnection *gc, guint8 token_length, guin void qq_process_request_login_token_reply(guint8 *buf, gint buf_len, PurpleConnection *gc) { - qq_data *qd; + qq_data *qd; gchar *hex_dump; - g_return_if_fail(buf != NULL && buf_len != 0); + g_return_if_fail(buf != NULL && buf_len != 0); - qd = (qq_data *) gc->proto_data; + qd = (qq_data *) gc->proto_data; if (buf[0] == QQ_REQUEST_LOGIN_TOKEN_REPLY_OK) { if (buf[1] != buf_len-2) { - purple_debug(PURPLE_DEBUG_INFO, "QQ", + purple_debug(PURPLE_DEBUG_INFO, "QQ", "Malformed login token reply packet. Packet specifies length of %d, actual length is %d\n", buf[1], buf_len-2); purple_debug(PURPLE_DEBUG_INFO, "QQ", "Attempting to proceed with the actual packet length.\n"); } hex_dump = hex_dump_to_str(buf+2, buf_len-2); purple_debug(PURPLE_DEBUG_INFO, "QQ", - "<<< got a token with %d bytes -> [default] decrypt and dump\n%s", buf_len-2, hex_dump); + "<<< got a token with %d bytes -> [default] decrypt and dump\n%s", buf_len-2, hex_dump); qq_send_packet_login(gc, buf_len-2, buf+2); } else { purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Unknown request login token reply code : %d\n", buf[0]); hex_dump = hex_dump_to_str(buf, buf_len); - purple_debug(PURPLE_DEBUG_WARNING, "QQ", - ">>> %d bytes -> [default] decrypt and dump\n%s", - buf_len, hex_dump); - try_dump_as_gbk(buf, buf_len); - purple_connection_error(gc, _("Error requesting login token")); - } + purple_debug(PURPLE_DEBUG_WARNING, "QQ", + ">>> %d bytes -> [default] decrypt and dump\n%s", + buf_len, hex_dump); + try_dump_as_gbk(buf, buf_len); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Error requesting login token")); + } g_free(hex_dump); } @@ -463,11 +463,11 @@ void qq_process_login_reply(guint8 *buf, gint buf_len, PurpleConnection *gc) default: purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Unknown reply code: %d\n", data[0]); hex_dump = hex_dump_to_str(data, len); - purple_debug(PURPLE_DEBUG_WARNING, "QQ", - ">>> %d bytes -> [default] decrypt and dump\n%s", - buf_len, hex_dump); + purple_debug(PURPLE_DEBUG_WARNING, "QQ", + ">>> %d bytes -> [default] decrypt and dump\n%s", + buf_len, hex_dump); g_free(hex_dump); - try_dump_as_gbk(data, len); + try_dump_as_gbk(data, len); ret = QQ_LOGIN_REPLY_MISC_ERROR; } @@ -479,11 +479,14 @@ void qq_process_login_reply(guint8 *buf, gint buf_len, PurpleConnection *gc) switch (ret) { case QQ_LOGIN_REPLY_PWD_ERROR: - gc->wants_to_die = TRUE; - purple_connection_error(gc, _("Incorrect password.")); + if (!purple_account_get_remember_password(gc->account)) + purple_account_set_password(gc->account, NULL); + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password.")); break; case QQ_LOGIN_REPLY_MISC_ERROR: - purple_connection_error(gc, _("Unable to login, check debug log")); + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to login, check debug log")); break; case QQ_LOGIN_REPLY_OK: purple_debug(PURPLE_DEBUG_INFO, "QQ", "Login replys OK, everything is fine\n"); diff --git a/libpurple/protocols/qq/login_logout.h b/libpurple/protocols/qq/login_logout.h index 941e218f6a..aa73a42e41 100644 --- a/libpurple/protocols/qq/login_logout.h +++ b/libpurple/protocols/qq/login_logout.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_LOGIN_LOGOUT_H_ diff --git a/libpurple/protocols/qq/packet_parse.c b/libpurple/protocols/qq/packet_parse.c index da64994f07..a26192731b 100644 --- a/libpurple/protocols/qq/packet_parse.c +++ b/libpurple/protocols/qq/packet_parse.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include <string.h> diff --git a/libpurple/protocols/qq/packet_parse.h b/libpurple/protocols/qq/packet_parse.h index 3a226e4a7b..65cee7719c 100644 --- a/libpurple/protocols/qq/packet_parse.h +++ b/libpurple/protocols/qq/packet_parse.h @@ -19,11 +19,11 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_PACKET_PARSE_H_ -#define _QQ_PACKED_PARSE_H_ +#define _QQ_PACKET_PARSE_H_ #include <glib.h> #include <time.h> diff --git a/libpurple/protocols/qq/qq.c b/libpurple/protocols/qq/qq.c index c1ed793390..47e5993ab8 100644 --- a/libpurple/protocols/qq/qq.c +++ b/libpurple/protocols/qq/qq.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" @@ -136,7 +136,8 @@ static void _qq_login(PurpleAccount *account) purple_connection_update_progress(gc, _("Connecting"), 0, QQ_CONNECT_STEPS); if (qq_connect(account, qq_server, strtol(qq_port, NULL, 10), use_tcp, FALSE) < 0) - purple_connection_error(gc, _("Unable to connect.")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Unable to connect.")); } /* directly goes for qq_disconnect */ @@ -720,7 +721,7 @@ static PurplePluginInfo info = { "prpl-qq", /**< id */ "QQ", /**< name */ - VERSION, /**< version */ + DISPLAY_VERSION, /**< version */ /** summary */ N_("QQ Protocol Plugin"), /** description */ diff --git a/libpurple/protocols/qq/qq.h b/libpurple/protocols/qq/qq.h index 98b76464fb..bc34455371 100644 --- a/libpurple/protocols/qq/qq.h +++ b/libpurple/protocols/qq/qq.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_QQ_H_ diff --git a/libpurple/protocols/qq/qq_proxy.c b/libpurple/protocols/qq/qq_proxy.c index 3153dec0b8..e8ad07cad8 100644 --- a/libpurple/protocols/qq/qq_proxy.c +++ b/libpurple/protocols/qq/qq_proxy.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "cipher.h" @@ -139,7 +139,7 @@ static void _qq_got_login(gpointer data, gint source, const gchar *error_message g_return_if_fail(gc != NULL && gc->proto_data != NULL); if (source < 0) { /* socket returns -1 */ - purple_connection_error(gc, error_message); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); return; } @@ -237,7 +237,7 @@ static void no_one_calls(gpointer data, gint source, PurpleInputCondition cond) close(source); purple_input_remove(phb->inpa); - purple_debug_error("proxy", "getsockopt SO_ERROR check: %s\n", strerror(error)); + purple_debug_error("proxy", "getsockopt SO_ERROR check: %s\n", g_strerror(error)); phb->func(phb->data, -1, _("Unable to connect")); return; @@ -258,18 +258,20 @@ static void no_one_calls(gpointer data, gint source, PurpleInputCondition cond) static gint _qq_proxy_none(struct PHB *phb, struct sockaddr *addr, socklen_t addrlen) { gint fd = -1; + int flags; purple_debug(PURPLE_DEBUG_INFO, "QQ", "Using UDP without proxy\n"); fd = socket(PF_INET, SOCK_DGRAM, 0); if (fd < 0) { purple_debug(PURPLE_DEBUG_ERROR, "QQ Redirect", - "Unable to create socket: %s\n", strerror(errno)); + "Unable to create socket: %s\n", g_strerror(errno)); return -1; } /* we use non-blocking mode to speed up connection */ - fcntl(fd, F_SETFL, O_NONBLOCK); + flags = fcntl(fd, F_GETFL); + fcntl(fd, F_SETFL, flags | O_NONBLOCK); /* From Unix-socket-FAQ: http://www.faqs.org/faqs/unix-faq/socket/ * @@ -295,13 +297,14 @@ static gint _qq_proxy_none(struct PHB *phb, struct sockaddr *addr, socklen_t add purple_debug(PURPLE_DEBUG_WARNING, "QQ", "Connect in asynchronous mode.\n"); phb->inpa = purple_input_add(fd, PURPLE_INPUT_WRITE, no_one_calls, phb); } else { - purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Connection failed: %d\n", strerror(errno)); + purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Connection failed: %d\n", g_strerror(errno)); close(fd); return -1; } /* if errno */ } else { /* connect returns 0 */ purple_debug(PURPLE_DEBUG_INFO, "QQ", "Connected.\n"); - fcntl(fd, F_SETFL, 0); + flags = fcntl(fd, F_GETFL); + fcntl(fd, F_SETFL, flags & ~O_NONBLOCK); phb->func(phb->data, fd, NULL); } @@ -494,7 +497,7 @@ gint qq_proxy_write(qq_data *qd, guint8 *data, gint len) ret = send(qd->fd, data, len, 0); } if (ret == -1) - purple_connection_error(qd->gc, strerror(errno)); + purple_connection_error_reason(qd->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, g_strerror(errno)); return ret; } diff --git a/libpurple/protocols/qq/qq_proxy.h b/libpurple/protocols/qq/qq_proxy.h index dd6cce7668..4358eab853 100644 --- a/libpurple/protocols/qq/qq_proxy.h +++ b/libpurple/protocols/qq/qq_proxy.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_PROXY_H diff --git a/libpurple/protocols/qq/recv_core.c b/libpurple/protocols/qq/recv_core.c index aae7f08ad4..1556c4afa5 100644 --- a/libpurple/protocols/qq/recv_core.c +++ b/libpurple/protocols/qq/recv_core.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "debug.h" @@ -306,7 +306,8 @@ void qq_input_pending(gpointer data, gint source, PurpleInputCondition cond) gc = (PurpleConnection *) data; if(cond != PURPLE_INPUT_READ) { - purple_connection_error(gc, _("Socket error")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Socket error")); return; } @@ -316,7 +317,8 @@ void qq_input_pending(gpointer data, gint source, PurpleInputCondition cond) /* here we have UDP proxy suppport */ len = qq_proxy_read(qd, buf, MAX_PACKET_SIZE); if (len <= 0) { - purple_connection_error(gc, _("Unable to read from socket")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Unable to read from socket")); return; } else { _qq_packet_process(buf, len, gc); diff --git a/libpurple/protocols/qq/recv_core.h b/libpurple/protocols/qq/recv_core.h index ddb3db763a..6353b48f85 100644 --- a/libpurple/protocols/qq/recv_core.h +++ b/libpurple/protocols/qq/recv_core.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_RECV_CORE_H_ diff --git a/libpurple/protocols/qq/send_core.c b/libpurple/protocols/qq/send_core.c index b2e99a2cb5..e7d236580d 100644 --- a/libpurple/protocols/qq/send_core.c +++ b/libpurple/protocols/qq/send_core.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "debug.h" diff --git a/libpurple/protocols/qq/send_core.h b/libpurple/protocols/qq/send_core.h index 373570d5d7..c93fa0a24a 100644 --- a/libpurple/protocols/qq/send_core.h +++ b/libpurple/protocols/qq/send_core.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_SEND_CORE_H_ diff --git a/libpurple/protocols/qq/send_file.c b/libpurple/protocols/qq/send_file.c index 8a625edcca..baaebc719b 100644 --- a/libpurple/protocols/qq/send_file.c +++ b/libpurple/protocols/qq/send_file.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "qq.h" diff --git a/libpurple/protocols/qq/send_file.h b/libpurple/protocols/qq/send_file.h index db4f410fdd..20295d596e 100644 --- a/libpurple/protocols/qq/send_file.h +++ b/libpurple/protocols/qq/send_file.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_QQ_SEND_FILE_H_ diff --git a/libpurple/protocols/qq/sendqueue.c b/libpurple/protocols/qq/sendqueue.c index 43d9a88ba4..7b35d81dcb 100644 --- a/libpurple/protocols/qq/sendqueue.c +++ b/libpurple/protocols/qq/sendqueue.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "internal.h" @@ -120,7 +120,8 @@ gboolean qq_sendqueue_timeout_callback(gpointer data) case QQ_CMD_KEEP_ALIVE: if (qd->logged_in) { purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Connection lost!\n"); - purple_connection_error(gc, _("Connection lost")); + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection lost")); qd->logged_in = FALSE; } p->resend_times = -1; @@ -128,7 +129,8 @@ gboolean qq_sendqueue_timeout_callback(gpointer data) case QQ_CMD_LOGIN: case QQ_CMD_REQUEST_LOGIN_TOKEN: if (!qd->logged_in) /* cancel login progress */ - purple_connection_error(gc, _("Login failed, no reply")); + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Login failed, no reply")); p->resend_times = -1; break; default:{ diff --git a/libpurple/protocols/qq/sendqueue.h b/libpurple/protocols/qq/sendqueue.h index 09a8e86c8a..8111cfa02b 100644 --- a/libpurple/protocols/qq/sendqueue.h +++ b/libpurple/protocols/qq/sendqueue.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_SEND_QUEUE_H_ diff --git a/libpurple/protocols/qq/sys_msg.c b/libpurple/protocols/qq/sys_msg.c index 886d719235..a899924a16 100644 --- a/libpurple/protocols/qq/sys_msg.c +++ b/libpurple/protocols/qq/sys_msg.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "debug.h" diff --git a/libpurple/protocols/qq/sys_msg.h b/libpurple/protocols/qq/sys_msg.h index 898531e1b6..31a6ef1ba4 100644 --- a/libpurple/protocols/qq/sys_msg.h +++ b/libpurple/protocols/qq/sys_msg.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_SYS_MSG_H_ diff --git a/libpurple/protocols/qq/udp_proxy_s5.c b/libpurple/protocols/qq/udp_proxy_s5.c index f6b86dc672..9807d138f4 100644 --- a/libpurple/protocols/qq/udp_proxy_s5.c +++ b/libpurple/protocols/qq/udp_proxy_s5.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "debug.h" @@ -33,6 +33,7 @@ static void _qq_s5_canread_again(gpointer data, gint source, PurpleInputConditio struct sockaddr_in sin; int len, error; socklen_t errlen; + int flags; purple_input_remove(phb->inpa); purple_debug(PURPLE_DEBUG_INFO, "socks5 proxy", "Able to read again.\n"); @@ -73,7 +74,7 @@ static void _qq_s5_canread_again(gpointer data, gint source, PurpleInputConditio memcpy(&sin.sin_port, buf + 8, 2); if (connect(phb->udpsock, (struct sockaddr *) &sin, sizeof(struct sockaddr_in)) < 0) { - purple_debug(PURPLE_DEBUG_INFO, "s5_canread_again", "connect failed: %s\n", strerror(errno)); + purple_debug(PURPLE_DEBUG_INFO, "s5_canread_again", "connect failed: %s\n", g_strerror(errno)); close(phb->udpsock); close(source); g_free(phb->host); @@ -89,7 +90,8 @@ static void _qq_s5_canread_again(gpointer data, gint source, PurpleInputConditio close(phb->udpsock); return; } - fcntl(phb->udpsock, F_SETFL, 0); + flags = fcntl(phb->udpsock, F_GETFL); + fcntl(phb->udpsock, F_SETFL, flags & ~O_NONBLOCK); if (phb->account == NULL || purple_account_get_connection(phb->account) != NULL) { phb->func(phb->data, phb->udpsock, NULL); @@ -106,6 +108,7 @@ static void _qq_s5_sendconnect(gpointer data, gint source) struct sockaddr_in sin, ctlsin; int port; socklen_t ctllen; + int flags; purple_debug(PURPLE_DEBUG_INFO, "s5_sendconnect", "remote host is %s:%d\n", phb->host, phb->port); @@ -117,7 +120,7 @@ static void _qq_s5_sendconnect(gpointer data, gint source) ctllen = sizeof(ctlsin); if (getsockname(source, (struct sockaddr *) &ctlsin, &ctllen) < 0) { - purple_debug(PURPLE_DEBUG_INFO, "QQ", "getsockname: %s\n", strerror(errno)); + purple_debug(PURPLE_DEBUG_INFO, "QQ", "getsockname: %s\n", g_strerror(errno)); close(source); g_free(phb->host); g_free(phb); @@ -133,7 +136,8 @@ static void _qq_s5_sendconnect(gpointer data, gint source) return; } - fcntl(phb->udpsock, F_SETFL, O_NONBLOCK); + flags = fcntl(phb->udpsock, F_GETFL); + fcntl(phb->udpsock, F_SETFL, flags | O_NONBLOCK); port = g_ntohs(ctlsin.sin_port) + 1; while (1) { @@ -285,8 +289,9 @@ static void _qq_s5_canwrite(gpointer data, gint source, PurpleInputCondition con unsigned char buf[512]; int i; struct PHB *phb = data; - unsigned int len; + socklen_t len; int error = ETIMEDOUT; + int flags; purple_debug(PURPLE_DEBUG_INFO, "socks5 proxy", "Connected.\n"); @@ -295,7 +300,7 @@ static void _qq_s5_canwrite(gpointer data, gint source, PurpleInputCondition con len = sizeof(error); if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { - purple_debug(PURPLE_DEBUG_INFO, "getsockopt", "%s\n", strerror(errno)); + purple_debug(PURPLE_DEBUG_INFO, "getsockopt", "%s\n", g_strerror(errno)); close(source); if (phb->account == NULL || purple_account_get_connection(phb->account) != NULL) { @@ -306,7 +311,8 @@ static void _qq_s5_canwrite(gpointer data, gint source, PurpleInputCondition con g_free(phb); return; } - fcntl(source, F_SETFL, 0); + flags = fcntl(source, F_GETFL); + fcntl(source, F_SETFL, flags & ~O_NONBLOCK); i = 0; buf[0] = 0x05; /* SOCKS version 5 */ @@ -323,7 +329,7 @@ static void _qq_s5_canwrite(gpointer data, gint source, PurpleInputCondition con } if (write(source, buf, i) < i) { - purple_debug(PURPLE_DEBUG_INFO, "write", "%s\n", strerror(errno)); + purple_debug(PURPLE_DEBUG_INFO, "write", "%s\n", g_strerror(errno)); purple_debug(PURPLE_DEBUG_ERROR, "socks5 proxy", "Unable to write\n"); close(source); @@ -343,6 +349,8 @@ static void _qq_s5_canwrite(gpointer data, gint source, PurpleInputCondition con gint qq_proxy_socks5(struct PHB *phb, struct sockaddr *addr, socklen_t addrlen) { gint fd; + int flags; + purple_debug(PURPLE_DEBUG_INFO, "QQ", "Connecting to %s:%d via %s:%d using SOCKS5\n", phb->host, phb->port, purple_proxy_info_get_host(phb->gpi), purple_proxy_info_get_port(phb->gpi)); @@ -352,7 +360,8 @@ gint qq_proxy_socks5(struct PHB *phb, struct sockaddr *addr, socklen_t addrlen) purple_debug(PURPLE_DEBUG_INFO, "QQ", "proxy_sock5 return fd=%d\n", fd); - fcntl(fd, F_SETFL, O_NONBLOCK); + flags = fcntl(fd, F_GETFL); + fcntl(fd, F_SETFL, flags | O_NONBLOCK); if (connect(fd, addr, addrlen) < 0) { if ((errno == EINPROGRESS) || (errno == EINTR)) { purple_debug(PURPLE_DEBUG_WARNING, "QQ", "Connect in asynchronous mode.\n"); @@ -363,7 +372,8 @@ gint qq_proxy_socks5(struct PHB *phb, struct sockaddr *addr, socklen_t addrlen) } } else { purple_debug(PURPLE_DEBUG_MISC, "QQ", "Connect in blocking mode.\n"); - fcntl(fd, F_SETFL, 0); + flags = fcntl(fd, F_GETFL); + fcntl(fd, F_SETFL, flags & ~O_NONBLOCK); _qq_s5_canwrite(phb, fd, PURPLE_INPUT_WRITE); } diff --git a/libpurple/protocols/qq/udp_proxy_s5.h b/libpurple/protocols/qq/udp_proxy_s5.h index 481fd0b8d2..4144e29e6b 100644 --- a/libpurple/protocols/qq/udp_proxy_s5.h +++ b/libpurple/protocols/qq/udp_proxy_s5.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_UDP_PROXY_S5_H_ diff --git a/libpurple/protocols/qq/utils.c b/libpurple/protocols/qq/utils.c index bffbe4aeae..6f7c3c7ab5 100644 --- a/libpurple/protocols/qq/utils.c +++ b/libpurple/protocols/qq/utils.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include "cipher.h" diff --git a/libpurple/protocols/qq/utils.h b/libpurple/protocols/qq/utils.h index 833782ff0f..7351b16f15 100644 --- a/libpurple/protocols/qq/utils.h +++ b/libpurple/protocols/qq/utils.h @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifndef _QQ_MY_UTILS_H_ |