]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add missing 'getnum' field
authorTerry Wilson <twilson@digium.com>
Wed, 14 Oct 2009 21:16:57 +0000 (21:16 +0000)
committerTerry Wilson <twilson@digium.com>
Wed, 14 Oct 2009 21:16:57 +0000 (21:16 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@224074 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_calendar.c

index 9b93aa96531fdf09febeb75344c8774d49b5a7cb..7d5721b10ccfc1533c3d310978f8275d9ea2d6cc 100644 (file)
@@ -1171,6 +1171,7 @@ static int calendar_query_result_exec(struct ast_channel *chan, const char *cmd,
        struct eventlist *events;
        struct evententry *entry;
        int row = 1;
+       size_t listlen = 0;
        AST_DECLARE_APP_ARGS(args,
                AST_APP_ARG(id);
                AST_APP_ARG(field);
@@ -1206,6 +1207,15 @@ static int calendar_query_result_exec(struct ast_channel *chan, const char *cmd,
                row = atoi(args.row);
        }
 
+       AST_LIST_TRAVERSE(events, entry, list) {
+               listlen++;
+       }
+
+       if (!strcasecmp(args.field, "getnum")) {
+               snprintf(buf, len, "%zu", listlen);
+               return 0;
+       }
+
        AST_LIST_TRAVERSE(events, entry, list) {
                if (--row) {
                        continue;