include "logger.h" and errno.h from asterisk.h - usage shows that they
[asterisk/asterisk.git] / apps / app_followme.c
index 751bef4..57f440b 100644 (file)
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
 #include <signal.h>
 
 #include "asterisk/lock.h"
 #include "asterisk/file.h"
-#include "asterisk/logger.h"
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
 #include "asterisk/options.h"
@@ -61,7 +56,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 static char *app = "FollowMe";
 static char *synopsis = "Find-Me/Follow-Me application";
 static char *descrip = 
-"  FollowMe(followmeid,options):\n"
+"  FollowMe(followmeid[,options]):\n"
 "This application performs Find-Me/Follow-Me functionality for the caller\n"
 "as defined in the profile matching the <followmeid> parameter in\n"
 "followme.conf. If the specified <followmeid> profile doesn't exist in\n"
@@ -840,13 +835,12 @@ static void findmeexec(struct fm_args *tpargs)
                        winner = wait_for_winner(findme_user_list, nm, caller, tpargs->namerecloc, &status, tpargs);
                
                                        
-               AST_LIST_TRAVERSE_SAFE_BEGIN(findme_user_list, fmuser, entry) {
+               while ((fmuser = AST_LIST_REMOVE_HEAD(findme_user_list, entry))) {
                        if (!fmuser->cleared && fmuser->ochan != winner)
                                clear_caller(fmuser);
-                       AST_LIST_REMOVE_CURRENT(findme_user_list, entry);
                        ast_free(fmuser);
                }
-               AST_LIST_TRAVERSE_SAFE_END
+
                fmuser = NULL;
                tmpuser = NULL;
                headuser = NULL;        
@@ -978,11 +972,8 @@ static int app_exec(struct ast_channel *chan, void *data)
        
        findmeexec(&targs);             
        
-       AST_LIST_TRAVERSE_SAFE_BEGIN(&targs.cnumbers, nm, entry) {
-               AST_LIST_REMOVE_CURRENT(&targs.cnumbers, entry);
+       while ((nm = AST_LIST_REMOVE_HEAD(&targs.cnumbers, entry)))
                ast_free(nm);
-       }
-       AST_LIST_TRAVERSE_SAFE_END
                
        if (!ast_strlen_zero(namerecloc))
                unlink(namerecloc);