/******************************************************************************* * rfaxmark.cpp * Mark a user's RightFax faxes. * * Compile: * CL -I "-DVERS=\"R.L\"" rfaxmark.cpp rfaxprogram.obj \rfwin32.lib * where * 'R.L' is the program version number; * '' is the directory containing "rfapi.h" and "rfwin32.lib". * *------------------------------------------------------------------------------- * @version $Revision: 1.2 $ $Date: 2008/04/23 22:53:30 $ * @since 2008-04-21 * @author David R. Tribble (david@tribble.com) * * Copyright ©2008 by David R. Tribble, all rights reserved. * Permission is granted to any person or entity except those designated * by the United States Department of State as a terrorist, or terrorist * government or agency, to use and distribute this source code provided * that the original copyright notice remains present and unaltered. */ // Identification static char REV[] = "@(#)drt/rightfax/src/rfaxmark.cpp $Revision: 1.2 $ $Date: 2008/04/23 22:53:30 $"; static char PROG[] = "rfaxmark"; static char TITLE[] = "RFaxMark - Mark faxes on a RightFax server"; #ifndef VERS #error Please define macro "VERS" as a string in the format "R.L" #endif static char VERSION[] = VERS; static char VERSION_W[] = "@(#)" "Release: " VERS; static char BUILT[] = "@(#)" "Built: " __DATE__; // System includes #ifndef _WIN32 #error Compile this file for Win32 only #endif #include #include #include #include #include #include #include #define WIN32 #define WIN32_LEAN_AND_MEAN 1 #include #include // Local includes #define rfaxprogram_cpp #include "rfaxprogram.hpp" //------------------------------------------------------------------------------ // Local classes //------------------------------------------------------------------------------ /******************************************************************************* * class RFaxMarker * Mark a user's RightFax faxes. * * @since 1.1, 2008-04-21 */ #define RFaxMarker_VS 100 // Class version, 1.0 class RFaxMarker: public RFaxProgram { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Constants public: // Program exit status enum ExitCode { RC_OKAY = 0, // Success RC_CONNECT = 1, // Can't connect to server RC_INFO = 2, // Can't retrieve server info RC_USER = 3, // Bad user-ID RC_USAGE = 255, // Improper usage }; // Inclusion control bitflags enum InclFlags { INCL_NONE = 0x0000, // No faxes specified INCL_RECV = 0x0001, // Include only received faxes INCL_SENT = 0x0002, // Include only sent faxes INCL_ALL = 0x0003, // Include all faxes }; // Marking control bitflags enum MarkFlags { MARK_NONE = 0x0000, // No marks specified MARK_PRINTED = 0x0001, // Is printed MARK_NOT_PRINTED = 0x0002, // Not printed MARK_VIEWED = 0x0004, // Is viewed MARK_NOT_VIEWED = 0x0008, // Not viewed MARK_APPROVED = 0x0010, // Is approved MARK_NOT_APPROVED = 0x0020, // Not approved MARK_RELEASED = 0x0040, // Is released for preview MARK_NOT_RELEASED = 0x0080, // Not released for preview MARK_BODY_PRINTED = 0x0100, // Has body printed MARK_USER1 = 0x0400, // User-1 (generic-1) on MARK_NOT_USER1 = 0x0800, // User-1 (generic-1) off MARK_USER2 = 0x1000, // User-2 (generic-2) on MARK_NOT_USER2 = 0x2000, // User-2 (generic-2) off }; // Sorting control bitflags enum SortFlags { SORT_NONE = 0, // Do not sort SORT_ASC = 1, // Sort in ascending order SORT_DESC = 2, // Sort in descending order }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Static functions public: /*************************************************************************** * Mark a user's RightFax faxes. * * @usage * rfaxmark [-options...] uniqueID... * * @param argc * Argument count, i.e., the number of elements in 'argv[]'. * * @param argv * Command line arguments. * * @return * Exit status code, which is one of the 'RC_XXX' constants. * * @see run() * * @since 1.1, 2008-04-21 */ static int main(int argc, const char **argv); protected: /*************************************************************************** * Compare two fax list elements by date. * * @param e1 * A fax list element (of type FAXLISTELEMENT1). * * @param e2 * Another fax list element (of type FAXLISTELEMENT1). * * @return * A signed result x, where * x < 0 if e1 < e2 (by date), or * x = 0 if e1 = e2 (by date), or * x > 0 if e1 > e2 (by date). * The sense of the comparison is reversed if 's_sort' is 'SORT_DESC'. * * @since 1.1, 2008-04-22 */ static int cmpFaxElems(const void *e1, const void *e2); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Static variables protected: static enum SortFlags s_sort; // How to sort the fax list // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Functions protected: /*************************************************************************** * Destructor. * * @since 1.1, 2008-04-21 */ virtual ~RFaxMarker(); /*************************************************************************** * Default constructor. * * @since 1.1, 2008-04-21 */ RFaxMarker(); /*************************************************************************** * Mark a user's RightFax faxes. * This function is called by main(). * * @param argc * Argument count, i.e., the number of elements in 'argv[]'. * * @param argv * Command line arguments. * * @return * Exit status code, which is one of the 'RC_XXX' constants. * * @see main() * * @since 1.1, 2008-04-21 */ int run(int argc, const char **argv); /*************************************************************************** * Mark a user's RightFax faxes as printed/unprinted, viewed/unviewed, etc. * * @param inclFlags * Bitflags controlling the inclusion/exclusion of faxes, which is an or-ing * of zero or more 'INCL_XXX' constants. * * @param markFlags * Bitflags to set/unset, which is an or-ing of zero or more 'MARK_XXX' * constants. * * @param faxIDs * Fax-IDs to mark (which can contain '?' and '*' wildcard characters). * The last element in this array must be null. * * @since 1.1, 2008-04-21 */ void markFaxes(unsigned inclFlags, unsigned markFlags, const char *const *faxIDs); /*************************************************************************** * Mark a user's fax as printed/unprinted, viewed/unviewed, etc. * * @param fax * A fax list element. * * @param n * Fax sequence number (starting at 1). * * @param markFlags * Bitflags to set/unset, which is an or-ing of zero or more 'MARK_XXX' * constants. * * @return * True if the fax was successfully marked, otherwise false. * * @since 1.1, 2008-04-22 */ bool markFax(FAXLISTELEMENT1 *fax, int n, unsigned markFlags); private: // Not implemented RFaxMarker(const RFaxMarker &o); // Not implemented const RFaxMarker & operator =(const RFaxMarker &o); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Variables protected: FILE * m_out; // Output stream bool m_onlyMain; // Only mark faxes in folder "main" }; //------------------------------------------------------------------------------ // Static class variables //------------------------------------------------------------------------------ /*static*/ enum RFaxMarker::SortFlags RFaxMarker::s_sort = SORT_NONE; // How to sort the fax list //------------------------------------------------------------------------------ // Static class functions //------------------------------------------------------------------------------ /******************************************************************************* * RFaxMarker::main() * Mark a user's RightFax faxes. * * @param argc * Argument count, i.e., the number of elements in 'argv[]'. * * @param argv * Command line arguments. * * @see run() * * @since 1.1, 2008-04-21 */ /*static*/ int RFaxMarker::main(int argc, const char **argv) { #if RFaxMarker_VS/100 != 1 #error class RFaxMarker has changed #endif RFaxMarker * srv = NULL; int rc; // Display program version info ::printf("%s\n", TITLE); ::printf("Version %s [%s]\n", VERSION, BUILT+4); ::printf("\n"); ::printf("Mark a RightFax user's faxes as printed/unprinted, " "viewed/unviewed, etc.\n"); ::printf("\n"); ::fflush(stdout); // Establish a RightFax server connection srv = new RFaxMarker(); srv->m_out = stdout; rc = srv->run(argc, argv); // Clean up if (srv->m_hdl != NULL) srv->disconnect(); return rc; } /****************************************************************************** * RFaxMarker::cmpFaxElems() * Compare two fax list elements by date. * * @param e1 * A fax list element (of type FAXLISTELEMENT1). * * @param e2 * Another fax list element (of type FAXLISTELEMENT1). * * @return * A signed result x, where * x < 0 if e1 < e2 (by date), or * x = 0 if e1 = e2 (by date), or * x > 0 if e1 > e2 (by date). * * @since 1.1, 2008-04-22 */ /*static*/ int RFaxMarker::cmpFaxElems(const void *e1, const void *e2) { #if RFaxMarker_VS/100 != 1 #error class RFaxMarker has changed #endif const FAXLISTELEMENT1 * item1; const FAXLISTELEMENT1 * item2; int cmp = 0; // Compare the fax list elements item1 = (const FAXLISTELEMENT1 *) e1; item2 = (const FAXLISTELEMENT1 *) e2; if (item1->fax_datetime < item2->fax_datetime) cmp = -1; else if (item1->fax_datetime > item2->fax_datetime) cmp = +1; if (s_sort == SORT_DESC) cmp = -cmp; return cmp; } //------------------------------------------------------------------------------ // Class functions //------------------------------------------------------------------------------ /******************************************************************************* * RFaxMarker::run() * Mark a user's RightFax faxes. * This function is called by main(). * * @usage * rfaxmark [-option...] uniqueID... * * @options * -a Mark faxes in all folders, not just "main". * -s host RightFax server host name or IP address (required). * -R Mark only received faxes. * -S Mark only sent faxes. * -t Sort the faxes by date. * -tr Sort the faxes by date in reverse order. * -u user Owner user-ID/in-box for faxes to mark (required). * -ma Mark faxes as approved. * -na Mark faxes as not approved. * -mb Mark faxes as body printed. * -mp Mark faxes as printed. * -np Mark faxes as not printed. * -mr Mark faxes as released for preview. * -nr Mark faxes as held for preview. * -mv Mark faxes as viewed. * -nv Mark faxes as not viewed. * -m1 Mark faxes as user-1 tag on. * -n1 Mark faxes as user-1 tag off. * -m2 Mark faxes as user-2 tag on. * -n2 Mark faxes as user-2 tag off. * * Only one marking option can be specified. * * @param argc * Argument count, i.e., the number of elements in 'argv[]'. * * @param argv * Command line arguments. * * @see main() * * @since 1.1, 2008-04-21 */ int RFaxMarker::run(int argc, const char **argv) { #if RFaxMarker_VS/100 != 1 #error class RFaxMarker has changed #endif int rc = RC_OKAY; const char * node = NULL; const char * user = NULL; enum SortFlags sort = SORT_NONE; bool onlyMain = true; int nMarks = 0; unsigned inclFlags = INCL_NONE; unsigned markFlags = MARK_NONE; int i; // Parse options for (i = 1; i < argc and argv[i][0] == '-'; i++) { if (::stricmp(argv[i], "-?") == 0 or ::stricmp(argv[i], "/?") == 0 or ::stricmp(argv[i], "-help") == 0 or ::stricmp(argv[i], "/help") == 0) goto usage2; #if is_not_implemented_yet___ else if (::strcmp(argv[i], "-da") == 0 and i+1 < argc) afterDate = argv[++i]; else if (::strcmp(argv[i], "-db") == 0 and i+1 < argc) beforeDate = argv[++i]; #endif else if (::strcmp(argv[i], "-a") == 0) onlyMain = false; else if (::strcmp(argv[i], "-s") == 0 and i+1 < argc) node = argv[++i]; else if (::strcmp(argv[i], "-u") == 0 and i+1 < argc) user = argv[++i]; else if (::strcmp(argv[i], "-R") == 0) inclFlags |= INCL_RECV; else if (::strcmp(argv[i], "-S") == 0) inclFlags |= INCL_SENT; else if (::strcmp(argv[i], "-t") == 0) sort = SORT_ASC; else if (::strcmp(argv[i], "-tr") == 0) sort = SORT_DESC; else if (::strcmp(argv[i], "-m1") == 0 and not (markFlags & MARK_NOT_USER1)) markFlags |= MARK_USER1; else if (::strcmp(argv[i], "-n1") == 0 and not (markFlags & MARK_USER1)) markFlags |= MARK_NOT_USER1; else if (::strcmp(argv[i], "-m2") == 0 and not (markFlags & MARK_NOT_USER2)) markFlags |= MARK_USER2; else if (::strcmp(argv[i], "-n2") == 0 and not (markFlags & MARK_USER2)) markFlags |= MARK_NOT_USER2; else if (::strcmp(argv[i], "-ma") == 0 and not (markFlags & MARK_NOT_APPROVED)) markFlags |= MARK_APPROVED; else if (::strcmp(argv[i], "-na") == 0 and not (markFlags & MARK_APPROVED)) markFlags |= MARK_NOT_APPROVED; else if (::strcmp(argv[i], "-mb") == 0 and not (markFlags & MARK_NOT_PRINTED)) markFlags |= MARK_BODY_PRINTED; else if (::strcmp(argv[i], "-mp") == 0 and not (markFlags & MARK_NOT_PRINTED)) markFlags |= MARK_PRINTED; else if (::strcmp(argv[i], "-np") == 0 and not (markFlags & (MARK_PRINTED|MARK_BODY_PRINTED))) markFlags |= MARK_NOT_PRINTED; else if (::strcmp(argv[i], "-mr") == 0 and not (markFlags & MARK_NOT_RELEASED)) markFlags |= MARK_RELEASED; else if (::strcmp(argv[i], "-nr") == 0 and not (markFlags & MARK_RELEASED)) markFlags |= MARK_NOT_RELEASED; else if (::strcmp(argv[i], "-mv") == 0 and not (markFlags & MARK_NOT_VIEWED)) markFlags |= MARK_VIEWED; else if (::strcmp(argv[i], "-nv") == 0 and not (markFlags & MARK_VIEWED)) markFlags |= MARK_NOT_VIEWED; else goto usage2; } // Check command options if (inclFlags == INCL_NONE) inclFlags = INCL_ALL; if (node == NULL) { //::printf("Missing '-s' server option.\n"); goto usage; } if (user == NULL) { ::printf("Missing '-u' user-ID option.\n"); goto usage; } if (markFlags == MARK_NONE) { ::printf("No '-m' or '-n' marking options specified.\n"); goto usage; } if (i >= argc) { ::printf("No fax-IDs specified.\n"); goto usage; } // Establish a connection to the RightFax server ::printf("Server: %s\n", node); ::fflush(m_out); if (not connect(node)) return RC_CONNECT; ::printf("\n"); ::fflush(m_out); // Retrieve information about the RightFax server if (getServerInfo()) { ::printf("RightFax server: %s, %s\n", m_serverIP, m_server); ::printf("\n"); } else { ::printf("Can't retrieve server info: %s\n", node); ::fflush(stdout); rc = RC_INFO; goto done; } // Retrieve info about the specified user from the fax server ::fprintf(m_out, "Retrieving user info...\n"); ::fflush(m_out); if (getUserInfo(user)) { ::printf("User: %s\\%s \"%s\"\n\n", m_group, m_user, m_uname); } else { ::printf("Invalid user: \"%s\"\n", user); rc = RC_USER; goto done; } // Find and mark some faxes s_sort = sort; m_onlyMain = onlyMain; markFaxes(inclFlags, markFlags, argv+i); ::printf("\n"); ::fflush(m_out); done: // Disconnect from server if (m_hdl != NULL) disconnect(); // Done ::fflush(m_out); return rc; usage: // Display a program usage help message ::printf("\n"); usage2: ::printf("usage: %s [-option...] fax-ID...\n", PROG); ::printf("\n"); ::printf("Options:\n"); #if is_not_implemented_yet___ ::printf(" -da date Mark faxes after a specified date.\n"); ::printf(" -db date Mark faxes before a specified date.\n"); #endif ::printf(" -a Mark faxes in all folders, not just \"main\".\n"); ::printf(" -s host RightFax server host name or IP address " "(required).\n"); ::printf(" -R Mark only received faxes.\n"); ::printf(" -S Mark only sent faxes.\n"); ::printf(" -t Sort the faxes by date.\n"); ::printf(" -tr Sort the faxes by date in reverse order.\n"); ::printf(" -u user Owner user-ID/in-box for faxes to mark " "(required).\n"); ::printf(" -ma Mark faxes as approved.\n"); ::printf(" -na Mark faxes as not approved.\n"); ::printf(" -mb Mark faxes as body printed.\n"); ::printf(" -mp Mark faxes as printed.\n"); ::printf(" -np Mark faxes as not printed.\n"); ::printf(" -mr Mark faxes as released for preview.\n"); ::printf(" -nr Mark faxes as held for preview.\n"); ::printf(" -mv Mark faxes as viewed.\n"); ::printf(" -nv Mark faxes as not viewed.\n"); ::printf(" -m1 Mark faxes as user-1 tag on.\n"); ::printf(" -n1 Mark faxes as user-1 tag off.\n"); ::printf(" -m2 Mark faxes as user-2 tag on.\n"); ::printf(" -n2 Mark faxes as user-2 tag off.\n"); ::printf("\n"); ::printf("Faxes are specified by either their unique-ID (e.g., " "APP0438B2C87FE62B9) or\n"); ::printf("filename (e.g., B000409E2). Fax-IDs can contain wildcard " "('?' and '*')\n"); ::printf("characters. Conflicting marking options cannot be specified.\n"); ::printf("\n"); ::fflush(m_out); return RC_USAGE; } /******************************************************************************* * RFaxMarker::~RFaxMarker() * Destructor. * * @since 1.1, 2008-04-21 */ RFaxMarker::~RFaxMarker() { #if RFaxMarker_VS != 100 #error class RFaxMarker has changed #endif // Deallocate } /******************************************************************************* * RFaxMarker::RFaxMarker() * Default constructor. * * @since 1.1, 2008-04-21 */ RFaxMarker::RFaxMarker(): RFaxProgram() { #if RFaxMarker_VS != 100 #error class RFaxMarker has changed #endif // Initialize } /******************************************************************************* * RFaxMarker::markFaxes() * Mark a user's RightFax faxes as printed/unprinted, viewed/unviewed, * etc. * * @param inclFlags * Bitflags controlling the inclusion/exclusion of faxes, which is an or-ing * of zero or more 'INCL_XXX' constants. * * @param markFlags * Bitflags to set/unset, which is an or-ing of zero or more MARK_XXX * constants. * * @param faxIDs * Fax-IDs to mark (which can contain '?' and '*' wildcard characters). * The last element in this array must be null. * * @since 1.1, 2008-04-21 */ void RFaxMarker::markFaxes(unsigned inclFlags, unsigned markFlags, const char *const *faxIDs) { #if RFaxMarker_VS/100 != 1 #error class RFaxMarker has changed #endif RFAXLISTHANDLE svrHdl; RFAXLISTHANDLE listHdl; FAXLISTELEMENT1 * item; int fold; int nFaxes = 0; int nTouched = 0; int nSkipped = 0; int nRecv = 0; int nSent = 0; int nPages = 0; int nViewed = 0; int nErrs = 0; int rc; // Get the list of faxes owned by the user ::fprintf(m_out, "Retrieving fax list...\n"); ::fflush(m_out); svrHdl = (RFAXSERVERHANDLE) m_hdl; fold = (m_onlyMain ? FAXFOLDER_MAIN : FAXFOLDER_ALLBUTTRASH); rc = ::RFaxGetFaxList(svrHdl, m_user, 1, fold, FAXFILTER_NONE, &listHdl); if (rc != RFAX_SUCCESS) { ::fprintf(m_out, "Can't retrieve fax list for user: %s\n", m_user); ::fflush(m_out); return; } // Sort the list by date order if (s_sort != SORT_NONE) { ::fprintf(m_out, "Sorting fax list by date...\n"); ::fflush(m_out); rc = ::RFaxListSort(listHdl, &cmpFaxElems); if (rc != RFAX_SUCCESS) { ::fprintf(m_out, "Can't sort the fax list for user: %s\n", m_user); ::fflush(m_out); } } // Find and mark the faxes in the list rc = ::RFaxListGetFirstElementPtr(listHdl, (RFAXPVOID *) &item); faxLoop: while (rc == RFAX_SUCCESS) { const char * faxID; unsigned long flg; int i; // Determine if the fax was specified by the user faxID = NULL; flg = item->flags; for (i = 0; faxIDs[i] != NULL; i++) { // Compare the fax's unique-ID faxID = item->unique_id; if (matchesPattern(faxID, faxIDs[i])) break; faxID = NULL; } if ((flg & FAXFLAG_RECEIVED) and not (inclFlags & INCL_RECV)) faxID = NULL; if (not (flg & FAXFLAG_RECEIVED) and not (inclFlags & INCL_SENT)) faxID = NULL; // Display the matching fax if (faxID != NULL) { // Get info for the fax nFaxes++; if (nFaxes == 1) ::fprintf(m_out, "\n"); nPages += item->numpages; nErrs += (item->fax_error_code == 0 ? 0 : 1); nRecv += (flg & FAXFLAG_RECEIVED ? 1 : 0); nSent += (flg & FAXFLAG_RECEIVED ? 0 : 1); nViewed += (flg & FAXFLAG_VIEWED ? 1 : 0); // Mark the fax ::fprintf(m_out, "%d/%d %s\n", nTouched+1, nFaxes, faxID); if (markFax(item, nFaxes, markFlags)) nTouched++; #if is_incomplete___ // Remove the fax from the list rc = ::RFaxListDeleteElement(listHdl, n?); ...; #endif } else { // Skip this fax ///::printf("$ skip '%s'\n", item->unique_id); nSkipped++; } nextLoop: // Get the next fax in the list (for the next iteration) rc = ::RFaxListGetNextElementPtr(listHdl, (RFAXPVOID *) &item); } // Done ::fprintf(m_out, "\n"); ::fprintf(m_out, "faxes:%d marked:%d failed:%d skipped:%d total:%d\n", nFaxes, nTouched, nFaxes-nTouched, nSkipped, nFaxes+nSkipped); if (inclFlags & INCL_RECV) ::fprintf(m_out, "recv:%d", nRecv); else ::fprintf(m_out, "recv:-"); if (inclFlags & INCL_SENT) ::fprintf(m_out, " sent:%d", nSent); else ::fprintf(m_out, " sent:-"); ::fprintf(m_out, " viewed:%d pages:%d errs:%d\n", nViewed, nPages, nErrs); ::fflush(m_out); done: // Clean up ::RFaxCloseListHandle(listHdl); } /******************************************************************************* * RFaxMarker::markFax() * Mark a user's fax as printed/unprinted, viewed/unviewed, etc. * * @param fax * A fax list element. * * @param n * Fax sequence number (starting at 1). * * @param markFlags * Bitflags to set/unset, which is an or-ing of zero or more 'MARK_XXX' * constants. * * @return * True if the fax was successfully marked, otherwise false. * * @since 1.1, 2008-04-22 */ bool RFaxMarker::markFax(FAXLISTELEMENT1 *fax, int n, unsigned markFlags) { #if RFaxMarker_VS/100 != 1 #error class RFaxMarker has changed #endif RFAXLISTHANDLE svrHdl; FAXHANDLE faxHdl; const char * faxID; int rc; FAXINFO_11 meta; // Retrieve the fax to be marked faxID = fax->unique_id; ::memset(&meta, 0, sizeof(meta)); svrHdl = (RFAXSERVERHANDLE) m_hdl; faxHdl = fax->handle; rc = ::RFaxLoadFax3(svrHdl, faxHdl, NULL, LOADFAX_NOCOVER|LOADFAX_NOBODY, NULL, &meta, 11); if (rc != RFAX_SUCCESS) { ::fprintf(m_out, "Can't retrieve fax: %s (%08p)\n", faxID, faxHdl); ::fflush(m_out); return false; } // Mark the fax while (markFlags != 0x0000) { int flags = -1; int err; // Get the next appropriate fax flag setting to mark if (markFlags & MARK_PRINTED) { flags = MARKFAX_PRINTED; markFlags &= ~MARK_PRINTED; } else if (markFlags & MARK_NOT_PRINTED) { flags = MARKFAX_NOTPRINTED; markFlags &= ~MARK_NOT_PRINTED; } else if (markFlags & MARK_VIEWED) { flags = MARKFAX_VIEWED; markFlags &= ~MARK_VIEWED; } else if (markFlags & MARK_NOT_VIEWED) { flags = MARKFAX_UNVIEWED; markFlags &= ~MARK_NOT_VIEWED; } else if (markFlags & MARK_APPROVED) { flags = MARKFAX_APPROVED; markFlags &= ~MARK_APPROVED; } else if (markFlags & MARK_NOT_APPROVED) { flags = MARKFAX_DISAPPROVED; markFlags &= ~MARK_NOT_APPROVED; } else if (markFlags & MARK_BODY_PRINTED) { flags = MARKFAX_BODYPRINTED; markFlags &= ~MARK_BODY_PRINTED; } else if (markFlags & MARK_RELEASED) { flags = MARKFAX_RELEASED; markFlags &= ~MARK_RELEASED; } else if (markFlags & MARK_NOT_RELEASED) { flags = MARKFAX_HELD; markFlags &= ~MARK_NOT_RELEASED; } else if (markFlags & MARK_USER1) { flags = MARKFAX_GENERIC1; markFlags &= ~MARK_USER1; } else if (markFlags & MARK_NOT_USER1) { flags = MARKFAX_NOTGENERIC1; markFlags &= ~MARK_NOT_USER1; } else if (markFlags & MARK_USER2) { flags = MARKFAX_GENERIC2; markFlags &= ~MARK_USER2; } else if (markFlags & MARK_NOT_USER2) { flags = MARKFAX_NOTGENERIC2; markFlags &= ~MARK_NOT_USER2; } if (flags == -1) break; ///::printf("$ flags=%d (%04X)\n", flags, markFlags); // Mark the fax err = ::RFaxMarkFax(svrHdl, faxHdl, flags); if (err != RFAX_SUCCESS) { ::fprintf(m_out, "Can't mark fax: %s (%08p)\n", faxID, faxHdl); ::fflush(m_out); rc = err; } } // Done ::fprintf(m_out, " -> marked\n"); ::fflush(m_out); return (rc == RFAX_SUCCESS); } //------------------------------------------------------------------------------ // Public (non-class) functions //------------------------------------------------------------------------------ /******************************************************************************* * ::main() * Mark a user's RightFax faxes as printed/unprinted, viewed/unviewed, etc. * * @param argc * Argument count, i.e., the number of elements in 'argv[]'. * * @param argv * Command line arguments. * * @see RFaxMarker::main() * * @since 1.1, 2008-04-21 */ int main(int argc, char **argv) { // Execute this program return RFaxMarker::main(argc, (const char **)argv); } // End rfaxmark.cpp