/soc/2015/igor.gajowiak/chatlog: 12e64f8d5f34: Added sorting to ...

Igor Gajowiak igor.gajowiak at gmail.com
Thu Jul 30 12:59:59 EDT 2015


Changeset: 12e64f8d5f343641db9736c16017a6118a16bc31
Author:	 Igor Gajowiak <igor.gajowiak at gmail.com>
Date:	 2015-07-30 18:59 +0200
Branch:	 default
URL: https://hg.pidgin.im/soc/2015/igor.gajowiak/chatlog/rev/12e64f8d5f34

Description:

Added sorting to a query which fetches days from a log.

diffstat:

 libpurple/genericlog.h            |  12 +++++++-----
 libpurple/plugins/log/logsqlite.c |   2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)

diffs (41 lines):

diff --git a/libpurple/genericlog.h b/libpurple/genericlog.h
--- a/libpurple/genericlog.h
+++ b/libpurple/genericlog.h
@@ -77,10 +77,11 @@ struct _PurpleGenericLog
  *                   %FALSE otherwise. The client is responsible for freeing
  *                   the result with g_list_free_full(result, g_object_unref).
  * @get_all_days:    Gets an array of all days with at least one message
- *                   received from or sent to a given buddy. Day is represented
- *                   as unix timestamp (guint64) (at 00:00). Returns %TRUE
- *                   if operation succeeds, %FALSE otherwise. The client
- *                   is responsible for freeing the result with g_array_unref.
+ *                   received from or sent to a given buddy. The days are sorted
+ *                   in ascending order. Day is represented as unix timestamp
+ *                   (guint64) (at 00:00). Returns %TRUE if operation succeeds,
+ *                   %FALSE otherwise. The client is responsible for freeing
+ *                   the result with g_array_unref.
  *
  * The abstract base class for all log implementations. A conforming plugin
  * must implement at least activate and deactivate methods. Not supported
@@ -331,7 +332,8 @@ purple_genericlog_get_all_buddies(GList 
  * Gets an array of all days with at least one message received from
  * or sent to a buddy.
  *
- * The caller is responsible for freeing the result with g_array_unref.
+ * The days are sorted in ascending order. The caller is responsible for
+ * freeing the result with g_array_unref.
  *
  * Returns: %TRUE if succeeds, %FALSE otherwise.
  */
diff --git a/libpurple/plugins/log/logsqlite.c b/libpurple/plugins/log/logsqlite.c
--- a/libpurple/plugins/log/logsqlite.c
+++ b/libpurple/plugins/log/logsqlite.c
@@ -253,7 +253,7 @@ typedef enum
 static sqlite3_stmt *get_all_days_q = NULL;
 
 static const char *get_all_days_q_str =
-	"SELECT Time FROM Days WHERE BuddyId = ?1;";
+	"SELECT Time FROM Days WHERE BuddyId = ?1 ORDER BY Time;";
 
 typedef enum
 {



More information about the Commits mailing list