summaryrefslogtreecommitdiffabout
path: root/libical/src/libical/icalenums.c
Side-by-side diff
Diffstat (limited to 'libical/src/libical/icalenums.c') (more/less context) (ignore whitespace changes)
-rw-r--r--libical/src/libical/icalenums.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/libical/src/libical/icalenums.c b/libical/src/libical/icalenums.c
index 6751933..66c5ccd 100644
--- a/libical/src/libical/icalenums.c
+++ b/libical/src/libical/icalenums.c
@@ -36,6 +36,7 @@
#include <assert.h>
+#include "icalmemory.h"
-
-
-struct {
+/*** @brief Allowed request status values
+ */
+static struct {
enum icalrequeststatus kind;
@@ -72,3 +73,7 @@ struct {
{ICAL_3_14_NOCAP_STATUS, 3,14,"Unsupported capability."},
+ {ICAL_3_15_INVCOMMAND, 3,15,"Invalid command."},
{ICAL_4_0_BUSY_STATUS, 4,0,"Event conflict. Date/time is busy."},
+ {ICAL_4_1_STORE_ACCESS_DENIED, 4,1,"Store Access Denied."},
+ {ICAL_4_2_STORE_FAILED, 4,2,"Store Failed."},
+ {ICAL_4_3_STORE_NOT_FOUND, 4,3,"Store not found."},
{ICAL_5_0_MAYBE_STATUS, 5,0,"Request MAY supported."},
@@ -77,2 +82,4 @@ struct {
{ICAL_5_3_NOSCHED_STATUS, 5,3,"No scheduling support for user."},
+ {ICAL_6_1_CONTAINER_NOT_FOUND, 6,1,"Container not found."},
+ {ICAL_9_0_UNRECOGNIZED_COMMAND, 9,0,"An unrecognized command was received."},
{ICAL_UNKNOWN_STATUS, 0,0,"Error: Unknown request status"}
@@ -81,5 +88,6 @@ struct {
+/*** @brief Return the descriptive text for a request status
+ */
const char* icalenum_reqstat_desc(icalrequeststatus stat)
{
-
int i;
@@ -95,3 +103,22 @@ const char* icalenum_reqstat_desc(icalrequeststatus stat)
+/*** @brief Return the code for a request status
+ */
+char* icalenum_reqstat_code(icalrequeststatus stat)
+{
+ int i, major, minor;
+ char tmpbuf[36];
+
+ for (i=0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
+ if ( request_status_map[i].kind == stat) {
+ major = request_status_map[i].major;
+ minor = request_status_map[i].minor;
+ sprintf(tmpbuf, "%i.%i", major, minor);
+ return icalmemory_tmp_copy(tmpbuf);
+ }
+ }
+ return NULL;
+}
+/*** @brief Return the major number for a request status
+ */
short icalenum_reqstat_major(icalrequeststatus stat)
@@ -108,2 +135,4 @@ short icalenum_reqstat_major(icalrequeststatus stat)
+/*** @brief Return the minor number for a request status
+ */
short icalenum_reqstat_minor(icalrequeststatus stat)
@@ -121,2 +150,4 @@ short icalenum_reqstat_minor(icalrequeststatus stat)
+/*** @brief Return a request status for major/minor status numbers
+ */
icalrequeststatus icalenum_num_to_reqstat(short major, short minor)