Rename struct rc4_context and stream cipher send/receive functions.
[paraslash.git] / mood.c
diff --git a/mood.c b/mood.c
index f3ce9e0aa11a691202397039ecd275c1fd05268a..732df0a32f8d1e7d19d08f04c773dc5026589caf 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2009 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2007-2011 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -35,7 +35,7 @@ struct afs_statistics {
        /** Number of admissible files */
        unsigned num;
 };
-struct afs_statistics statistics;
+static struct afs_statistics statistics;
 
 /**
  * Each line of the current mood corresponds to a mood_item.
@@ -873,7 +873,7 @@ out:
  *
  * \sa mood_open(), mood_close().
  */
-int reload_current_mood(void)
+static int reload_current_mood(void)
 {
        int ret;
        char *mood_name = NULL;
@@ -890,10 +890,23 @@ int reload_current_mood(void)
        return ret;
 }
 
+/**
+ * Notification callback for the moods table.
+ *
+ * \param event Type of the event just occurred.
+ * \param pb Unused.
+ * \param data Its type depends on the event.
+ *
+ * This function performs actions required due to the occurrence of the given
+ * event. Possible actions include reload of the current mood and update of the
+ * score of an audio file.
+ */
 int moods_event_handler(enum afs_events event, __a_unused struct para_buffer *pb,
                void *data)
 {
-       switch(event) {
+       if (!current_mood)
+               return 0;
+       switch (event) {
        /*
         * The three blob events might change the set of admissible files,
         * so we must reload the score list.
@@ -924,4 +937,3 @@ int moods_event_handler(enum afs_events event, __a_unused struct para_buffer *pb
                return 1;
        }
 }
-