00001 #ifdef HAVE_CONFIG_H
00002 # include <config.h>
00003 #endif
00004
00005 #include <glib.h>
00006 #include <string.h>
00007 #include "account.h"
00008 #include "util.h"
00009 #include "plugin.h"
00010 #include "intl.h"
00011 #include "message_parse.h"
00012 #include "file_select.h"
00013 #include "log_window.h"
00014
00015 static void send_file_callback(char *selected_filename, gpointer data)
00016 {
00017 eb_account *ea = (eb_account *)data;
00018 eb_account * x_fer_account;
00019
00020 if(!selected_filename)
00021 return;
00022
00023 if(!ea)
00024 return;
00025
00026 x_fer_account = find_suitable_file_transfer_account(ea, ea->account_contact);
00027
00028 if(x_fer_account) {
00029 eb_local_account * ela = find_suitable_local_account(NULL, x_fer_account->service_id);
00030 RUN_SERVICE(ela)->send_file(ela, x_fer_account, selected_filename);
00031 } else {
00032 eb_local_account * ela = find_suitable_local_account(NULL, ea->service_id);
00033 strcpy(filename, selected_filename);
00034 RUN_SERVICE(ela)->send_im(ela, ea, "EB_COMMAND SEND_FILE");
00035 }
00036 }
00037
00038 void eb_do_send_file(eb_account *ea)
00039 {
00040 eb_do_file_selector(NULL, _("Select file to send"), send_file_callback, ea);
00041 }
00042
00043 void eb_view_log(struct contact *contact)
00044 {
00045 if(contact->logwindow == NULL) {
00046 contact->logwindow = eb_log_window_new(contact);
00047 }
00048 }
00049