[asterisk-commits] seanbright: branch group/asterisk-cpp r168453 - /team/group/asterisk-cpp/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jan 11 18:30:00 CST 2009


Author: seanbright
Date: Sun Jan 11 18:30:00 2009
New Revision: 168453

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168453
Log:
Use an overloaded function instead of the MSG_MOREDATA magic.

Modified:
    team/group/asterisk-cpp/main/manager.c

Modified: team/group/asterisk-cpp/main/manager.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/main/manager.c?view=diff&rev=168453&r1=168452&r2=168453
==============================================================================
--- team/group/asterisk-cpp/main/manager.c (original)
+++ team/group/asterisk-cpp/main/manager.c Sun Jan 11 18:30:00 2009
@@ -950,23 +950,28 @@
 /*! \brief send a response with an optional message,
  * and terminate it with an empty line.
  * m is used only to grab the 'ActionID' field.
- *
- * Use the explicit constant MSG_MOREDATA to remove the empty line.
- * XXX MSG_MOREDATA should go to a header file.
  */
-#define MSG_MOREDATA	((const char *) ((void (*)(struct mansession *, const struct message *, const char *, char *)) astman_send_response))
-static void astman_send_response_full(struct mansession *s, const struct message *m, const char *resp, const char *msg, const char *listflag)
-{
-	const char *id = astman_get_header(m, "ActionID");
-
-	astman_append(s, "Response: %s\r\n", resp);
+static void astman_send_response_full_common(struct mansession *s, const struct message *m, const char *resp, const char *listflag)
+{
+    const char *id = astman_get_header(m, "ActionID");
+
+    astman_append(s, "Response %s\r\n", resp);
 	if (!ast_strlen_zero(id))
 		astman_append(s, "ActionID: %s\r\n", id);
 	if (listflag)
 		astman_append(s, "Eventlist: %s\r\n", listflag);	/* Start, complete, cancelled */
-	if (msg == MSG_MOREDATA)
-		return;
-	else if (msg)
+}
+
+static void astman_send_response_full(struct mansession *s, const struct message *m, const char *resp, const char *listflag)
+{
+    astman_send_response_full_common(s, m, resp, listflag);
+}
+
+static void astman_send_response_full(struct mansession *s, const struct message *m, const char *resp, const char *msg, const char *listflag)
+{
+    astman_send_response_full_common(s, m, resp, listflag);
+
+	if (msg)
 		astman_append(s, "Message: %s\r\n\r\n", msg);
 	else
 		astman_append(s, "\r\n");
@@ -989,7 +994,7 @@
 
 static void astman_start_ack(struct mansession *s, const struct message *m)
 {
-	astman_send_response_full(s, m, "Success", MSG_MOREDATA, NULL);
+	astman_send_response_full(s, m, "Success", NULL);
 }
 
 void astman_send_listack(struct mansession *s, const struct message *m, const char *msg, const char *listflag)




More information about the asterisk-commits mailing list