📄 installer.c
字号:
if (pnid_form)
*pnid_form = nid;
errJump:
NSFNoteClose( h);
return us_err;
} //us_PgpEnableEmailForm(
/** us_RefreshMailDbs( ***
PGP refreshes/enables the specified Notes Mail databases with the latest
design already deposited in the PGP Plugin Template.
--- parameters & return ----
pc_SERVERNM: pointer to the name of the server on which all the Notes Mail
databases reside
pc_EXTFILENM_DB_LIST: Optional. Pointer to the extended filename of the text
file holding the list of extended filenames of the particular Notes Mail
databases to be refreshed/enabled. Each filename must be delimited by a
pipe character or linefeed character; whitespace surrounding each
filename is ignored. A pass of NULL or pointer to a null string indicates
that no text file is involved.
pc_MailDbs: Optional Input & Undefined Output. Pointer to a string indicating
the extended filenames of the particular Notes Mail databases to be
refreshed/enabled. Each filename must be delimited by a pipe character or
linefeed character; whitespace surrounding each filename is ignored.
String may be tokenized and therefore changed in a way not worth
defining here (see documentation on standard strtok() function if
understanding is required). A pass of NULL or pointer to a null string
indicates that no _explicit_ list of database filenames is involved.
pt_ENV: pointer to the information structure describing the installation
environment, information about the Notes Mail template in particular
ppc_mereErrLog: Input & Output. Pointer to the variable that points to a
running log of non-fatal errors being tracked by the codestream. If this
procedure determines a database to be invalid for refresh/enablement of
the PGP Plug-In, a description of the cause will be appended to the log.
RETURN:
eus_SUCCESS if no error occured
!eus_SUCCESS if obviously invalid parameters were passed in the procedure
call
ERR_MEMORY if an insufficient-memory condition was encountered
the Notes API error code otherwise
--- revision history -------
9/20/99 PR
+ adjustment to allow any text-file filename to be used to provide the list
of Notes Mail databases to be refreshed/enabled
+ completed standard documentation
2/6/99 PR: created */
static STATUS us_RefreshMailDbs( char pc_SERVERNM[],
const char pc_EXTFILENM_DB_LIST[],
char pc_MailDbs[],
EnvInfo *const pt_ENV,
char * *const ppc_mereErrLog) {
char * pc_db, * pc;
DBHANDLE h_db = NULL;
UINT ui;
STATUS us_err, us_error = eus_SUCCESS;
BOOL f_failure = FALSE;
_ASSERTE( pc_SERVERNM && (pc_EXTFILENM_DB_LIST || pc_MailDbs) &&
pt_ENV && pt_ENV->h_template &&
pt_ENV->pc_extFileNmTemplate &&
pt_ENV->pc_UserNm && ppc_mereErrLog);
*ppc_mereErrLog = NULL;
//if the PGP template does not have a design class specified, log the
// condition and short-circuit without refreshing any databases
if (!*pt_ENV->pc_DbClass) {
const char *const ppc_PART[] = {"To PGP Enable a mail database, "
"the PGP Plugin Template\ndatabase must "
"have a template design name.\n"
"Currently \'", "\'on server\n\'", "\' "
"does not have a template design name."};
if (!f_StartMereErrLog( ppc_mereErrLog))
return ERR_MEMORY;
if (!( pc = realloc( *ppc_mereErrLog, (ui = strlen(
*ppc_mereErrLog)) + strlen(
ppc_PART[0]) + strlen( ppc_PART[1]) +
strlen( ppc_PART[2]) + 1)))
return ERR_MEMORY;
sprintf( (*ppc_mereErrLog = pc) + ui, "\n%s%s%s%s%s", ppc_PART[0],
pt_ENV->pc_extFileNmTemplate,
ppc_PART[1], pc_SERVERNM, ppc_PART[2]);
return eus_SUCCESS;
} //if (!*pt_ENV->pc_DbClass)
//if the user specified the special text file of mail-database paths,
// retrieve that file's contents into the mail-database input string
if (pc_EXTFILENM_DB_LIST)
if (!f_LoadTextFileEntire( pc_EXTFILENM_DB_LIST, &pc_MailDbs))
return !eus_SUCCESS;
//strip any trailing whitespace from the mail-database input string
pc = pc_MailDbs + strlen( pc_MailDbs) - 1;
while (*pc == ' ' || *pc == '\t')
*(pc--) = NULL;
//if there are any mail databases to update...
if (pc_db = strtok( pc_MailDbs, mpc_DELIMITER))
//for each mail database to update...
do {
//determine the extended file name of the database
while (*pc_db == ' ' || *pc_db == '\t')
pc_db++;
if (!*pc_db)
continue;
pc = pc_db + strlen( pc_db) - 1;
while (*pc == ' ' || *pc == '\t')
*(pc--) = NULL;
if (!*pc_db)
continue;
if (us_err = us_OpenAndValidateMailDb( pc_db, pc_SERVERNM,
ppc_mereErrLog, &h_db))
goto errJump;
if (h_db) {
if (us_err = us_RefreshMailDb( h_db, pt_ENV))
goto errJump;
if (us_err = NSFDbClose( h_db))
goto errJump;
h_db = NULL;
}
} while (pc_db = strtok( NULL, mpc_DELIMITER));
errJump:
if (pc_EXTFILENM_DB_LIST)
free( pc_MailDbs);
if (h_db)
if ((us_error = NSFDbClose( h_db)) && !( us_err || f_failure))
us_err = us_error;
return us_err + f_failure;
} //us_RefreshMailDbs(
/** us_OpenAndValidateMailDb( ***
Attempts to open the named database and validates that the user has a minimum
of designer access to the database. If the open fails for anticipated
reasons, or the validation fails, the problem is noted and success is
returned.
--- parameters & return ----
pc_FILENM: pointer to the extended filename of the Notes database to be
opened
pc_SERVERNM: pointer to the name of the Domino server on which the database
to be opened resides
ppc_mereErrLog: Input & Output. Pointer to the variable that points to a
running log of non-fatal errors being tracked by the codestream. If this
procedure determines the specified database to be invalid, a description
of the cause will be appended to the log.
ph: Pointer to the variable in which to store the handle of the database if
successfully opened and validated. Guaranteed to be NULL if not
successfully opened and validated.
RETURN:
eus_SUCCESS if no error occured
ERR_MEMORY if an insufficient-memory condition was encountered
the Notes API error code otherwise
--- revision history -------
9/20/99 PR: created */
static STATUS us_OpenAndValidateMailDb( char pc_EXTFILENM[],
char pc_SERVERNM[],
char * *const ppc_mereErrLog,
DBHANDLE *const ph) {
static const char *const ppc_DB_NO_EXIST[] = {"+ The database \'", "\' "
"was not located\n on "
"the server \'", "\'"},
*const ppc_DB_IS_DIR[] = {"+ The name \'", "\' is "
"a directory name,\n not a "
"database on the server \'", "\'"},
*const ppc_NOT_MAIL_DB[] = {"+ The database \'",
"\' does not seem to be a\n"
" Notes Mail database"},
*const ppc_NOT_DESIGNR[] = {"+ You do not have "
"required Designer access "
"to the\n database \'",
"\' on server \'", "\'"};
static UINT ui_lenDbNoExist, ui_lenDbIsDir, ui_lenNotMailDb,
ui_lenNotDesigner;
DBHANDLE h_db;
char * pc, * pc_log;
UINT ui;
WORD us, us_dmy;
STATUS us_err;
_ASSERTE( pc_EXTFILENM && *pc_EXTFILENM && pc_SERVERNM &&
ppc_mereErrLog && ph);
*ph = NULL;
if (!ui_lenDbNoExist) {
ui_lenDbNoExist = strlen( ppc_DB_NO_EXIST[0]) +
strlen( ppc_DB_NO_EXIST[1]) +
strlen( ppc_DB_NO_EXIST[2]) + 1;
ui_lenDbIsDir = strlen( ppc_DB_IS_DIR[0]) +
strlen( ppc_DB_IS_DIR[1]) +
strlen( ppc_DB_IS_DIR[2]) + 1;
ui_lenNotMailDb = strlen( ppc_NOT_MAIL_DB[0]) + strlen(
ppc_NOT_MAIL_DB[1]) + 1;
ui_lenNotDesigner = strlen( ppc_NOT_DESIGNR[0]) +
strlen( ppc_NOT_DESIGNR[1]) +
strlen( ppc_NOT_DESIGNR[2]) + 1;
} //if (!ui_lenDbNoExist)
//Try to open the target database. If unsuccessful, check whether the
// error is fatal or not. If not fatal, log a description of the
// problematic condition.
pc_log = *ppc_mereErrLog;
if (us_err = eus_OpenMailDb( pc_EXTFILENM, pc_SERVERNM, &h_db)) {
//if one of our handled errors occurred, run common prep code
switch (ERR( us_err))
case ERR_NOEXIST:
case ERR_NOACCESS:
case ERR_DIRECTORY:
case mi_ERR_NOT_MAIL_DB:
if (!pc_log)
if (!f_StartMereErrLog( &pc_log))
return ERR_MEMORY;
switch (ERR( us_err)) {
//if the database doesn't exist, log the condition and skip back
// to the caller
case ERR_NOEXIST:
if (!( pc = realloc( pc_log, (ui = strlen( pc_log)) +
ui_lenDbNoExist +
strlen( pc_EXTFILENM) +
strlen( pc_SERVERNM) + 1)))
goto errJump;
sprintf( (pc_log = pc) + ui, "\n%s%s%s%s%s",
ppc_DB_NO_EXIST[0], pc_EXTFILENM,
ppc_DB_NO_EXIST[1], pc_SERVERNM,
ppc_DB_NO_EXIST[2]);
break;
//if the current ID does not have access to the database, log the
// condition and skip back to the caller
case ERR_NOACCESS:
if (!( pc = realloc( pc_log, (ui = strlen( pc_log)) +
ui_lenNotDesigner + strlen(
pc_EXTFILENM) + strlen(
pc_SERVERNM) + 1)))
goto errJump;
sprintf( (pc_log = pc) + ui, "\n%s%s%s%s%s",
ppc_NOT_DESIGNR[0], pc_EXTFILENM,
ppc_NOT_DESIGNR[1], pc_SERVERNM,
ppc_NOT_DESIGNR[2]);
break;
//if the "database" is really just a subdirectory path, log the
// condition and skip back to the caller
case ERR_DIRECTORY:
if (!( pc = realloc( pc_log, (ui = strlen( pc_log)) +
ui_lenDbIsDir +
strlen( pc_EXTFILENM) +
strlen( pc_SERVERNM) + 1)))
goto errJump;
sprintf( (pc_log = pc) + ui, "\n%s%s%s%s%s",
ppc_DB_IS_DIR[0], pc_EXTFILENM,
ppc_DB_IS_DIR[1], pc_SERVERNM,
ppc_DB_IS_DIR[2]);
break;
//if the database doesn't seem to be a Notes Mail database, log
// the condition and skip back to the caller
case mi_ERR_NOT_MAIL_DB:
if (!( pc = realloc( pc_log, (ui = strlen( pc_log)) +
ui_lenNotMailDb +
strlen( pc_EXTFILENM) + 1)))
goto errJump;
sprintf( (pc_log = pc) + ui, "\n%s%s%s",
ppc_NOT_MAIL_DB[0], pc_EXTFILENM,
ppc_NOT_MAIL_DB[1]);
break;
default:
return us_err;
} //switch (ERR( us_err))
*ppc_mereErrLog = pc_log;
return eus_SUCCESS;
} //if (us_err = eus_OpenMailDb( pc_EXTFILENM,
//if the current user ID does not have designer access to the database...
NSFDbAccessGet( h_db, &us, &us_dmy);
if (us < ACL_LEVEL_DESIGNER) {
//log the condition
if (!pc_log)
if (!f_StartMereErrLog( &pc_log))
goto errJump;
if (!( pc = realloc( pc_log, (ui = strlen( pc_log)) +
ui_lenNotDesigner +
strlen( pc_EXTFILENM) +
strlen( pc_SERVERNM) + 1)))
goto errJump;
sprintf( (pc_log = pc) + ui, "\n%s%s%s%s%s", ppc_NOT_DESIGNR[0],
pc_EXTFILENM, ppc_NOT_DESIGNR[1],
pc_SERVERNM, ppc_NOT_DESIGNR[2]);
//else we've met with success, so return the handle to the database to
// be processed further by the caller
}else
*ph = h_db;
*ppc_mereErrLog = pc_log;
return eus_SUCCESS;
errJump:
//we've run out of memory, so back out safely
if (pc_log) {
free( pc_log);
*ppc_mereErrLog = NULL;
}
if (h_db)
NSFDbClose( h_db);
return ERR_MEMORY;
} //us_OpenAndValidateMailDb(
/** us_RefreshMailDb( ***
--- parameters & return ----
RETURN: eus_SUCCESS if no error occured; the Notes API error code otherwise
--- revision history -------
9/20/99 PR: logic adjustment to conform to downstream changes
2/6/99 PR: created */
//DOC!!
static STATUS us_RefreshMailDb( DBHANDLE h_TARGET,
EnvInfo *const pt_ENV) {
HANDLE h_src;
char * pc;
STATUS us_err;
_ASSERTE( h_TARGET && pt_ENV && pt_ENV->h_template &&
pt_ENV->pc_DbClass &&
pt_ENV->nid_PgpSubform && pt_ENV->nid_Memo &&
pt_ENV->nid_Reply && pt_ENV->nid_ReplyWH);
if (us_err = eus_ReplaceDesignNote( h_TARGET, NOTE_CLASS_FORM,
mpc_SUBFORMNM_PGP, h_src = pt_ENV->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -