[asterisk-commits] oej: trunk r116224 - /trunk/res/res_agi.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed May 14 06:51:10 CDT 2008
Author: oej
Date: Wed May 14 06:51:09 2008
New Revision: 116224
URL: http://svn.digium.com/view/asterisk?view=rev&rev=116224
Log:
Formatting changes (coding guidelines) while thinking about something else...
Modified:
trunk/res/res_agi.c
Modified: trunk/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_agi.c?view=diff&rev=116224&r1=116223&r2=116224
==============================================================================
--- trunk/res/res_agi.c (original)
+++ trunk/res/res_agi.c Wed May 14 06:51:09 2008
@@ -811,15 +811,13 @@
if (res == 0) {
ast_agi_fdprintf(chan, agi->fd, "200 result=%d (timeout)\n", res);
return RESULT_SUCCESS;
- }
+ }
if (res > 0) {
ast_agi_fdprintf(chan, agi->fd, "200 result=%d\n", res);
return RESULT_SUCCESS;
}
- else {
- ast_agi_fdprintf(chan, agi->fd, "200 result=%d (hangup)\n", res);
- return RESULT_FAILURE;
- }
+ ast_agi_fdprintf(chan, agi->fd, "200 result=%d (hangup)\n", res);
+ return RESULT_FAILURE;
}
static int handle_recvtext(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
@@ -829,7 +827,7 @@
if (argc != 3)
return RESULT_SHOWUSAGE;
- buf = ast_recvtext(chan,atoi(argv[2]));
+ buf = ast_recvtext(chan, atoi(argv[2]));
if (buf) {
ast_agi_fdprintf(chan, agi->fd, "200 result=1 (%s)\n", buf);
ast_free(buf);
@@ -846,19 +844,23 @@
if (argc != 3)
return RESULT_SHOWUSAGE;
- if (!strncasecmp(argv[2],"on",2))
+ if (!strncasecmp(argv[2],"on",2)) {
x = 1;
- else
+ } else {
x = 0;
- if (!strncasecmp(argv[2],"mate",4))
+ }
+ if (!strncasecmp(argv[2],"mate",4)) {
x = 2;
- if (!strncasecmp(argv[2],"tdd",3))
+ }
+ if (!strncasecmp(argv[2],"tdd",3)) {
x = 1;
+ }
res = ast_channel_setoption(chan, AST_OPTION_TDD, &x, sizeof(char), 0);
- if (res != RESULT_SUCCESS)
+ if (res != RESULT_SUCCESS) {
ast_agi_fdprintf(chan, agi->fd, "200 result=0\n");
- else
+ } else {
ast_agi_fdprintf(chan, agi->fd, "200 result=1\n");
+ }
return RESULT_SUCCESS;
}
@@ -866,12 +868,14 @@
{
int res;
- if (argc != 3)
- return RESULT_SHOWUSAGE;
+ if (argc != 3) {
+ return RESULT_SHOWUSAGE;
+ }
res = ast_send_image(chan, argv[2]);
- if (!ast_check_hangup(chan))
+ if (!ast_check_hangup(chan)) {
res = 0;
+ }
ast_agi_fdprintf(chan, agi->fd, "200 result=%d\n", res);
return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
@@ -879,33 +883,31 @@
static int handle_controlstreamfile(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
{
int res = 0, skipms = 3000;
- char *fwd = NULL, *rev = NULL, *pause = NULL, *stop = NULL;
-
- if (argc < 5 || argc > 9)
- return RESULT_SHOWUSAGE;
-
- if (!ast_strlen_zero(argv[4]))
+ char *fwd = "#", *rev = "*", *pause = NULL, *stop = NULL; /* Default values */
+
+ if (argc < 5 || argc > 9) {
+ return RESULT_SHOWUSAGE;
+ }
+
+ if (!ast_strlen_zero(argv[4])) {
stop = argv[4];
- else
- stop = NULL;
-
- if ((argc > 5) && (sscanf(argv[5], "%d", &skipms) != 1))
- return RESULT_SHOWUSAGE;
-
- if (argc > 6 && !ast_strlen_zero(argv[6]))
+ }
+
+ if ((argc > 5) && (sscanf(argv[5], "%d", &skipms) != 1)) {
+ return RESULT_SHOWUSAGE;
+ }
+
+ if (argc > 6 && !ast_strlen_zero(argv[6])) {
fwd = argv[6];
- else
- fwd = "#";
-
- if (argc > 7 && !ast_strlen_zero(argv[7]))
+ }
+
+ if (argc > 7 && !ast_strlen_zero(argv[7])) {
rev = argv[7];
- else
- rev = "*";
-
- if (argc > 8 && !ast_strlen_zero(argv[8]))
+ }
+
+ if (argc > 8 && !ast_strlen_zero(argv[8])) {
pause = argv[8];
- else
- pause = NULL;
+ }
res = ast_control_streamfile(chan, argv[3], fwd, rev, stop, pause, NULL, skipms, NULL);
More information about the asterisk-commits
mailing list