Removed 'user' from settings structure and code..
[pazpar2-moved-to-github.git] / src / pazpar2.c
index b2487e5..8d2d77c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: pazpar2.c,v 1.71 2007-04-11 02:14:15 quinn Exp $
+/* $Id: pazpar2.c,v 1.74 2007-04-11 19:55:57 quinn Exp $
    Copyright (c) 2006-2007, Index Data.
 
 This file is part of Pazpar2.
@@ -68,7 +68,6 @@ static void connection_destroy(struct connection *co);
 static int client_prep_connection(struct client *cl);
 static void ingest_records(struct client *cl, Z_Records *r);
 void session_alert_watch(struct session *s, int what);
-char *session_setting_oneval(struct session_database *db, int offset);
 
 IOCHAN channel_list = 0;  // Master list of connections we're handling events to
 
@@ -793,7 +792,7 @@ static struct record *ingest_record(struct client *cl, Z_External *rec)
 char *session_setting_oneval(struct session_database *db, int offset)
 {
     if (!db->settings[offset])
-        return 0;
+        return "";
     return db->settings[offset]->value;
 }
 
@@ -1343,7 +1342,6 @@ void session_apply_setting(struct session *se, char *dbname, char *setting, char
             new->target = dbname;
             new->name = setting;
             new->value = value;
-            new->user = "";
             new->next = sdb->settings[offset];
             sdb->settings[offset] = new;
             break;
@@ -1371,6 +1369,7 @@ void session_init_databases_fun(void *context, struct database *db)
 // of the database list -- subject to modification by the settings ws command
 void session_init_databases(struct session *se)
 {
+    se->databases = 0;
     grep_databases(se, 0, session_init_databases_fun);
 }
 
@@ -1419,8 +1418,10 @@ struct hitsbytarget *hitsbytarget(struct session *se, int *count)
     *count = 0;
     for (cl = se->clients; cl; cl = cl->next)
     {
+        char *name = session_setting_oneval(cl->database, PZ_NAME);
+
         res[*count].id = cl->database->database->url;
-        res[*count].name = cl->database->database->name;
+        res[*count].name = *name ? name : "Unknown";
         res[*count].hits = cl->hits;
         res[*count].records = cl->records;
         res[*count].diagnostic = cl->diagnostic;