Mercurial > pidgin.yaz
changeset 2189:dca8e00d7de0
[gaim-migrate @ 2199]
I've decided I like Russ Dill's file transfer stuff and will have that go into gaim when i get around to it.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 29 Aug 2001 20:58:08 +0000 |
parents | 98c434792ab7 |
children | 24d947eff811 |
files | src/prpl.c src/prpl.h |
diffstat | 2 files changed, 10 insertions(+), 142 deletions(-) [+] |
line wrap: on
line diff
--- a/src/prpl.c Wed Aug 29 00:04:59 2001 +0000 +++ b/src/prpl.c Wed Aug 29 20:58:08 2001 +0000 @@ -549,124 +549,3 @@ } else if (gc->email_win) gtk_widget_destroy(gc->email_win); } - -/* -struct ft_req { - struct gaim_connection *gc; - gboolean send; - gboolean multiple; - guint size; - char *name; - ft_callback cb; - gpointer data; - GtkWidget *fd; -}; - -static void ftrrno(gpointer w, struct ft_req *fr) -{ - if (fr->fd && (w != fr->fd)) { - gtk_widget_destroy(fr->fd); - return; - } - if (fr->cb) - fr->cb(fr->gc, NULL, TRUE, fr->data); - if (fr->name) - g_free(fr->name); - g_free(fr); -} - -static void do_exist_dialog(const char *name, unsigned long size, struct ft_req *fr) -{ - \* - GtkWidget *window; - GtkWidget *vbox; - GtkWidget *label; - GtkWidget *hbox; - GtkWidget *button; - char buf[8192]; - - g_snprintf(buf, sizeof(buf), "It appears that %s already exists. Do you want to " - "overwrite the file%s or cancel the transfer?", name, - (size <= fr->size) ? ", resume the download," : ""); - - window = gtk_window_new(GTK_WINDOW_DIALOG); - *\ -} - -static void ftgotfile(gpointer w, struct ft_req *fr) -{ - const char *fname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fr->fd)); - if (!fr->multiple && file_is_dir(fname, fr->fd)) - return; - - if (!fr->multiple && !fr->send) { - struct stat st; - if (stat(fname, &st) == 0) { - do_exist_dialog(fname, st.st_size, fr); - return; - } - } - - fr->cb(fr->gc, fname, FT_EXIST_DNE, fr->data); - fr->cb = NULL; - - gtk_widget_destroy(fr->fd); -} - -static void ftrrok(gpointer w, struct ft_req *ft) -{ - \* ft is going to be free'd as soon as we leave this function, so we'll copy it *\ - struct ft_req *fr = g_memdup(ft, sizeof(struct ft_req)); - char buf[256]; - - if (fr->send) - fr->fd = gtk_file_selection_new(_("Gaim - Select File")); - else - fr->fd = gtk_file_selection_new(_("Gaim - Send File")); - - g_snprintf(buf, sizeof(buf), "%s/%s", g_get_home_dir(), fr->name ? fr->name : ""); - gtk_file_selection_set_filename(GTK_FILE_SELECTION(fr->fd), buf); - - gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fr->fd)->ok_button), "clicked", - GTK_SIGNAL_FUNC(ftgotfile), fr); - gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fr->fd)->cancel_button), "clicked", - GTK_SIGNAL_FUNC(ftrrno), fr); - gtk_signal_connect(GTK_OBJECT(fr->fd), "destroy", GTK_SIGNAL_FUNC(ftrrno), fr); - - gtk_widget_show(fr->fd); -} - -void ft_receive_request(struct gaim_connection *gc, const char *who, gboolean send, gboolean multiple, - char *name, guint size, ft_callback cb, gpointer data) -{ - char buf[8192]; - struct ft_req *fr = g_new0(struct ft_req, 1); - - fr->gc = gc; - fr->send = send; - fr->multiple = multiple; - fr->size = size; - if (name) - fr->name = g_strdup(name); - fr->cb = cb; - fr->data = data; - - if (send) - g_snprintf(buf, sizeof(buf), "%s has just asked %s to send a file.", - who, gc->username); - else if (multiple) - g_snprintf(buf, sizeof(buf), "%s has just asked %s to receive some files.", - who, gc->username); - else if (name && size) - g_snprintf(buf, sizeof(buf), "%s has just asked %s to receive %s (%d bytes).", - who, gc->username, name, size); - else if (name) - g_snprintf(buf, sizeof(buf), "%s has just asked %s to receive %s.", - who, gc->username, name); - else - g_snprintf(buf, sizeof(buf), "%s has just asked %s to receive a file.", - who, gc->username); - - do_ask_dialog(buf, fr, ftrrok, ftrrno); -} -*/
--- a/src/prpl.h Wed Aug 29 00:04:59 2001 +0000 +++ b/src/prpl.h Wed Aug 29 20:58:08 2001 +0000 @@ -145,32 +145,21 @@ extern GSList *protocols; /* this is mostly just for aim.c, when it initializes the protocols */ -void static_proto_init(); +extern void static_proto_init(); /* this is what should actually load the protocol. pass it the protocol's initializer */ -void load_protocol(proto_init, int); -void unload_protocol(struct prpl *); - -struct prpl *find_prpl(int); -void do_proto_menu(); +extern void load_protocol(proto_init, int); +extern void unload_protocol(struct prpl *); -void register_user(gpointer, gpointer); -void prepare_regbox_for_next(); - -void do_ask_dialog(const char *, void *, void *, void *); -void do_prompt_dialog(const char *, void *, void *, void *); +extern struct prpl *find_prpl(int); +extern void do_proto_menu(); -void connection_has_mail(struct gaim_connection *, int, const char *, const char *); +extern void register_user(gpointer, gpointer); +extern void prepare_regbox_for_next(); -/* UI for file transfer */ -#define FT_EXIST_DNE 0 -#define FT_EXIST_OVERWRITE 1 -#define FT_EXIST_RESUME 2 -typedef void (*ft_callback)(struct gaim_connection *, const char *, gint, gpointer); +extern void do_ask_dialog(const char *, void *, void *, void *); +extern void do_prompt_dialog(const char *, void *, void *, void *); -void ft_receive_request(struct gaim_connection *, const char *, gboolean, gboolean, - char *, guint size, ft_callback, gpointer); -void ft_send_request(struct gaim_connection *, const char *, gboolean, char *, ft_callback, gpointer); -gpointer ft_meter(gpointer, const char *, gfloat); +extern void connection_has_mail(struct gaim_connection *, int, const char *, const char *); #endif