[svn-commits] twilson: branch twilson/calendaring r156468 - in /team/twilson/calendaring: b...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Nov 12 17:56:22 CST 2008
Author: twilson
Date: Wed Nov 12 17:56:22 2008
New Revision: 156468
URL: http://svn.digium.com/view/asterisk?view=rev&rev=156468
Log:
Clean up some merge issues, use xmlFree instead of ast_free on libxml2 xmlChar *, don't forget to unreference event containers when destructing pvts (eep!), and add a frew more doxygen comments
Added:
team/twilson/calendaring/build_tools/get_documentation (with props)
Modified:
team/twilson/calendaring/build_tools/menuselect-deps.in
team/twilson/calendaring/include/asterisk/calendar.h
team/twilson/calendaring/main/calendar.c
team/twilson/calendaring/res/res_caldav.c
team/twilson/calendaring/res/res_exchangecal.c
team/twilson/calendaring/res/res_icalendar.c
Added: team/twilson/calendaring/build_tools/get_documentation
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/build_tools/get_documentation?view=auto&rev=156468
==============================================================================
--- team/twilson/calendaring/build_tools/get_documentation (added)
+++ team/twilson/calendaring/build_tools/get_documentation Wed Nov 12 17:56:22 2008
@@ -1,0 +1,3 @@
+/\/\*\*\* DOCUMENTATION/ {printit=1; next}
+/\*\*\*\// {if (printit) exit}
+// {if (printit) print}
Propchange: team/twilson/calendaring/build_tools/get_documentation
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/twilson/calendaring/build_tools/get_documentation
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/twilson/calendaring/build_tools/get_documentation
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: team/twilson/calendaring/build_tools/menuselect-deps.in
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/build_tools/menuselect-deps.in?view=diff&rev=156468&r1=156467&r2=156468
==============================================================================
--- team/twilson/calendaring/build_tools/menuselect-deps.in (original)
+++ team/twilson/calendaring/build_tools/menuselect-deps.in Wed Nov 12 17:56:22 2008
@@ -27,7 +27,6 @@
NETSNMP=@PBX_NETSNMP@
NEWT=@PBX_NEWT@
NEON=@PBX_NEON@
-UNIXODBC_OR_IODBC=@PBX_ODBC@
ODBC=@PBX_ODBC@
OGG=@PBX_OGG@
OPENH323=@PBX_OPENH323@
Modified: team/twilson/calendaring/include/asterisk/calendar.h
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/include/asterisk/calendar.h?view=diff&rev=156468&r1=156467&r2=156468
==============================================================================
--- team/twilson/calendaring/include/asterisk/calendar.h (original)
+++ team/twilson/calendaring/include/asterisk/calendar.h Wed Nov 12 17:56:22 2008
@@ -32,7 +32,8 @@
*
* \note This API implements an abstraction for handling different calendaring
* technologies in Asterisk. The services provided by the API are a dialplan
- * function to query whether or not a calendar is busy at the present time,
+ * function to query whether or not a calendar is busy at the present time, a
+ * adialplan function to query specific information about events in a time range,
* a devicestate provider, and notification of calendar events through execution
* of dialplan apps or dialplan logic at a specific context and extension. The
* information available through the CALENDAR_EVENT() dialplan function are:
@@ -95,14 +96,13 @@
AST_STRING_FIELD(uid);
);
struct ast_calendar *owner;
- time_t start;
- time_t end;
- time_t alarm;
- int alarm_tries;
- enum ast_calendar_busy_state busy_state;
- int notify_sched;
- int bs_start_sched;
- int bs_end_sched;
+ time_t start; /*!< Start of event (UTC) */
+ time_t end; /*!< End of event (UTC) */
+ time_t alarm; /*!< Time for event notification */
+ enum ast_calendar_busy_state busy_state; /*!< The busy status of the event */
+ int notify_sched; /*!< The sched for event notification */
+ int bs_start_sched; /*!< The sched for changing the device state at the start of an event */
+ int bs_end_sched; /*!< The sched for changing the device state at the end of an event */
};
/*! \brief Asterisk calendar structure */
@@ -124,7 +124,7 @@
pthread_t thread; /*!< The thread that the calendar is loaded/updated in */
ast_cond_t unload;
int unloading;
- struct ao2_container *events;
+ struct ao2_container *events; /*!< The events that are known at this time */
};
/*! \brief Register a new calendar technology */
Modified: team/twilson/calendaring/main/calendar.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/main/calendar.c?view=diff&rev=156468&r1=156467&r2=156468
==============================================================================
--- team/twilson/calendaring/main/calendar.c (original)
+++ team/twilson/calendaring/main/calendar.c Wed Nov 12 17:56:22 2008
@@ -37,7 +37,6 @@
#include "asterisk/pbx.h"
#include "asterisk/app.h"
-#define TASK_POOL_THREADS 8
#define MAX_BUCKETS 19
static struct ao2_container *calendars;
@@ -141,6 +140,7 @@
cal->tech_pvt = cal->tech->unref_calendar(cal->tech_pvt);
ast_calendar_clear_events(cal);
ast_string_field_free_memory(cal);
+ ao2_ref(cal->events, -1);
ao2_unlock(cal);
}
@@ -296,9 +296,6 @@
ao2_unlink(cal->events, event);
event = ast_calendar_unref_event(event);
}
-
-
- return;
}
struct ast_calendar_event *ast_calendar_event_alloc(struct ast_calendar *cal)
@@ -555,8 +552,6 @@
struct ast_calendar *cal;
const struct ast_calendar_tech *tech;
- /* This works, but I can't help thinking that subscribing to a FULLY_BOOTED
- * event would be preferable */
while (!ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) {
sleep(1);
}
@@ -937,9 +932,9 @@
} else if (!strcasecmp(args.field, "uid")) {
ast_copy_string(buf, entry->event->uid, len);
} else if (!strcasecmp(args.field, "start")) {
- snprintf(buf, len, "%ld", (long)entry->event->start);
+ snprintf(buf, len, "%ld", entry->event->start);
} else if (!strcasecmp(args.field, "end")) {
- snprintf(buf, len, "%ld", (long)entry->event->end);
+ snprintf(buf, len, "%ld", entry->event->end);
} else if (!strcasecmp(args.field, "busystate")) {
snprintf(buf, len, "%d", entry->event->busy_state);
} else {
Modified: team/twilson/calendaring/res/res_caldav.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/res/res_caldav.c?view=diff&rev=156468&r1=156467&r2=156468
==============================================================================
--- team/twilson/calendaring/res/res_caldav.c (original)
+++ team/twilson/calendaring/res/res_caldav.c Wed Nov 12 17:56:22 2008
@@ -69,12 +69,20 @@
static void caldav_destructor(void *obj)
{
struct caldav_pvt *pvt = obj;
+ struct ao2_iterator i;
+ struct ast_calendar_event *event;
ast_debug(1, "Destroying pvt for iCalendar %s\n", pvt->owner->name);
if (pvt->session) {
ne_session_destroy(pvt->session);
}
ast_string_field_free_memory(pvt);
+ i = ao2_iterator_init(pvt->events, 0);
+ while ((event = ao2_iterator_next(&i))) {
+ ao2_unlink(pvt->events, event);
+ event = ast_calendar_unref_event(event);
+ }
+ ao2_ref(pvt->events, -1);
}
static void *unref_caldav(void *obj)
@@ -155,18 +163,14 @@
snprintf(buf, sizeof(buf), "%s%s", pvt->uri.path, subdir ? subdir->str : "");
- ast_log(LOG_NOTICE, "buf is '%s'\n", buf);
- sleep(1);
-
req = ne_request_create(pvt->session, method, buf);
ne_add_response_body_reader(req, ne_accept_2xx, fetch_response_reader, &response);
ne_set_request_body_buffer(req, req_body->str, req_body->used);
ne_add_request_header(req, "Content-type", ast_strlen_zero(content_type) ? "text/xml" : content_type);
- ast_log(LOG_NOTICE, "Content-type: %s\n", ast_strlen_zero(content_type) ? "text/xml" : content_type);
ret = ne_request_dispatch(req);
-#if 1
+#if 0
do {
void *cursor = NULL;
const char *name, *value;
@@ -473,7 +477,7 @@
tmp = xmlStrndup(ch, len);
ast_str_append(&state->cdata, 0, "%s", (char *)tmp);
- ast_free(tmp);
+ xmlFree(tmp);
}
static int update_caldav(struct caldav_pvt *pvt)
Modified: team/twilson/calendaring/res/res_exchangecal.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/res/res_exchangecal.c?view=diff&rev=156468&r1=156467&r2=156468
==============================================================================
--- team/twilson/calendaring/res/res_exchangecal.c (original)
+++ team/twilson/calendaring/res/res_exchangecal.c Wed Nov 12 17:56:22 2008
@@ -203,12 +203,20 @@
static void exchangecal_destructor(void *obj)
{
struct exchangecal_pvt *pvt = obj;
+ struct ao2_iterator i;
+ struct ast_calendar_event *event;
ast_debug(1, "Destroying pvt for iCalendar %s\n", pvt->owner->name);
if (pvt->session) {
ne_session_destroy(pvt->session);
}
ast_string_field_free_memory(pvt);
+ i = ao2_iterator_init(pvt->events, 0);
+ while ((event = ao2_iterator_next(&i))) {
+ ao2_unlink(pvt->events, event);
+ event = ast_calendar_unref_event(event);
+ }
+ ao2_ref(pvt->events, -1);
}
static void *unref_exchangecal(void *obj)
Modified: team/twilson/calendaring/res/res_icalendar.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/res/res_icalendar.c?view=diff&rev=156468&r1=156467&r2=156468
==============================================================================
--- team/twilson/calendaring/res/res_icalendar.c (original)
+++ team/twilson/calendaring/res/res_icalendar.c Wed Nov 12 17:56:22 2008
@@ -65,6 +65,8 @@
static void icalendar_destructor(void *obj)
{
struct icalendar_pvt *pvt = obj;
+ struct ao2_iterator i;
+ struct ast_calendar_event *event;
ast_debug(1, "Destroying pvt for iCalendar %s\n", pvt->owner->name);
if (pvt->session) {
@@ -74,7 +76,11 @@
icalcomponent_free(pvt->data);
}
ast_string_field_free_memory(pvt);
-
+ while ((event = ao2_iterator_next(&i))) {
+ ao2_unlink(pvt->events, event);
+ event = ast_calendar_unref_event(event);
+ }
+ ao2_ref(pvt->events, -1);
}
static void *unref_icalendar(void *obj)
More information about the svn-commits
mailing list