[svn-commits] mmichelson: branch mmichelson/imap_consistency_trunk r134252 - /team/mmichels...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Jul 29 15:56:10 CDT 2008
Author: mmichelson
Date: Tue Jul 29 15:56:09 2008
New Revision: 134252
URL: http://svn.digium.com/view/asterisk?view=rev&rev=134252
Log:
More conflict resolution
Modified:
team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c
Modified: team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c?view=diff&rev=134252&r1=134251&r2=134252
==============================================================================
--- team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c (original)
+++ team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c Tue Jul 29 15:56:09 2008
@@ -450,11 +450,7 @@
#ifdef ODBC_STORAGE
static char odbc_database[80];
static char odbc_table[80];
-<<<<<<< .working
-#define RETRIEVE(a,b,c,d) retrieve_file(a,b)
-=======
#define RETRIEVE(a,b,c) retrieve_file(a,b)
->>>>>>> .merge-right.r134223
#define DISPOSE(a,b) remove_file(a,b)
#define STORE(a,b,c,d,e,f,g,h,i,j,k) store_file(a,b,c,d)
#define EXISTS(a,b,c,d) (message_exists(a,b))
@@ -464,24 +460,18 @@
#else
#ifdef IMAP_STORAGE
<<<<<<< .working
-#define RETRIEVE(a,b,c,d) (imap_retrieve_file(a,b,c,d ))
#define DISPOSE(a,b) (imap_remove_file(a,b))
#define STORE(a,b,c,d,e,f,g,h,i,j,k) (imap_store_file(a,b,c,d,e,f,g,h,i,j,k))
=======
#define RETRIEVE(a,b,c) imap_retrieve_file(a,b,c)
#define DISPOSE(a,b) remove_file(a,b)
-#define STORE(a,b,c,d,e,f,g,h,i) (imap_store_file(a,b,c,d,e,f,g,h,i))
>>>>>>> .merge-right.r134223
#define EXISTS(a,b,c,d) (ast_fileexists(c,NULL,d) > 0)
#define RENAME(a,b,c,d,e,f,g,h) (rename_file(g,h));
#define COPY(a,b,c,d,e,f,g,h) (copy_file(g,h));
#define DELETE(a,b,c,d) (vm_imap_delete(b,d))
#else
-<<<<<<< .working
-#define RETRIEVE(a,b,c,d)
-=======
#define RETRIEVE(a,b,c)
->>>>>>> .merge-right.r134223
#define DISPOSE(a,b)
#define STORE(a,b,c,d,e,f,g,h,i,j,k)
#define EXISTS(a,b,c,d) (ast_fileexists(c,NULL,d) > 0)
@@ -2832,40 +2822,6 @@
return x - 1;
}
-<<<<<<< .working
-/*!
- * \brief Removes a voicemail message file.
- * \param dir the path to the message file.
- * \param msgnum the unique number for the message within the mailbox.
- *
- * Removes the message content file and the information file.
- * This method is used by the DISPOSE macro when mailboxes are stored in an ODBC back end.
- * Typical use is to clean up after a RETRIEVE operation.
- * Note that this does not remove the message from the mailbox folders, to do that we would use delete_file().
- * \return zero on success, -1 on error.
- */
-static int remove_file(char *dir, int msgnum)
-{
- char fn[PATH_MAX];
- char full_fn[PATH_MAX];
- char msgnums[80];
-
- if (msgnum > -1) {
- snprintf(msgnums, sizeof(msgnums), "%d", msgnum);
- make_file(fn, sizeof(fn), dir, msgnum);
- } else
- ast_copy_string(fn, dir, sizeof(fn));
- ast_filedelete(fn, NULL);
- if (ast_check_realtime("voicemail_data")) {
- ast_destroy_realtime("voicemail_data", "filename", fn, SENTINEL);
- }
- snprintf(full_fn, sizeof(full_fn), "%s.txt", fn);
- unlink(full_fn);
- return 0;
-}
-
-=======
->>>>>>> .merge-right.r134223
/*!
* \brief Determines the highest message number in use for a given user and mailbox folder.
* \param vmu
@@ -3368,6 +3324,17 @@
return x - 1;
}
#if (defined(IMAP_STORAGE) || defined(ODBC_STORAGE))
+/*!
+ * \brief Removes a voicemail message file.
+ * \param dir the path to the message file.
+ * \param msgnum the unique number for the message within the mailbox.
+ *
+ * Removes the message content file and the information file.
+ * This method is used by the DISPOSE macro when mailboxes are stored in an ODBC back end.
+ * Typical use is to clean up after a RETRIEVE operation.
+ * Note that this does not remove the message from the mailbox folders, to do that we would use delete_file().
+ * \return zero on success, -1 on error.
+ */
static int remove_file(char *dir, int msgnum)
{
char fn[PATH_MAX];
@@ -4697,13 +4664,7 @@
ast_log(AST_LOG_WARNING, "Failed to make directory (%s)\n", tempfile);
return -1;
}
-<<<<<<< .working
-
- RETRIEVE(tempfile, -1, ext, context);
-
-=======
RETRIEVE(tempfile, -1, vmu);
->>>>>>> .merge-right.r134223
if (ast_fileexists(tempfile, NULL, NULL) > 0)
ast_copy_string(prefile, tempfile, sizeof(prefile));
@@ -4951,12 +4912,6 @@
} else
ast_log(AST_LOG_WARNING, "Error opening text file for output\n");
res = play_record_review(chan, NULL, tmptxtfile, vmu->maxsecs, fmt, 1, vmu, &duration, NULL, options->record_gain, vms, flag);
-<<<<<<< .working
-#else
- res = play_record_review(chan, NULL, tmptxtfile, vmu->maxsecs, fmt, 1, vmu, &duration, NULL, options->record_gain, NULL, flag);
-#endif
-=======
->>>>>>> .merge-right.r134223
if (txt) {
fprintf(txt, "flag=%s\n", flag);
@@ -5926,11 +5881,7 @@
attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
if (attach_user_voicemail)
-<<<<<<< .working
- RETRIEVE(todir, msgnum, vmu->mailbox, vmu->context);
-=======
RETRIEVE(todir, msgnum, vmu);
->>>>>>> .merge-right.r134223
/* XXX possible imap issue, should category be NULL XXX */
sendmail(myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, fn, NULL, fmt, duration, attach_user_voicemail, chan, category, flag);
@@ -5945,7 +5896,6 @@
if (ast_test_flag(vmu, VM_DELETE))
DELETE(todir, msgnum, fn, vmu);
-<<<<<<< .working
/* Leave voicemail for someone */
if (ast_app_has_voicemail(ext_context, NULL))
ast_app_inboxcount2(ext_context, &urgentmsgs, &newmsgs, &oldmsgs);
@@ -5955,15 +5905,6 @@
manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s@%s\r\nWaiting: %d\r\nNew: %d\r\nOld: %d\r\n", vmu->mailbox, vmu->context, ast_app_has_voicemail(ext_context, NULL), newmsgs, oldmsgs);
run_externnotify(vmu->context, vmu->mailbox, flag);
-#ifdef IMAP_STORAGE
- DELETE(todir, msgnum, fn); /* Delete the file, but not the IMAP message */
- if (ast_test_flag(vmu, VM_DELETE)) { /* Delete the IMAP message if delete = yes */
- IMAP_DELETE(vms->curdir, vms->curmsg, vms->fn, vms);
- vms->newmessages--; /* Fix new message count */
- }
-#endif
-=======
->>>>>>> .merge-right.r134223
return 0;
}
@@ -6183,11 +6124,7 @@
create_dirpath(vmstmp.curdir, sizeof(vmstmp.curdir), sender->context, vmstmp.username, "tmp");
make_file(msgfile, sizeof(msgfile), vmstmp.curdir, curmsg);
-<<<<<<< .working
- RETRIEVE(dir, curmsg, sender->mailbox, context);
-=======
RETRIEVE(dir, curmsg, sender);
->>>>>>> .merge-right.r134223
make_file(origmsgfile, sizeof(origmsgfile), dir, curmsg);
create_dirpath(vmstmp.curdir, sizeof(vmstmp.curdir), sender->context, vmstmp.username, "tmp");
@@ -6783,16 +6720,9 @@
}
}
-<<<<<<< .working
- RETRIEVE(vms->curdir, vms->curmsg, vmu->mailbox, vmu->context);
+ /* Retrieve info from VM attribute file */
+ RETRIEVE(vms->curdir, vms->curmsg, vmu);
msg_cfg = ast_config_load(filename, config_flags);
-=======
- /* Retrieve info from VM attribute file */
- make_file(vms->fn2, sizeof(vms->fn2), vms->curdir, vms->curmsg);
- snprintf(filename, sizeof(filename), "%s.txt", vms->fn2);
- RETRIEVE(vms->curdir, vms->curmsg, vmu);
- msg_cfg = ast_config_load(filename);
->>>>>>> .merge-right.r134223
if (!msg_cfg) {
ast_log(AST_LOG_WARNING, "No message attribute file?!! (%s)\n", filename);
return 0;
@@ -6837,164 +6767,7 @@
return res;
}
-<<<<<<< .working
#ifdef IMAP_STORAGE
-static void imap_mailbox_name(char *spec, size_t len, struct vm_state *vms, int box, int use_folder)
-{
- char tmp[256], *t = tmp;
- size_t left = sizeof(tmp);
-
- if (box == OLD_FOLDER) {
- ast_copy_string(vms->curbox, mbox(NEW_FOLDER), sizeof(vms->curbox));
- } else {
- ast_copy_string(vms->curbox, mbox(box), sizeof(vms->curbox));
- }
-
- if (box == NEW_FOLDER) {
- ast_copy_string(vms->vmbox, "vm-INBOX", sizeof(vms->vmbox));
- } else {
- snprintf(vms->vmbox, sizeof(vms->vmbox), "vm-%s", mbox(box));
- }
-
- /* Build up server information */
- ast_build_string(&t, &left, "{%s:%s/imap", imapserver, imapport);
-
- /* Add authentication user if present */
- if (!ast_strlen_zero(authuser))
- ast_build_string(&t, &left, "/authuser=%s", authuser);
-
- /* Add flags if present */
- if (!ast_strlen_zero(imapflags))
- ast_build_string(&t, &left, "/%s", imapflags);
-
- /* End with username */
- ast_build_string(&t, &left, "/user=%s}", vms->imapuser);
-
- if (box == NEW_FOLDER || box == OLD_FOLDER)
- snprintf(spec, len, "%s%s", tmp, use_folder? imapfolder: "INBOX");
- else if (box == GREETINGS_FOLDER)
- snprintf(spec, len, "%s%s", tmp, greetingfolder);
- else
- snprintf(spec, len, "%s%s%c%s", tmp, imapfolder, delimiter, mbox(box));
-}
-
-static int init_mailstream(struct vm_state *vms, int box)
-{
- MAILSTREAM *stream = NIL;
- long debug;
- char tmp[256];
-
- if (!vms) {
- ast_log(AST_LOG_ERROR, "vm_state is NULL!\n");
- return -1;
- }
- ast_debug(3,"vm_state user is:%s\n",vms->imapuser);
- if (vms->mailstream == NIL || !vms->mailstream) {
- ast_debug(1,"mailstream not set.\n");
- } else {
- stream = vms->mailstream;
- }
- /* debug = T; user wants protocol telemetry? */
- debug = NIL; /* NO protocol telemetry? */
-
- if (delimiter == '\0') { /* did not probe the server yet */
- char *cp;
-#ifdef USE_SYSTEM_IMAP
-#include <imap/linkage.c>
-#elif defined(USE_SYSTEM_CCLIENT)
-#include <c-client/linkage.c>
-#else
-#include "linkage.c"
-#endif
- /* Connect to mailbox to get mailstream so we can get delimiter */
- imap_mailbox_name(tmp, sizeof(tmp), vms, 0, 1);
- ast_mutex_lock(&vms->lock);
- stream = mail_open (stream, tmp, debug ? OP_DEBUG : NIL);
- ast_mutex_unlock(&vms->lock);
- if (stream == NIL) {
- ast_log(AST_LOG_ERROR, "Can't connect to imap server %s\n", tmp);
- return -1;
- }
- get_mailbox_delimiter(stream);
- /* update delimiter in imapfolder */
- for (cp = imapfolder; *cp; cp++) {
- if (*cp == '/')
- *cp = delimiter;
- }
- }
- /* Now connect to the target folder */
- imap_mailbox_name(tmp, sizeof(tmp), vms, box, 1);
- ast_debug(3,"Before mail_open, server: %s, box:%d\n", tmp, box);
- ast_mutex_lock(&vms->lock);
- vms->mailstream = mail_open (stream, tmp, debug ? OP_DEBUG : NIL);
- ast_mutex_unlock(&vms->lock);
- if (vms->mailstream == NIL) {
- return -1;
- } else {
- return 0;
- }
-}
-
-static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box)
-{
- SEARCHPGM *pgm;
- SEARCHHEADER *hdr;
- int ret, urgent = 0;
-
- /* If Urgent, then look at INBOX */
- if (box == 11) {
- box = NEW_FOLDER;
- urgent = 1;
- }
-
- ast_copy_string(vms->imapuser,vmu->imapuser, sizeof(vms->imapuser));
- ast_debug(3,"Before init_mailstream, user is %s\n",vmu->imapuser);
-
- if ((ret = init_mailstream(vms, box)) || !vms->mailstream) {
- ast_log(AST_LOG_ERROR, "Could not initialize mailstream\n");
- return -1;
- }
-
- /* Check Quota */
- if (box == 0) {
- ast_debug(3, "Mailbox name set to: %s, about to check quotas\n", mbox(box));
- check_quota(vms,(char *)mbox(box));
- }
-
- pgm = mail_newsearchpgm();
-
- /* Check IMAP folder for Asterisk messages only... */
- hdr = mail_newsearchheader("X-Asterisk-VM-Extension", vmu->mailbox);
- pgm->header = hdr;
- pgm->deleted = 0;
- pgm->undeleted = 1;
-
- /* if box = NEW_FOLDER, check for new, if box = OLD_FOLDER, check for read */
- if (box == NEW_FOLDER && urgent == 1) {
- pgm->unseen = 1;
- pgm->seen = 0;
- pgm->flagged = 1;
- pgm->unflagged = 0;
- } else if (box == NEW_FOLDER && urgent == 0) {
- pgm->unseen = 1;
- pgm->seen = 0;
- pgm->flagged = 0;
- pgm->unflagged = 1;
- } else if (box == OLD_FOLDER) {
- pgm->seen = 1;
- pgm->unseen = 0;
- }
-
- ast_debug(3,"Before mail_search_full, user is %s\n",vmu->imapuser);
-
- vms->vmArrayIndex = 0;
- mail_search_full (vms->mailstream, NULL, pgm, NIL);
- vms->lastmsg = vms->vmArrayIndex - 1;
- mail_free_searchpgm(&pgm);
-
- return 0;
-}
-
static int imap_remove_file(char *dir, int msgnum)
{
char fn[PATH_MAX];
@@ -7126,9 +6899,7 @@
}
#else
-=======
#ifndef IMAP_STORAGE
->>>>>>> .merge-right.r134223
static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box)
{
int count_msg, last_msg;
@@ -8470,12 +8241,6 @@
if (ast_test_flag(vmu, VM_FORCENAME)) {
snprintf(prefile,sizeof(prefile), "%s%s/%s/greet", VM_SPOOL_DIR, vmu->context, vms->username);
if (ast_fileexists(prefile, NULL, NULL) < 1) {
-<<<<<<< .working
-#ifndef IMAP_STORAGE
- cmd = play_record_review(chan, "vm-rec-name", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL, NULL);
-#else
-=======
->>>>>>> .merge-right.r134223
cmd = play_record_review(chan, "vm-rec-name", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms, NULL);
if (cmd < 0 || cmd == 't' || cmd == '#')
return cmd;
@@ -8486,12 +8251,6 @@
if (ast_test_flag(vmu, VM_FORCEGREET)) {
snprintf(prefile,sizeof(prefile), "%s%s/%s/unavail", VM_SPOOL_DIR, vmu->context, vms->username);
if (ast_fileexists(prefile, NULL, NULL) < 1) {
-<<<<<<< .working
-#ifndef IMAP_STORAGE
- cmd = play_record_review(chan, "vm-rec-unv", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL, NULL);
-#else
-=======
->>>>>>> .merge-right.r134223
cmd = play_record_review(chan, "vm-rec-unv", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms, NULL);
if (cmd < 0 || cmd == 't' || cmd == '#')
return cmd;
@@ -8499,12 +8258,6 @@
snprintf(prefile,sizeof(prefile), "%s%s/%s/busy", VM_SPOOL_DIR, vmu->context, vms->username);
if (ast_fileexists(prefile, NULL, NULL) < 1) {
-<<<<<<< .working
-#ifndef IMAP_STORAGE
- cmd = play_record_review(chan, "vm-rec-busy", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL, NULL);
-#else
-=======
->>>>>>> .merge-right.r134223
cmd = play_record_review(chan, "vm-rec-busy", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms, NULL);
if (cmd < 0 || cmd == 't' || cmd == '#')
return cmd;
@@ -8665,11 +8418,7 @@
while ((cmd >= 0) && (cmd != 't')) {
if (cmd)
retries = 0;
-<<<<<<< .working
- RETRIEVE(prefile, -1, vmu->mailbox, vmu->context);
-=======
RETRIEVE(prefile, -1, vmu);
->>>>>>> .merge-right.r134223
if (ast_fileexists(prefile, NULL, NULL) <= 0) {
play_record_review(chan, "vm-rec-temp", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms, NULL);
cmd = 't';
@@ -11254,13 +11003,9 @@
make_file(vms->fn, sizeof(vms->fn), vms->curdir, msg);
/* Retrieve info from VM attribute file */
-<<<<<<< .working
snprintf(filename,sizeof(filename), "%s.txt", vms->fn);
- RETRIEVE(vms->curdir, vms->curmsg, vmu->mailbox, vmu->context);
+ RETRIEVE(vms->curdir, vms->curmsg, vmu);
msg_cfg = ast_config_load(filename, config_flags);
-=======
- RETRIEVE(vms->curdir, vms->curmsg, vmu);
->>>>>>> .merge-right.r134223
DISPOSE(vms->curdir, vms->curmsg);
if (!msg_cfg) {
ast_log(AST_LOG_WARNING, "No message attribute file?!! (%s)\n", filename);
More information about the svn-commits
mailing list