From: Luigi Rizzo Date: Thu, 19 Oct 2006 17:07:08 +0000 (+0000) Subject: implement proper XML/HTML formatting of multiple messages X-Git-Tag: 1.6.0-beta1~3^2~4337 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32214ffc02b1ab88cc7578e273ac4b619c9bbe5e;p=thirdparty%2Fasterisk.git implement proper XML/HTML formatting of multiple messages (e.g. the result of waitevent). Also fix some comments. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45690 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/manager.c b/main/manager.c index 95c8eafa6e..3f32e73c9a 100644 --- a/main/manager.c +++ b/main/manager.c @@ -83,10 +83,6 @@ struct eventqent { char eventdata[1]; /* really variable size, allocated by append_event() */ }; struct eventqent *master_eventq = NULL; /* Protected by the sessions list lock */ -/* - * XXX for some unclear reasons, we make sure master_eventq always - * has one event in it (Placeholder) in init_manager(). - */ static int enabled = 0; static int portno = DEFAULT_MANAGER_PORT; @@ -505,7 +501,6 @@ static struct ast_cli_entry cli_manager[] = { * (why check for e->next ?) wakeup the * main thread, which is in charge of freeing the record. * Returns the next record. - * XXX Locking assumptions ??? next may change if we are last. */ static struct eventqent *unref_event(struct eventqent *e) { @@ -991,10 +986,10 @@ static int action_waitevent(struct mansession *s, struct message *m) ast_mutex_unlock(&s->__lock); if (needexit) break; - if (!s->inuse && s->fd > 0) { + if (!s->inuse && s->fd > 0) { /* AMI session */ if (ast_wait_for_input(s->fd, 1000)) break; - } else { + } else { /* HTTP session */ sleep(1); } } @@ -2022,7 +2017,6 @@ static void *accept_thread(void *ignore) /* * events are appended to a queue from where they * can be dispatched to clients. - * Must be called with the session lock held (or equivalent). */ static int append_event(const char *str, int category) { @@ -2356,8 +2350,9 @@ static char *xml_translate(char *in, struct ast_variable *vars, enum output_form tmp = out; /* we want to stop when we find an empty line */ while (in && *in) { - in = ast_skip_blanks(in); /* trailing \n from before */ val = strsep(&in, "\r\n"); /* mark start and end of line */ + if (in && *in == '\n') /* remove trailing \n if any */ + in++; ast_trim_blanks(val); ast_verbose("inobj %d in_data %d line <%s>\n", inobj, in_data, val); if (ast_strlen_zero(val)) {