comparison src/protocols/msn/msn.c @ 3730:a20bf3d247ff

[gaim-migrate @ 3868] Pretty do_ask_dialog. I also "fixed" the "hitting yes calls the 'no' function anyway" behavior. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 17 Oct 2002 21:29:53 +0000
parents 34c95669952f
children f53370197bb9
comparison
equal deleted inserted replaced
3729:a8f0c169e529 3730:a20bf3d247ff
833 struct gaim_connection *gc; 833 struct gaim_connection *gc;
834 char *user; 834 char *user;
835 char *friend; 835 char *friend;
836 }; 836 };
837 837
838 static void msn_accept_add(gpointer w, struct msn_add_permit *map) 838 static void msn_accept_add(struct msn_add_permit *map)
839 { 839 {
840 struct msn_data *md = map->gc->proto_data; 840 struct msn_data *md = map->gc->proto_data;
841 char buf[MSN_BUF_LEN]; 841 char buf[MSN_BUF_LEN];
842 842
843 g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, map->user, url_encode(map->friend)); 843 g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, map->user, url_encode(map->friend));
848 return; 848 return;
849 } 849 }
850 map->gc->permit = g_slist_append(map->gc->permit, map->user); 850 map->gc->permit = g_slist_append(map->gc->permit, map->user);
851 build_allow_list(); /* er. right. we'll need to have a thing for this in CUI too */ 851 build_allow_list(); /* er. right. we'll need to have a thing for this in CUI too */
852 show_got_added(map->gc, NULL, map->user, map->friend, NULL); 852 show_got_added(map->gc, NULL, map->user, map->friend, NULL);
853 *(map->user) = 0; 853 g_free(map->user);
854 } 854 g_free(map->friend);
855 855 g_free(map);
856 static void msn_cancel_add(gpointer w, struct msn_add_permit *map) 856 }
857
858 static void msn_cancel_add(struct msn_add_permit *map)
857 { 859 {
858 struct msn_data *md = map->gc->proto_data; 860 struct msn_data *md = map->gc->proto_data;
859 char buf[MSN_BUF_LEN]; 861 char buf[MSN_BUF_LEN];
860 862
861 if (*(map->user)) { 863 g_snprintf(buf, sizeof(buf), "ADD %d BL %s %s\r\n", ++md->trId, map->user, url_encode(map->friend));
862 g_snprintf(buf, sizeof(buf), "ADD %d BL %s %s\r\n", ++md->trId, map->user, url_encode(map->friend)); 864 if (msn_write(md->fd, buf, strlen(buf)) < 0) {
863 if (msn_write(md->fd, buf, strlen(buf)) < 0) { 865 hide_login_progress(map->gc, "Write error");
864 hide_login_progress(map->gc, "Write error"); 866 signoff(map->gc);
865 signoff(map->gc); 867 return;
866 return; 868 }
867 } 869 map->gc->deny = g_slist_append(map->gc->deny, map->user);
868 map->gc->deny = g_slist_append(map->gc->deny, map->user); 870 build_block_list();
869 build_block_list(); 871
870 }
871 872
872 g_free(map->user); 873 g_free(map->user);
873 g_free(map->friend); 874 g_free(map->friend);
874 g_free(map); 875 g_free(map);
875 } 876 }
911 ap->gc = gc; 912 ap->gc = gc;
912 913
913 g_snprintf(msg, sizeof(msg), _("The user %s (%s) wants to add %s to his or her buddy list."), 914 g_snprintf(msg, sizeof(msg), _("The user %s (%s) wants to add %s to his or her buddy list."),
914 ap->user, ap->friend, ap->gc->username); 915 ap->user, ap->friend, ap->gc->username);
915 916
916 do_ask_dialog(msg, ap, msn_accept_add, msn_cancel_add); 917 do_ask_dialog(msg, NULL, ap, _("Authorize"), msn_accept_add, _("Deny"), msn_cancel_add);
917 } else if (!g_strncasecmp(buf, "BLP", 3)) { 918 } else if (!g_strncasecmp(buf, "BLP", 3)) {
918 char *type, *tmp = buf; 919 char *type, *tmp = buf;
919 920
920 GET_NEXT(tmp); 921 GET_NEXT(tmp);
921 GET_NEXT(tmp); 922 GET_NEXT(tmp);
1066 ap->user = g_strdup(who); 1067 ap->user = g_strdup(who);
1067 ap->friend = g_strdup(friend); 1068 ap->friend = g_strdup(friend);
1068 ap->gc = gc; 1069 ap->gc = gc;
1069 1070
1070 g_snprintf(msg, sizeof(msg), _("The user %s (%s) wants to add you to their buddy list"),ap->user, ap->friend); 1071 g_snprintf(msg, sizeof(msg), _("The user %s (%s) wants to add you to their buddy list"),ap->user, ap->friend);
1071 do_ask_dialog(msg, ap, msn_accept_add, msn_cancel_add); 1072 do_ask_dialog(msg, NULL, ap, _("Authorize"), msn_accept_add, _("Deny"), msn_cancel_add);
1072 } 1073 }
1073 } 1074 }
1074 1075
1075 if (pos != tot) 1076 if (pos != tot)
1076 return 1; /* this isn't the last one in the RL, so return. */ 1077 return 1; /* this isn't the last one in the RL, so return. */