[svn-commits] branch group/asterisk-imap r37493 -
/team/group/asterisk-imap/apps/
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Wed Jul 12 15:39:12 MST 2006
Author: mogorman
Date: Wed Jul 12 17:39:12 2006
New Revision: 37493
URL: http://svn.digium.com/view/asterisk?rev=37493&view=rev
Log:
okay now it works thanks russell
Modified:
team/group/asterisk-imap/apps/Makefile
team/group/asterisk-imap/apps/app_voicemail.c
Modified: team/group/asterisk-imap/apps/Makefile
URL: http://svn.digium.com/view/asterisk/team/group/asterisk-imap/apps/Makefile?rev=37493&r1=37492&r2=37493&view=diff
==============================================================================
--- team/group/asterisk-imap/apps/Makefile (original)
+++ team/group/asterisk-imap/apps/Makefile Wed Jul 12 17:39:12 2006
@@ -16,13 +16,13 @@
SELECTED_MODS:=$(filter-out $(MENUSELECT_APPS),$(patsubst %.c,%,$(wildcard app_*.c)))
-ifneq ($(findstring ODBC_STORAGE,$(MENUSELECT_app_voicemail)),)
+ifneq ($(findstring ODBC_STORAGE,$(MENUSELECT_OPTS_app_voicemail)),)
MENUSELECT_DEPENDS_app_voicemail+=$(MENUSELECT_DEPENDS_ODBC_STORAGE)
endif
-ifneq ($(findstring EXTENDED_ODBC_STORAGE,$(MENUSELECT_app_voicemail)),)
+ifneq ($(findstring EXTENDED_ODBC_STORAGE,$(MENUSELECT_OPTS_app_voicemail)),)
MENUSELECT_DEPENDS_app_voicemail+=$(MENUSELECT_DEPENDS_EXTENDED_ODBC_STORAGE)
endif
-ifneq ($(findstring IMAP_STORAGE,$(MENUSELECT_app_voicemail)),)
+ifneq ($(findstring IMAP_STORAGE,$(MENUSELECT_OPTS_app_voicemail)),)
MENUSELECT_DEPENDS_app_voicemail+=$(MENUSELECT_DEPENDS_IMAP_STORAGE)
endif
Modified: team/group/asterisk-imap/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/group/asterisk-imap/apps/app_voicemail.c?rev=37493&r1=37492&r2=37493&view=diff
==============================================================================
--- team/group/asterisk-imap/apps/app_voicemail.c (original)
+++ team/group/asterisk-imap/apps/app_voicemail.c Wed Jul 12 17:39:12 2006
@@ -79,13 +79,13 @@
#include <sys/mman.h>
#include <time.h>
#include <dirent.h>
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
#include <ctype.h>
#include <signal.h>
#include <pwd.h>
-#include "c-client/c-client.h"
-#include "c-client/imap4r1.h"
-#include "c-client/linkage.h"
+#include "c-client.h"
+#include "imap4r1.h"
+#include "linkage.h"
#endif
#include "asterisk/lock.h"
#include "asterisk/file.h"
@@ -109,7 +109,7 @@
#include "asterisk/res_odbc.h"
#endif
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
char *curhst = NIL; /* currently connected host */
char *curusr = NIL; /* current login user */
@@ -328,7 +328,7 @@
unsigned int flags; /*!< VM_ flags */
int saydurationm;
int maxmsg; /*!< Maximum number of msgs per folder for this mailbox */
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
char imapuser[80]; /* IMAP server login */
#endif
AST_LIST_ENTRY(ast_vm_user) list;
@@ -356,7 +356,7 @@
int oldmessages;
int starting;
int repeats;
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
int updated; /* decremented on each mail check until 1 -allows delay */
long msgArray[256];
MAILSTREAM *mailstream;
@@ -391,7 +391,7 @@
#define COPY(a,b,c,d,e,f,g,h) (copy_file(a,b,c,d,e,f))
#define DELETE(a,b,c) (delete_file(a,b))
#else
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
#define RETRIEVE(a,b)
#define DISPOSE(a,b)
#define STORE(a,b,c,d)
@@ -417,7 +417,11 @@
#ifdef ODBC_STORAGE
static char *tdesc = "Comedian Mail (Voicemail System) with ODBC Storage";
#else
+#ifdef IMAP_STORAGE
+static char *tdesc = "Comedian Mail (Voicemail System) with IMAP Storage";
+#else
static char *tdesc = "Comedian Mail (Voicemail System)";
+#endif
#endif
static char *addesc = "Comedian Mail";
@@ -574,7 +578,7 @@
ast_copy_string(vmu->language, value, sizeof(vmu->language));
} else if (!strcasecmp(var, "tz")) {
ast_copy_string(vmu->zonetag, value, sizeof(vmu->zonetag));
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
} else if (!strcasecmp(var, "imapuser")) {
strncpy(vmu->imapuser, value, sizeof(vmu->imapuser) - 1);
#endif
@@ -893,7 +897,7 @@
return snprintf(dest, len, "%s%s/%s/%s", VM_SPOOL_DIR, context, ext, folder);
}
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
static int make_gsm_file(char *dest, char *imapuser, char *dir, int num)
{
char gsmdir[256];
@@ -967,7 +971,7 @@
return 1;
}
-#ifndef USE_IMAP_STORAGE
+#ifndef IMAP_STORAGE
/* only return failure if ast_lock_path returns 'timeout',
not if the path does not exist or any other reason
*/
@@ -1566,7 +1570,7 @@
#else
-#ifndef USE_IMAP_STORAGE
+#ifndef IMAP_STORAGE
static int count_messages(struct ast_vm_user *vmu, char *dir)
{
/* Find all .txt files - even if they are not in sequence from 0000 */
@@ -1958,7 +1962,7 @@
else
fprintf(p, "Subject: [PBX]: New message %d in mailbox %s\n", msgnum + 1, mailbox);
fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>\n", msgnum, (unsigned int)ast_random(), mailbox, getpid(), host);
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
/* additional information needed for IMAP searching */
fprintf(p, "X-Asterisk-VM-Message-Num: %d\n", msgnum + 1);
/* fprintf(p, "X-Asterisk-VM-Orig-Mailbox: %s\n", ext); */
@@ -2023,7 +2027,7 @@
snprintf(fname, sizeof(fname), "%s.%s", attach, format);
base_encode(fname, p);
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
/* only attach if necessary */
ast_log(LOG_DEBUG, "Before second attachment with format set to:%s\n",format);
if (strcmp(format, "gsm")) {
@@ -2130,7 +2134,7 @@
return 0;
}
-#ifndef USE_IMAP_STORAGE
+#ifndef IMAP_STORAGE
static int get_date(char *s, int len)
{
struct tm tm;
@@ -2384,7 +2388,7 @@
}
#else
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
static int messagecount(const char *mailbox, int *newmsgs, int *oldmsgs)
{
SEARCHPGM *pgm;
@@ -2725,7 +2729,7 @@
static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_options *options)
{
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
int newmsgs, oldmsgs;
struct vm_state *vms;
#else
@@ -2899,7 +2903,7 @@
if (!ast_strlen_zero(fmt)) {
msgnum = 0;
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
/* Is ext a mailbox? */
/* must open stream for this user to get info! */
vms = get_vm_state_by_mailbox(ext,0);
@@ -3075,7 +3079,7 @@
return res;
}
-#ifndef USE_IMAP_STORAGE
+#ifndef IMAP_STORAGE
static int resequence_mailbox(struct ast_vm_user *vmu, char *dir)
{
/* we know max messages, so stop process when number is hit */
@@ -3114,7 +3118,7 @@
static int save_to_folder(struct ast_vm_user *vmu, struct vm_state *vms, int msg, int box)
{
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
/* we must use mbox(x) folder names, and copy the message there */
/* simple. huh? */
char *dbox = mbox(box);
@@ -3750,7 +3754,7 @@
ast_log(LOG_DEBUG, "In notify_new_message...\n");
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
stpcpy(todir,TMP);
sprintf(fn, "%s/msg%s%04d", todir, vmu->mailbox, msgnum);
#else
@@ -3805,7 +3809,7 @@
static int forward_message(struct ast_channel *chan, char *context, struct vm_state *vms, struct ast_vm_user *sender,
char *fmt, int flag, signed char record_gain)
{
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
BODY *body;
char *header_content;
char *temp;
@@ -3958,7 +3962,7 @@
cmd = vm_forwardoptions(chan, sender, dir, curmsg, vmfmts, context, record_gain);
if (!cmd) {
AST_LIST_TRAVERSE_SAFE_BEGIN(&extensions, vmtmp, list) {
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
/* NEED TO CHANGE username to mailbox!! - JAR */
/* Need to get message content */
ast_log (LOG_DEBUG,"Before mail_fetchheaders, curmsg is: %d, imap messages is %lu\n",vms->curmsg, vms->msgArray[vms->curmsg]);
@@ -4315,7 +4319,7 @@
return res;
}
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms)
{
BODY *body;
@@ -4523,7 +4527,7 @@
}
#endif
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box)
{
SEARCHPGM *pgm;
@@ -4643,7 +4647,7 @@
goto done;
vms->curmsg = -1;
-#ifndef USE_IMAP_STORAGE
+#ifndef IMAP_STORAGE
int res = 0, nummsg;
/* Get the deleted messages fixed */
if (vm_lock_path(vms->curdir))
@@ -6001,7 +6005,7 @@
signed char record_gain = 0;
int play_auto = 0;
int play_folder = 0;
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
int deleted = 0;
#endif
LOCAL_USER_ADD(u);
@@ -6107,7 +6111,7 @@
/* If ADSI is supported, setup login screen */
adsi_begin(chan, &useadsi);
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
vms.interactive = 1;
vms.updated = 2;
vmstate_insert(&vms);
@@ -6126,7 +6130,7 @@
/* Set language from config to override channel language */
if (!ast_strlen_zero(vmu->language))
ast_string_field_set(chan, language, vmu->language);
-#ifndef USE_IMAP_STORAGE
+#ifndef IMAP_STORAGE
create_dirpath(vms.curdir, sizeof(vms.curdir), vmu->context, vms.username, "");
#endif
/* Retrieve old and new message counts */
@@ -6184,7 +6188,7 @@
goto out;
}
}
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
ast_log(LOG_DEBUG, "Checking quotas: comparing %u to %u\n",vms.quota_usage,vms.quota_limit);
if (vms.quota_usage >= vms.quota_limit) {
ast_log(LOG_DEBUG, "*** QUOTA EXCEEDED!!\n");
@@ -6368,7 +6372,7 @@
cmd = ast_play_and_wait(chan, "vm-nomore");
}
}
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
deleted = 1;
#endif
break;
@@ -6397,7 +6401,7 @@
if (cmd == ERROR_LOCK_PATH) {
res = cmd;
goto out;
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
} else if (cmd == 10) {
goto out;
#endif
@@ -6484,7 +6488,7 @@
manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext_context, has_voicemail(ext_context, NULL));
run_externnotify(vmu->context, vmu->mailbox);
}
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
/* expunge message - use UID Expunge if supported on IMAP server*/
ast_log(LOG_DEBUG, "*** Checking if we can expunge, deleted set to %d, expungeonhangup set to %d\n",deleted,expungeonhangup);
if (vmu && deleted == 1 && expungeonhangup == 1) {
@@ -6859,7 +6863,7 @@
char *astsearch;
char *astsaycid;
char *send_voicemail;
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
char *imap_server;
char *imap_port;
char *imap_flags;
@@ -6963,7 +6967,7 @@
if ((extpc = ast_variable_retrieve(cfg, "general", "externpass"))) {
ast_copy_string(ext_pass_cmd,extpc,sizeof(ext_pass_cmd));
}
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
/* IMAP server address */
if ((imap_server = ast_variable_retrieve(cfg, "general", "imapserver"))) {
strncpy(imapserver,imap_server,sizeof(imapserver) - 1);
@@ -7460,7 +7464,7 @@
int option, signed char record_gain)
{
int res = 0;
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
char origtimeS[256],cidS[256],contextS[256];
char *header_content,*filename,*temp;
#else
@@ -7471,7 +7475,7 @@
int retries = 0;
vms->starting = 0;
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
/* START HERE */
/* get the message info!! */
ast_log (LOG_DEBUG,"Before mail_fetchheaders, curmsg is: %d, imap messages is %lu\n",vms->curmsg, vms->msgArray[vms->curmsg]);
@@ -7668,7 +7672,7 @@
break;
}
-#ifndef USE_IMAP_STORAGE
+#ifndef IMAP_STORAGE
ast_config_destroy(msg_cfg);
if (!res) {
@@ -7870,7 +7874,7 @@
return cmd;
}
-#ifdef USE_IMAP_STORAGE
+#ifdef IMAP_STORAGE
int init_mailstream (struct vm_state *vms)
{
More information about the svn-commits
mailing list