comparison libgaim/protocols/oscar/oscar.c @ 14348:80b05108652c

[gaim-migrate @ 17050] Use GSList in a few places instead of GList, and use g_list_prepend and then g_list_reverse in a few places instead of g_list_append committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 26 Aug 2006 19:12:05 +0000
parents b8ca9c680d1a
children 01daacf7b771
comparison
equal deleted inserted replaced
14347:a8140cbe08ce 14348:80b05108652c
970 gaim_connection_update_progress(gc, _("Connection established, cookie sent"), 4, OSCAR_CONNECT_STEPS); 970 gaim_connection_update_progress(gc, _("Connection established, cookie sent"), 4, OSCAR_CONNECT_STEPS);
971 ck[4] = 0x61; 971 ck[4] = 0x61;
972 } 972 }
973 else if (conn->type == SNAC_FAMILY_CHAT) 973 else if (conn->type == SNAC_FAMILY_CHAT)
974 { 974 {
975 od->oscar_chats = g_slist_append(od->oscar_chats, conn->new_conn_data); 975 od->oscar_chats = g_slist_prepend(od->oscar_chats, conn->new_conn_data);
976 conn->new_conn_data = NULL; 976 conn->new_conn_data = NULL;
977 } 977 }
978 } 978 }
979 979
980 static void 980 static void
5172 /* this gets tricky */ 5172 /* this gets tricky */
5173 struct create_room *cr = g_new0(struct create_room, 1); 5173 struct create_room *cr = g_new0(struct create_room, 1);
5174 gaim_debug_info("oscar", "chatnav does not exist, opening chatnav\n"); 5174 gaim_debug_info("oscar", "chatnav does not exist, opening chatnav\n");
5175 cr->exchange = atoi(exchange); 5175 cr->exchange = atoi(exchange);
5176 cr->name = g_strdup(name); 5176 cr->name = g_strdup(name);
5177 od->create_rooms = g_slist_append(od->create_rooms, cr); 5177 od->create_rooms = g_slist_prepend(od->create_rooms, cr);
5178 aim_reqservice(od, SNAC_FAMILY_CHATNAV); 5178 aim_reqservice(od, SNAC_FAMILY_CHATNAV);
5179 } 5179 }
5180 } 5180 }
5181 5181
5182 static void 5182 static void
5598 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE, 5598 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE,
5599 OSCAR_STATUS_ID_AVAILABLE, 5599 OSCAR_STATUS_ID_AVAILABLE,
5600 NULL, TRUE, TRUE, FALSE, 5600 NULL, TRUE, TRUE, FALSE,
5601 "message", _("Message"), 5601 "message", _("Message"),
5602 gaim_value_new(GAIM_TYPE_STRING), NULL); 5602 gaim_value_new(GAIM_TYPE_STRING), NULL);
5603 status_types = g_list_append(status_types, type); 5603 status_types = g_list_prepend(status_types, type);
5604 5604
5605 type = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE, 5605 type = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE,
5606 OSCAR_STATUS_ID_FREE4CHAT, 5606 OSCAR_STATUS_ID_FREE4CHAT,
5607 _("Free For Chat"), TRUE, is_icq, FALSE); 5607 _("Free For Chat"), TRUE, is_icq, FALSE);
5608 status_types = g_list_append(status_types, type); 5608 status_types = g_list_prepend(status_types, type);
5609 5609
5610 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AWAY, 5610 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AWAY,
5611 OSCAR_STATUS_ID_AWAY, 5611 OSCAR_STATUS_ID_AWAY,
5612 NULL, TRUE, TRUE, FALSE, 5612 NULL, TRUE, TRUE, FALSE,
5613 "message", _("Message"), 5613 "message", _("Message"),
5614 gaim_value_new(GAIM_TYPE_STRING), NULL); 5614 gaim_value_new(GAIM_TYPE_STRING), NULL);
5615 status_types = g_list_append(status_types, type); 5615 status_types = g_list_prepend(status_types, type);
5616 5616
5617 type = gaim_status_type_new_full(GAIM_STATUS_INVISIBLE, 5617 type = gaim_status_type_new_full(GAIM_STATUS_INVISIBLE,
5618 OSCAR_STATUS_ID_INVISIBLE, 5618 OSCAR_STATUS_ID_INVISIBLE,
5619 NULL, TRUE, TRUE, FALSE); 5619 NULL, TRUE, TRUE, FALSE);
5620 status_types = g_list_append(status_types, type); 5620 status_types = g_list_prepend(status_types, type);
5621 5621
5622 /* ICQ-specific status types */ 5622 /* ICQ-specific status types */
5623 type = gaim_status_type_new_with_attrs(GAIM_STATUS_UNAVAILABLE, 5623 type = gaim_status_type_new_with_attrs(GAIM_STATUS_UNAVAILABLE,
5624 OSCAR_STATUS_ID_OCCUPIED, 5624 OSCAR_STATUS_ID_OCCUPIED,
5625 _("Occupied"), TRUE, is_icq, FALSE, 5625 _("Occupied"), TRUE, is_icq, FALSE,
5626 "message", _("Message"), 5626 "message", _("Message"),
5627 gaim_value_new(GAIM_TYPE_STRING), NULL); 5627 gaim_value_new(GAIM_TYPE_STRING), NULL);
5628 status_types = g_list_append(status_types, type); 5628 status_types = g_list_prepend(status_types, type);
5629 5629
5630 type = gaim_status_type_new_with_attrs(GAIM_STATUS_EXTENDED_AWAY, 5630 type = gaim_status_type_new_with_attrs(GAIM_STATUS_EXTENDED_AWAY,
5631 OSCAR_STATUS_ID_DND, 5631 OSCAR_STATUS_ID_DND,
5632 _("Do Not Disturb"), TRUE, is_icq, FALSE, 5632 _("Do Not Disturb"), TRUE, is_icq, FALSE,
5633 "message", _("Message"), 5633 "message", _("Message"),
5634 gaim_value_new(GAIM_TYPE_STRING), NULL); 5634 gaim_value_new(GAIM_TYPE_STRING), NULL);
5635 status_types = g_list_append(status_types, type); 5635 status_types = g_list_prepend(status_types, type);
5636 5636
5637 type = gaim_status_type_new_with_attrs(GAIM_STATUS_EXTENDED_AWAY, 5637 type = gaim_status_type_new_with_attrs(GAIM_STATUS_EXTENDED_AWAY,
5638 OSCAR_STATUS_ID_NA, 5638 OSCAR_STATUS_ID_NA,
5639 _("Not Available"), TRUE, is_icq, FALSE, 5639 _("Not Available"), TRUE, is_icq, FALSE,
5640 "message", _("Message"), 5640 "message", _("Message"),
5641 gaim_value_new(GAIM_TYPE_STRING), NULL); 5641 gaim_value_new(GAIM_TYPE_STRING), NULL);
5642 status_types = g_list_append(status_types, type); 5642 status_types = g_list_prepend(status_types, type);
5643 5643
5644 type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, 5644 type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE,
5645 OSCAR_STATUS_ID_OFFLINE, 5645 OSCAR_STATUS_ID_OFFLINE,
5646 NULL, TRUE, TRUE, FALSE); 5646 NULL, TRUE, TRUE, FALSE);
5647 status_types = g_list_append(status_types, type); 5647 status_types = g_list_prepend(status_types, type);
5648
5649 status_types = g_list_reverse(status_types);
5648 5650
5649 return status_types; 5651 return status_types;
5650 } 5652 }
5651 5653
5652 static void oscar_ssi_editcomment(struct name_data *data, const char *text) { 5654 static void oscar_ssi_editcomment(struct name_data *data, const char *text) {
5777 5779
5778 static GList *oscar_buddy_menu(GaimBuddy *buddy) { 5780 static GList *oscar_buddy_menu(GaimBuddy *buddy) {
5779 5781
5780 GaimConnection *gc; 5782 GaimConnection *gc;
5781 OscarData *od; 5783 OscarData *od;
5782 GList *m; 5784 GList *menu;
5783 GaimMenuAction *act; 5785 GaimMenuAction *act;
5784 aim_userinfo_t *userinfo; 5786 aim_userinfo_t *userinfo;
5785 5787
5786 gc = gaim_account_get_connection(buddy->account); 5788 gc = gaim_account_get_connection(buddy->account);
5787 od = gc->proto_data; 5789 od = gc->proto_data;
5788 userinfo = aim_locate_finduserinfo(od, buddy->name); 5790 userinfo = aim_locate_finduserinfo(od, buddy->name);
5789 m = NULL; 5791 menu = NULL;
5790 5792
5791 if (od->icq && aim_sn_is_icq(gaim_buddy_get_name(buddy))) 5793 if (od->icq && aim_sn_is_icq(gaim_buddy_get_name(buddy)))
5792 { 5794 {
5793 act = gaim_menu_action_new(_("Get AIM Info"), 5795 act = gaim_menu_action_new(_("Get AIM Info"),
5794 GAIM_CALLBACK(oscar_get_aim_info_cb), 5796 GAIM_CALLBACK(oscar_get_aim_info_cb),
5795 NULL, NULL); 5797 NULL, NULL);
5796 m = g_list_append(m, act); 5798 menu = g_list_prepend(menu, act);
5797 } 5799 }
5798 5800
5799 act = gaim_menu_action_new(_("Edit Buddy Comment"), 5801 act = gaim_menu_action_new(_("Edit Buddy Comment"),
5800 GAIM_CALLBACK(oscar_buddycb_edit_comment), 5802 GAIM_CALLBACK(oscar_buddycb_edit_comment),
5801 NULL, NULL); 5803 NULL, NULL);
5802 m = g_list_append(m, act); 5804 menu = g_list_prepend(menu, act);
5803 5805
5804 #if 0 5806 #if 0
5805 if (od->icq) 5807 if (od->icq)
5806 { 5808 {
5807 act = gaim_menu_action_new(_("Get Status Msg"), 5809 act = gaim_menu_action_new(_("Get Status Msg"),
5808 GAIM_CALLBACK(oscar_get_icqstatusmsg), 5810 GAIM_CALLBACK(oscar_get_icqstatusmsg),
5809 NULL, NULL); 5811 NULL, NULL);
5810 m = g_list_append(m, act); 5812 menu = g_list_prepend(menu, act);
5811 } 5813 }
5812 #endif 5814 #endif
5813 5815
5814 if (userinfo && 5816 if (userinfo &&
5815 aim_sncmp(gaim_account_get_username(buddy->account), buddy->name) && 5817 aim_sncmp(gaim_account_get_username(buddy->account), buddy->name) &&
5818 if (userinfo->capabilities & OSCAR_CAPABILITY_DIRECTIM) 5820 if (userinfo->capabilities & OSCAR_CAPABILITY_DIRECTIM)
5819 { 5821 {
5820 act = gaim_menu_action_new(_("Direct IM"), 5822 act = gaim_menu_action_new(_("Direct IM"),
5821 GAIM_CALLBACK(oscar_ask_directim), 5823 GAIM_CALLBACK(oscar_ask_directim),
5822 NULL, NULL); 5824 NULL, NULL);
5823 m = g_list_append(m, act); 5825 menu = g_list_prepend(menu, act);
5824 } 5826 }
5825 #if 0 5827 #if 0
5826 /* TODO: This menu item should be added by the core */ 5828 /* TODO: This menu item should be added by the core */
5827 if (userinfo->capabilities & OSCAR_CAPABILITY_GETFILE) { 5829 if (userinfo->capabilities & OSCAR_CAPABILITY_GETFILE) {
5828 act = gaim_menu_action_new(_("Get File"), 5830 act = gaim_menu_action_new(_("Get File"),
5829 GAIM_CALLBACK(oscar_ask_getfile), 5831 GAIM_CALLBACK(oscar_ask_getfile),
5830 NULL, NULL); 5832 NULL, NULL);
5831 m = g_list_append(m, act); 5833 menu = g_list_prepend(menu, act);
5832 } 5834 }
5833 #endif 5835 #endif
5834 } 5836 }
5835 5837
5836 if (od->ssi.received_data) 5838 if (od->ssi.received_data)
5840 if (gname && aim_ssi_waitingforauth(od->ssi.local, gname, buddy->name)) 5842 if (gname && aim_ssi_waitingforauth(od->ssi.local, gname, buddy->name))
5841 { 5843 {
5842 act = gaim_menu_action_new(_("Re-request Authorization"), 5844 act = gaim_menu_action_new(_("Re-request Authorization"),
5843 GAIM_CALLBACK(gaim_auth_sendrequest_menu), 5845 GAIM_CALLBACK(gaim_auth_sendrequest_menu),
5844 NULL, NULL); 5846 NULL, NULL);
5845 m = g_list_append(m, act); 5847 menu = g_list_prepend(menu, act);
5846 } 5848 }
5847 } 5849 }
5848 5850
5849 return m; 5851 menu = g_list_reverse(menu);
5852
5853 return menu;
5850 } 5854 }
5851 5855
5852 5856
5853 static GList *oscar_blist_node_menu(GaimBlistNode *node) { 5857 static GList *oscar_blist_node_menu(GaimBlistNode *node) {
5854 if(GAIM_BLIST_NODE_IS_BUDDY(node)) { 5858 if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
6211 static GList * 6215 static GList *
6212 oscar_actions(GaimPlugin *plugin, gpointer context) 6216 oscar_actions(GaimPlugin *plugin, gpointer context)
6213 { 6217 {
6214 GaimConnection *gc = (GaimConnection *) context; 6218 GaimConnection *gc = (GaimConnection *) context;
6215 OscarData *od = gc->proto_data; 6219 OscarData *od = gc->proto_data;
6216 GList *m = NULL; 6220 GList *menu = NULL;
6217 GaimPluginAction *act; 6221 GaimPluginAction *act;
6218 6222
6219 act = gaim_plugin_action_new(_("Set User Info..."), 6223 act = gaim_plugin_action_new(_("Set User Info..."),
6220 oscar_show_set_info); 6224 oscar_show_set_info);
6221 m = g_list_append(m, act); 6225 menu = g_list_prepend(menu, act);
6222 6226
6223 if (od->icq) 6227 if (od->icq)
6224 { 6228 {
6225 act = gaim_plugin_action_new(_("Set User Info (URL)..."), 6229 act = gaim_plugin_action_new(_("Set User Info (URL)..."),
6226 oscar_show_set_info_icqurl); 6230 oscar_show_set_info_icqurl);
6227 m = g_list_append(m, act); 6231 menu = g_list_prepend(menu, act);
6228 } 6232 }
6229 6233
6230 act = gaim_plugin_action_new(_("Change Password..."), 6234 act = gaim_plugin_action_new(_("Change Password..."),
6231 oscar_change_pass); 6235 oscar_change_pass);
6232 m = g_list_append(m, act); 6236 menu = g_list_prepend(menu, act);
6233 6237
6234 if (od->authinfo->chpassurl != NULL) 6238 if (od->authinfo->chpassurl != NULL)
6235 { 6239 {
6236 act = gaim_plugin_action_new(_("Change Password (URL)"), 6240 act = gaim_plugin_action_new(_("Change Password (URL)"),
6237 oscar_show_chpassurl); 6241 oscar_show_chpassurl);
6238 m = g_list_append(m, act); 6242 menu = g_list_prepend(menu, act);
6239 6243
6240 act = gaim_plugin_action_new(_("Configure IM Forwarding (URL)"), 6244 act = gaim_plugin_action_new(_("Configure IM Forwarding (URL)"),
6241 oscar_show_imforwardingurl); 6245 oscar_show_imforwardingurl);
6242 m = g_list_append(m, act); 6246 menu = g_list_prepend(menu, act);
6243 } 6247 }
6244 6248
6245 m = g_list_append(m, NULL); 6249 menu = g_list_prepend(menu, NULL);
6246 6250
6247 if (od->icq) 6251 if (od->icq)
6248 { 6252 {
6249 /* ICQ actions */ 6253 /* ICQ actions */
6250 act = gaim_plugin_action_new(_("Set Privacy Options..."), 6254 act = gaim_plugin_action_new(_("Set Privacy Options..."),
6251 oscar_show_icq_privacy_opts); 6255 oscar_show_icq_privacy_opts);
6252 m = g_list_append(m, act); 6256 menu = g_list_prepend(menu, act);
6253 } 6257 }
6254 else 6258 else
6255 { 6259 {
6256 /* AIM actions */ 6260 /* AIM actions */
6257 act = gaim_plugin_action_new(_("Format Screen Name..."), 6261 act = gaim_plugin_action_new(_("Format Screen Name..."),
6258 oscar_show_format_screenname); 6262 oscar_show_format_screenname);
6259 m = g_list_append(m, act); 6263 menu = g_list_prepend(menu, act);
6260 6264
6261 act = gaim_plugin_action_new(_("Confirm Account"), 6265 act = gaim_plugin_action_new(_("Confirm Account"),
6262 oscar_confirm_account); 6266 oscar_confirm_account);
6263 m = g_list_append(m, act); 6267 menu = g_list_prepend(menu, act);
6264 6268
6265 act = gaim_plugin_action_new(_("Display Currently Registered E-Mail Address"), 6269 act = gaim_plugin_action_new(_("Display Currently Registered E-Mail Address"),
6266 oscar_show_email); 6270 oscar_show_email);
6267 m = g_list_append(m, act); 6271 menu = g_list_prepend(menu, act);
6268 6272
6269 act = gaim_plugin_action_new(_("Change Currently Registered E-Mail Address..."), 6273 act = gaim_plugin_action_new(_("Change Currently Registered E-Mail Address..."),
6270 oscar_show_change_email); 6274 oscar_show_change_email);
6271 m = g_list_append(m, act); 6275 menu = g_list_prepend(menu, act);
6272 } 6276 }
6273 6277
6274 m = g_list_append(m, NULL); 6278 menu = g_list_prepend(menu, NULL);
6275 6279
6276 act = gaim_plugin_action_new(_("Show Buddies Awaiting Authorization"), 6280 act = gaim_plugin_action_new(_("Show Buddies Awaiting Authorization"),
6277 oscar_show_awaitingauth); 6281 oscar_show_awaitingauth);
6278 m = g_list_append(m, act); 6282 menu = g_list_prepend(menu, act);
6279 6283
6280 m = g_list_append(m, NULL); 6284 menu = g_list_prepend(menu, NULL);
6281 6285
6282 act = gaim_plugin_action_new(_("Search for Buddy by E-Mail Address..."), 6286 act = gaim_plugin_action_new(_("Search for Buddy by E-Mail Address..."),
6283 oscar_show_find_email); 6287 oscar_show_find_email);
6284 m = g_list_append(m, act); 6288 menu = g_list_prepend(menu, act);
6285 6289
6286 #if 0 6290 #if 0
6287 act = gaim_plugin_action_new(_("Search for Buddy by Information"), 6291 act = gaim_plugin_action_new(_("Search for Buddy by Information"),
6288 show_find_info); 6292 show_find_info);
6289 m = g_list_append(m, act); 6293 menu = g_list_prepend(menu, act);
6290 #endif 6294 #endif
6291 6295
6292 return m; 6296 menu = g_list_reverse(menu);
6297
6298 return menu;
6293 } 6299 }
6294 6300
6295 static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new) 6301 static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new)
6296 { 6302 {
6297 OscarData *od = gc->proto_data; 6303 OscarData *od = gc->proto_data;