# HG changeset patch # User Mark Doliner # Date 1107492608 0 # Node ID 2b05acfeec653869fa3435486c2a1a1cb16bdee8 # Parent 12349012610b44899851238f8b77b1c01050535d [gaim-migrate @ 11960] sf patch #1036930, from Ettore Simone with updates from Stu Tomlinson Add support for setting the ICQ web presence, authorization and IP hiding preferences. I know the authorization setting works. The IP hiding preference didn't seem to have any affect on licq. And the web aware setting made something different happen, but I still didn't seem to be web aware. I think there might be another setting that needs setting. committer: Tailor Script diff -r 12349012610b -r 2b05acfeec65 COPYRIGHT --- a/COPYRIGHT Thu Feb 03 22:36:56 2005 +0000 +++ b/COPYRIGHT Fri Feb 04 04:50:08 2005 +0000 @@ -165,6 +165,7 @@ Jim Seymour Joe Shaw Scott Shedden +Ettore Simone John Silvestri Craig Slusher Alex Smith diff -r 12349012610b -r 2b05acfeec65 ChangeLog --- a/ChangeLog Thu Feb 03 22:36:56 2005 +0000 +++ b/ChangeLog Fri Feb 04 04:50:08 2005 +0000 @@ -24,6 +24,8 @@ * Entries in the text replacement plugin are now sorted alphabetically (Richard Laager) * CHAP authentication support for SOCKS5 proxies (Malcolm Smith) + * Ability to set ICQ "require authorization" and "web aware" + setting (Ettore Simone) Bug fixes: * Some memory leaks plugged (Miah Gregory, Felipe Contreras) diff -r 12349012610b -r 2b05acfeec65 src/protocols/oscar/aim.h --- a/src/protocols/oscar/aim.h Thu Feb 03 22:36:56 2005 +0000 +++ b/src/protocols/oscar/aim.h Fri Feb 04 04:50:08 2005 +0000 @@ -1335,7 +1335,8 @@ faim_export int aim_icq_reqofflinemsgs(aim_session_t *sess); faim_export int aim_icq_ackofflinemsgs(aim_session_t *sess); -faim_export int aim_icq_hideip(aim_session_t *sess); +faim_export int aim_icq_setsecurity(aim_session_t *sess, const int auth, const int web, const int hide); +faim_export int aim_icq_setauthsetting(aim_session_t *sess, int auth_required); faim_export int aim_icq_changepasswd(aim_session_t *sess, const char *passwd); faim_export int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin); faim_export int aim_icq_getalias(aim_session_t *sess, const char *uin); diff -r 12349012610b -r 2b05acfeec65 src/protocols/oscar/icq.c --- a/src/protocols/oscar/icq.c Thu Feb 03 22:36:56 2005 +0000 +++ b/src/protocols/oscar/icq.c Fri Feb 04 04:50:08 2005 +0000 @@ -70,7 +70,16 @@ return 0; } -faim_export int aim_icq_hideip(aim_session_t *sess) +/** + * Set your ICQ security. + * + * @param sess The oscar session. + * @param auth Ask authorization when a buddy adds us? + * @param web Show our presence on the ICQ web site. + * @param hide Hide our IP address. + * @return Return 0 if no errors, otherwise return the error number. + */ +faim_export int aim_icq_setsecurity(aim_session_t *sess, const int auth, const int web, const int hide) { aim_conn_t *conn; aim_frame_t *fr; @@ -97,14 +106,20 @@ aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ aimbs_putle16(&fr->data, snacid); /* eh. */ aimbs_putle16(&fr->data, 0x0424); /* shrug. */ - aimbs_putle16(&fr->data, 0x0001); - aimbs_putle16(&fr->data, 0x0001); + aimbs_putle8(&fr->data, (auth == TRUE) ? 0x00 : 0x01); + aimbs_putle8(&fr->data, (web == TRUE) ? 0x00 : 0x01); + aimbs_putle8(&fr->data, (hide == TRUE) ? 0x00 : 0x01); + aimbs_putle8(&fr->data, 0x00); aim_tx_enqueue(sess, fr); return 0; } +/** + * I don't know why we have this function and the one above... + * Maybe one of them is wrong? Maybe they both really DO exist? + */ faim_export int aim_icq_setauthsetting(aim_session_t *sess, int auth_required) { aim_conn_t *conn; diff -r 12349012610b -r 2b05acfeec65 src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Thu Feb 03 22:36:56 2005 +0000 +++ b/src/protocols/oscar/oscar.c Fri Feb 04 04:50:08 2005 +0000 @@ -61,6 +61,9 @@ #define OSCAR_CONNECT_STEPS 6 #define OSCAR_DEFAULT_CUSTOM_ENCODING "ISO-8859-1" +#define OSCAR_DEFAULT_AUTHORIZATION TRUE +#define OSCAR_DEFAULT_HIDE_IP TRUE +#define OSCAR_DEFAULT_WEB_AWARE FALSE #define FAIM_DEBUG_LEVEL 0 @@ -5039,6 +5042,7 @@ static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { GaimConnection *gc = sess->aux_data; OscarData *od = (OscarData *)gc->proto_data; + GaimAccount *account = gaim_connection_get_account(gc); va_list ap; fu16_t maxpermits, maxdenies; @@ -5064,7 +5068,10 @@ if (od->icq) { aim_icq_reqofflinemsgs(sess); - aim_icq_hideip(sess); + aim_icq_setsecurity(sess, + gaim_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION), + gaim_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE), + gaim_account_get_bool(account, "hide_ip", OSCAR_DEFAULT_HIDE_IP)); } aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV); @@ -7179,6 +7186,64 @@ } } +static void +oscar_icq_privacy_opts(GaimConnection *gc, GaimRequestFields *fields) +{ + OscarData *od = gc->proto_data; + GaimAccount *account = gaim_connection_get_account(gc); + GaimRequestField *f; + gboolean auth, hide_ip, web_aware; + + f = gaim_request_fields_get_field(fields, "authorization"); + auth = gaim_request_field_bool_get_value(f); + + f = gaim_request_fields_get_field(fields, "hide_ip"); + hide_ip = gaim_request_field_bool_get_value(f); + + f = gaim_request_fields_get_field(fields, "web_aware"); + web_aware = gaim_request_field_bool_get_value(f); + + gaim_account_set_bool(account, "authorization", auth); + gaim_account_set_bool(account, "hide_ip", hide_ip); + gaim_account_set_bool(account, "web_aware", web_aware); + + aim_icq_setsecurity(od->sess, auth, web_aware, hide_ip); +} + +static void +oscar_show_icq_privacy_opts(GaimPluginAction *action) +{ + GaimConnection *gc = (GaimConnection *) action->context; + GaimAccount *account = gaim_connection_get_account(gc); + GaimRequestFields *fields; + GaimRequestFieldGroup *g; + GaimRequestField *f; + gboolean auth, hide_ip, web_aware; + + auth = gaim_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION); + hide_ip = gaim_account_get_bool(account, "hide_ip", OSCAR_DEFAULT_HIDE_IP); + web_aware = gaim_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE); + + fields = gaim_request_fields_new(); + + g = gaim_request_field_group_new(NULL); + + f = gaim_request_field_bool_new("authorization", _("Require authorization"), auth); + gaim_request_field_group_add_field(g, f); + + f = gaim_request_field_bool_new("hide_ip", _("Hide IP address"), hide_ip); + gaim_request_field_group_add_field(g, f); + + f = gaim_request_field_bool_new("web_aware", _("Web aware"), web_aware); + gaim_request_field_group_add_field(g, f); + + gaim_request_fields_add_group(fields, g); + + gaim_request_fields(gc, _("ICQ Privacy Options"), _("ICQ Privacy Options"), + NULL, fields, + _("OK"), G_CALLBACK(oscar_icq_privacy_opts), + _("Cancel"), NULL, gc); +} static void oscar_format_screenname(GaimConnection *gc, const char *nick) { OscarData *od = gc->proto_data; @@ -7404,7 +7469,8 @@ oscar_show_set_info); m = g_list_append(m, act); - if (od->icq) { + if (od->icq) + { act = gaim_plugin_action_new(_("Set User Info (URL)..."), oscar_show_set_info_icqurl); m = g_list_append(m, act); @@ -7414,7 +7480,8 @@ oscar_change_pass); m = g_list_append(m, act); - if (od->sess->authinfo->chpassurl) { + if (od->sess->authinfo->chpassurl != NULL) + { act = gaim_plugin_action_new(_("Change Password (URL)"), oscar_show_chpassurl); m = g_list_append(m, act); @@ -7424,10 +7491,18 @@ m = g_list_append(m, act); } - if (!od->icq) { + m = g_list_append(m, NULL); + + if (od->icq) + { + /* ICQ actions */ + act = gaim_plugin_action_new(_("Show privacy options..."), + oscar_show_icq_privacy_opts); + m = g_list_append(m, act); + } + else + { /* AIM actions */ - m = g_list_append(m, NULL); - act = gaim_plugin_action_new(_("Format Screen Name..."), oscar_show_format_screenname); m = g_list_append(m, act); @@ -7653,6 +7728,11 @@ option = gaim_account_option_string_new(_("Encoding"), "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); + /* We don't add these to protocol_options because they're ICQ specific */ + option = gaim_account_option_bool_new(_("Authorization"), "authorization", OSCAR_DEFAULT_AUTHORIZATION); + option = gaim_account_option_bool_new(_("Hide IP"), "hide_ip", OSCAR_DEFAULT_HIDE_IP); + option = gaim_account_option_bool_new(_("Web presence"), "web_aware", OSCAR_DEFAULT_WEB_AWARE); + my_protocol = plugin; gaim_prefs_add_none("/plugins/prpl/oscar");