giftcurs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[giFTcurs-commits] giFTcurs/src get.c search.c transfer.c


From: Göran Weinholt
Subject: [giFTcurs-commits] giFTcurs/src get.c search.c transfer.c
Date: Wed, 15 Oct 2003 21:37:21 -0400

CVSROOT:        /cvsroot/giftcurs
Module name:    giFTcurs
Branch:         
Changes by:     Göran Weinholt <address@hidden> 03/10/15 21:37:21

Modified files:
        src            : get.c search.c transfer.c 

Log message:
        Try to convert metadata and filenames to the current locale.

Patches:
Index: giFTcurs/src/get.c
diff -u giFTcurs/src/get.c:1.206 giFTcurs/src/get.c:1.207
--- giFTcurs/src/get.c:1.206    Mon Sep  8 13:47:23 2003
+++ giFTcurs/src/get.c  Wed Oct 15 21:37:21 2003
@@ -18,7 +18,7 @@
  * along with giFTcurs; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,  USA.
  *
- * $Id: get.c,v 1.206 2003/09/08 17:47:23 saturn Exp $
+ * $Id: get.c,v 1.207 2003/10/16 01:37:21 weinholt Exp $
  */
 #include "giftcurs.h"
 
@@ -111,6 +111,7 @@
 
                        if (t && lookup_source(t, sh->user, sh->href))
                                continue;
+                       /* TODO: should g_filename_from_utf8() be used for 
info->filename? */
                        add_source(sh->user, info->hash, info->filesize, 
sh->href, info->filename);
                        added++;
                }
Index: giFTcurs/src/search.c
diff -u giFTcurs/src/search.c:1.132 giFTcurs/src/search.c:1.133
--- giFTcurs/src/search.c:1.132 Mon Sep 15 17:26:57 2003
+++ giFTcurs/src/search.c       Wed Oct 15 21:37:21 2003
@@ -18,7 +18,7 @@
  * along with giFTcurs; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,  USA.
  *
- * $Id: search.c,v 1.132 2003/09/15 21:26:57 saturn Exp $
+ * $Id: search.c,v 1.133 2003/10/16 01:37:21 weinholt Exp $
  */
 #include "giftcurs.h"
 
@@ -301,7 +301,7 @@
 
        meta = g_new(metadata, 1);
        meta->key = g_ascii_strdown(key, -1);
-       meta->data = g_strdup(data);
+       meta->data = convert_to_locale(g_strdup(data));
        dynarray_append(&dobbs->metadata, meta);
 
        dobbs->meta_dirty = TRUE;
@@ -317,7 +317,7 @@
    XXX: does not belong here. */
 void search_result_item_handler(ntree *data, query *q)
 {
-       const char *href, *user, *filepath;
+       const char *href, *user;
        int availability;
        hit *bob, template;
        int i;
@@ -369,14 +369,7 @@
                /* find the index into the real table before we change it */
                i = tree_hold(bob);
        } else {
-               filepath = interface_lookup(data, "file");
-
-               /* This is needed when listing your own shares */
-               if (!filepath)
-                       filepath = interface_lookup(data, "path");
-
-               if (!filepath || !banwords_check(filepath))
-                       return;
+               char *filepath;
 
                if (max_hits) {
                        if (tree_children(q)->num == max_hits - 1)
@@ -385,6 +378,18 @@
                                return;
                }
 
+               filepath = g_strdup(interface_lookup(data, "file"));
+
+               /* This is needed when listing your own shares */
+               if (!filepath)
+                       filepath = g_strdup(interface_lookup(data, "path"));
+
+               if (!filepath || !banwords_check(filepath))
+                       return;
+
+               /* Reencode filepath to try to match our locale */
+               filepath = convert_to_locale(filepath);
+
                /* It's a brand new hit */
                bob = NEW_NODE(hit);
                bob->hash = g_strdup(template.hash);
@@ -401,10 +406,13 @@
                bob->downloading = !!transfer_find(&downloads, NULL, bob->hash, 
bob->filesize, FALSE);
                bob->formatting = format_ref(q->formatting);
                bob->meta_dirty = TRUE;
+               
+               g_free(filepath);
        }
 
        if (user && href)
                add_subhit(bob, user, href, availability, 
interface_lookup(data, "node"));
+
        /* Parse and merge meta data. */
        interface_foreach(data, (PForEachFunc) parse_meta_data, bob);
 
Index: giFTcurs/src/transfer.c
diff -u giFTcurs/src/transfer.c:1.142 giFTcurs/src/transfer.c:1.143
--- giFTcurs/src/transfer.c:1.142       Tue Sep 23 15:54:21 2003
+++ giFTcurs/src/transfer.c     Wed Oct 15 21:37:21 2003
@@ -18,7 +18,7 @@
  * along with giFTcurs; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,  USA.
  *
- * $Id: transfer.c,v 1.142 2003/09/23 19:54:21 weinholt Exp $
+ * $Id: transfer.c,v 1.143 2003/10/16 01:37:21 weinholt Exp $
  */
 #include "giftcurs.h"
 
@@ -247,7 +247,7 @@
        transfer *t = NEW_NODE(transfer);
 
        t->id = id;
-       t->filename = g_strdup(name);
+       t->filename = convert_to_locale(g_strdup(name));
        t->filesize = size;
        t->protocol = NULL;
        t->last_time = g_timer_new();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]