comparison src/protocols/toc/toc.c @ 4249:9c7fcb211886

[gaim-migrate @ 4499] If anyone is curious, the commit before this fixed a bug which didn't allow you to delete AIM or ICQ people from a deny list. They'll show up when you sign back online, and will be deleteable now. This is a patch from the good Mr. McQueen. "Twofold attack: 1) Make sure all the callback functions don't throw a mental if the gc the dialog was asking about has disappeared. Make sure the functions still free up the data structs as necessary in this case. 2) When setting up a ask dialog, plugins (including prpls) pass in their handle. The ask dialog struct gets kept in a slist. When unloading a plugin or prpl, Gaim checks the handle against the list, and sends a cancel-type message for any outstanding dialogs. Should avoid crashes from non-modal ask dialogs lying around." Yeah, so that's a nice lil' improvement. I also fixed a think where SSI "authorization denied" messages would be gibberish. That was a bug from just a few hours ago. Whoops. Also, since this is like a grown up version of show and tell, I thought this was funny: * Robot101 fixes idiocy <KingAnt> Does that mean I'm going to be nuetered? committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 08 Jan 2003 08:18:49 +0000
parents cd84b0fd63fc
children 32fcf4cf5f80
comparison
equal deleted inserted replaced
4248:ea8fb193f5a0 4249:9c7fcb211886
56 #include "pixmaps/protocols/oscar/aol_icon.xpm" 56 #include "pixmaps/protocols/oscar/aol_icon.xpm"
57 #include "pixmaps/protocols/oscar/away_icon.xpm" 57 #include "pixmaps/protocols/oscar/away_icon.xpm"
58 #include "pixmaps/protocols/oscar/dt_icon.xpm" 58 #include "pixmaps/protocols/oscar/dt_icon.xpm"
59 #include "pixmaps/protocols/oscar/free_icon.xpm" 59 #include "pixmaps/protocols/oscar/free_icon.xpm"
60 #include "pixmaps/protocols/oscar/wireless_icon.xpm" 60 #include "pixmaps/protocols/oscar/wireless_icon.xpm"
61
62 static struct prpl *my_protocol = NULL;
61 63
62 /* for win32 compatability */ 64 /* for win32 compatability */
63 G_MODULE_IMPORT GSList *connections; 65 G_MODULE_IMPORT GSList *connections;
64 66
65 #define REVISION "penguin" 67 #define REVISION "penguin"
1396 m = g_list_append(m, "Set Dir Info"); 1398 m = g_list_append(m, "Set Dir Info");
1397 m = g_list_append(m, "Change Password"); 1399 m = g_list_append(m, "Change Password");
1398 1400
1399 return m; 1401 return m;
1400 } 1402 }
1401
1402 static struct prpl *my_protocol = NULL;
1403 1403
1404 G_MODULE_EXPORT void toc_init(struct prpl *ret) 1404 G_MODULE_EXPORT void toc_init(struct prpl *ret)
1405 { 1405 {
1406 struct proto_user_opt *puo; 1406 struct proto_user_opt *puo;
1407 ret->protocol = PROTO_TOC; 1407 ret->protocol = PROTO_TOC;
1931 g_free(ft); 1931 g_free(ft);
1932 } 1932 }
1933 1933
1934 1934
1935 static void toc_accept_ft(struct ft_request *fr) { 1935 static void toc_accept_ft(struct ft_request *fr) {
1936 GtkWidget *window; 1936 if(g_slist_find(connections, fr->gc)) {
1937 char buf[BUF_LEN]; 1937 GtkWidget *window;
1938 1938 char buf[BUF_LEN];
1939 struct file_transfer *ft = g_new0(struct file_transfer, 1); 1939
1940 ft->gc = fr->gc; 1940 struct file_transfer *ft = g_new0(struct file_transfer, 1);
1941 ft->user = g_strdup(fr->user); 1941 ft->gc = fr->gc;
1942 ft->cookie = g_strdup(fr->cookie); 1942 ft->user = g_strdup(fr->user);
1943 ft->ip = g_strdup(fr->ip); 1943 ft->cookie = g_strdup(fr->cookie);
1944 ft->port = fr->port; 1944 ft->ip = g_strdup(fr->ip);
1945 ft->files = fr->files; 1945 ft->port = fr->port;
1946 1946 ft->files = fr->files;
1947 ft->window = window = gtk_file_selection_new(_("Gaim - Save As...")); 1947
1948 g_snprintf(buf, sizeof(buf), "%s/%s", gaim_home_dir(), fr->filename ? fr->filename : ""); 1948 ft->window = window = gtk_file_selection_new(_("Gaim - Save As..."));
1949 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); 1949 g_snprintf(buf, sizeof(buf), "%s/%s", gaim_home_dir(), fr->filename ? fr->filename : "");
1950 gtk_signal_connect(GTK_OBJECT(window), "destroy", 1950 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf);
1951 GTK_SIGNAL_FUNC(cancel_callback), ft); 1951 gtk_signal_connect(GTK_OBJECT(window), "destroy",
1952 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(ft->window)->cancel_button), "clicked", 1952 GTK_SIGNAL_FUNC(cancel_callback), ft);
1953 GTK_SIGNAL_FUNC(cancel_callback), ft); 1953 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(ft->window)->cancel_button), "clicked",
1954 1954 GTK_SIGNAL_FUNC(cancel_callback), ft);
1955 if (!strcmp(fr->UID, FILE_SEND_UID)) 1955
1956 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), "clicked", 1956 if (!strcmp(fr->UID, FILE_SEND_UID))
1957 GTK_SIGNAL_FUNC(toc_send_file), ft); 1957 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), "clicked",
1958 else 1958 GTK_SIGNAL_FUNC(toc_send_file), ft);
1959 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), "clicked", 1959 else
1960 GTK_SIGNAL_FUNC(toc_get_file), ft); 1960 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), "clicked",
1961 1961 GTK_SIGNAL_FUNC(toc_get_file), ft);
1962 gtk_widget_show(window); 1962
1963 gtk_widget_show(window);
1964 }
1965
1963 toc_reject_ft(fr); 1966 toc_reject_ft(fr);
1964 } 1967 }
1965 1968
1966 static void accept_file_dialog(struct ft_request *ft) { 1969 static void accept_file_dialog(struct ft_request *ft) {
1967 char buf[BUF_LONG]; 1970 char buf[BUF_LONG];
1982 ft->filename, size, sizes[index], (ft->message) ? "\n" : "", 1985 ft->filename, size, sizes[index], (ft->message) ? "\n" : "",
1983 (ft->message) ? ft->message : ""); 1986 (ft->message) ? ft->message : "");
1984 } else { 1987 } else {
1985 g_snprintf(buf, sizeof(buf), _("%s requests you to send them a file"), ft->user); 1988 g_snprintf(buf, sizeof(buf), _("%s requests you to send them a file"), ft->user);
1986 } 1989 }
1987 do_ask_dialog(buf, NULL, ft, _("Accept"), toc_accept_ft, _("Cancel"), toc_reject_ft, FALSE); 1990 do_ask_dialog(buf, NULL, ft, _("Accept"), toc_accept_ft, _("Cancel"), toc_reject_ft, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE);
1988 } 1991 }