/[giftcurs]/giFTcurs/src/transfer.c
ViewVC logotype

Diff of /giFTcurs/src/transfer.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.148 by weinholt, Wed Nov 3 21:30:05 2004 UTC revision 1.149 by weinholt, Thu Nov 4 14:48:25 2004 UTC
# Line 32  Line 32 
32  #include "gift.h"  #include "gift.h"
33  #include "settings.h"  #include "settings.h"
34  #include "events.h"  #include "events.h"
35    #include "giftsrv.h"
36    
37  /* This should never be used. It's only here so it can be translated. */  /* This should never be used. It's only here so it can be translated. */
38  static const char *_statuses[] G_GNUC_UNUSED;  static const char *_statuses[] G_GNUC_UNUSED;
# Line 108  static void transfer_detach(transfer *); Line 109  static void transfer_detach(transfer *);
109  static void transfer_detach_all(void);  static void transfer_detach_all(void);
110  static const char *transfer_sort_order(const transfer_tree *);  static const char *transfer_sort_order(const transfer_tree *);
111  static const char *source_sort_order(void);  static const char *source_sort_order(void);
112    static transfer *transfer_new(GString *xferobj);
113  static void transfer_destroy(transfer *);  static void transfer_destroy(transfer *);
114  static void source_destroy(source *);  static void source_destroy(source *);
115    
# Line 150  void transfers_init(void) Line 152  void transfers_init(void)
152          tree_resort(&downloads);          tree_resort(&downloads);
153  }  }
154    
155    static void GIFTSRV_DownloadStart_return(struct rpc_msg *msg,
156                                                                                     gc_xdr_data *data,     gpointer user_data)
157    {
158            GString *xferobj;
159            
160            if (rpc_decode_error(msg, __FUNCTION__))
161                    return;
162    
163            /* GIFT_xferobj_t */
164            xferobj = g_string_new(NULL);
165            gc_xdr_vopaque(data, (gpointer*) &xferobj->str, &xferobj->len, -1);
166    
167            tree_insort(&downloads, transfer_new(xferobj));
168    }
169    
170  void download_start(GString *searchobj, GString *resultobj)  void download_start(GString *searchobj, GString *resultobj)
171  {  {
172            GIFTSRV_DownloadStart(GIFTSRV_DownloadStart_return, NULL,
173                                                      searchobj, resultobj);
174  }  }
175    
176  static void source_destroy(source * s)  static void source_destroy(source * s)
# Line 231  void transfer_forget(transfer *t) Line 250  void transfer_forget(transfer *t)
250          transfer_destroy(t);          transfer_destroy(t);
251  }  }
252    
253  static transfer *transfer_new(GString *xferobj, const char *name,  static transfer *transfer_new(GString *xferobj)
                                                           gint64 size)  
254  {  {
255          transfer *t = NEW_NODE(transfer);          transfer *t = NEW_NODE(transfer);
256    
257          t->active = 1;          t->active = 1;
         t->filename = convert_to_locale(g_strdup(name));  
         t->filesize = size;  
258          t->protocol = NULL;          t->protocol = NULL;
259          t->last_time = g_timer_new();          t->last_time = g_timer_new();
260          list_initialize(tree_children(t));          list_initialize(tree_children(t));

Legend:
Removed from v.1.148  
changed lines
  Added in v.1.149

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26