diff options
author | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-02-19 21:12:55 +0000 |
---|---|---|
committer | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-02-19 21:12:55 +0000 |
commit | 9facc63c4c5ba9d1b6feeef49b5c61a4d27b9fb8 (patch) | |
tree | 6c3823c13c5526ec9f5f8db335b70e50aa7ae58b /res | |
parent | 342c3142453597735d42698f513329f8bebfdb9a (diff) |
- Not sending arguments to an application is not "out of memory"
- Making error messages a bit more clear
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@55483 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r-- | res/res_jabber.c | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/res/res_jabber.c b/res/res_jabber.c index 7139efcf5..54c52a33a 100644 --- a/res/res_jabber.c +++ b/res/res_jabber.c @@ -339,23 +339,23 @@ static int aji_status_exec(struct ast_channel *chan, void *data) char *s = NULL, *sender = NULL, *jid = NULL, *screenname = NULL, *resource = NULL, *variable = NULL; int stat = 7; char status[2]; - if (data) { - s = ast_strdupa((char *) data); - if (s) { - sender = strsep(&s, "|"); - if (sender && (sender[0] != '\0')) { - jid = strsep(&s, "|"); - if (jid && (jid[0] != '\0')) { - variable = s; - } else { - ast_log(LOG_ERROR, "Bad arguments\n"); - return -1; - } + + if (!data) { + ast_log(LOG_ERROR, "This application requires arguments.\n"); + return 0; + } + s = ast_strdupa((char *) data); + if (s) { + sender = strsep(&s, "|"); + if (sender && (sender[0] != '\0')) { + jid = strsep(&s, "|"); + if (jid && (jid[0] != '\0')) { + variable = s; + } else { + ast_log(LOG_ERROR, "Bad arguments\n"); + return -1; } } - } else { - ast_log(LOG_ERROR, "Out of memory\n"); - return -1; } if(!strchr(jid, '/')) { @@ -366,25 +366,23 @@ static int aji_status_exec(struct ast_channel *chan, void *data) } client = ast_aji_get_client(sender); if (!client) { - ast_log(LOG_WARNING, "Could not find Connection.\n"); + ast_log(LOG_WARNING, "Could not find sender connection: %s\n", sender); return -1; } if(!&client->buddies) { - ast_log(LOG_WARNING, "No buddies for connection.\n"); + ast_log(LOG_WARNING, "No buddies for connection : %s\n", sender); return -1; } - buddy = ASTOBJ_CONTAINER_FIND(&client->buddies, (resource)?screenname:jid); + buddy = ASTOBJ_CONTAINER_FIND(&client->buddies, resource ? screenname: jid); if (!buddy) { - ast_log(LOG_WARNING, "Could not find Buddy in list.\n"); + ast_log(LOG_WARNING, "Could not find buddy in list : %s\n", resource ? screenname : jid); return -1; } r = aji_find_resource(buddy, resource); - if(!r && buddy->resources) { + if(!r && buddy->resources) r = buddy->resources; - } - if(!r){ + if(!r) ast_log(LOG_NOTICE, "Resource %s of buddy %s not found \n", resource, screenname); - } stat = r->status; sprintf(status, "%d", stat); pbx_builtin_setvar_helper(chan, variable, status); @@ -403,8 +401,8 @@ static int aji_send_exec(struct ast_channel *chan, void *data) char *s = NULL, *sender = NULL, *recipient = NULL, *message = NULL; if (!data) { - ast_log(LOG_ERROR, "Out of memory\n"); - return -1; + ast_log(LOG_ERROR, "This application requires arguments.\n"); + return 0; } s = ast_strdupa((char *) data); if (s) { @@ -414,13 +412,13 @@ static int aji_send_exec(struct ast_channel *chan, void *data) if (recipient && (recipient[0] != '\0')) { message = s; } else { - ast_log(LOG_ERROR, "Bad arguments \n"); + ast_log(LOG_ERROR, "Bad arguments: %s\n", (char *) data); return -1; } } } if (!(client = ast_aji_get_client(sender))) { - ast_log(LOG_WARNING, "Could not find Sender.\n"); + ast_log(LOG_WARNING, "Could not find sender connection: %s\n", sender); return -1; } if (strchr(recipient, '@') && message) |