⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 php_notes.c

📁 php-4.4.7学习linux时下载的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
		RETURN_FALSE;	}		curArg = 2;	UserNameLen = Z_STRLEN_PP(user_name);	curAction = 0;	ActionCount = 1;	ActionTable[curAction].AddFlag = FALSE;	ActionTable[curAction].NoteID = strtoul (Z_STRVAL_PP(note_id), &pEnd, 16);	if (error = NSFDbOpen(Z_STRVAL_PP(db), &db_handle)) {		OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));		php_error(E_WARNING,"Unable to open database: %s", error_string);		NotesTerm();		RETURN_FALSE;	}	error = UpdateUnread (db_handle, Z_STRVAL_PP(user_name), UserNameLen,				ActionTable, ActionCount, &UndoID);	if ((error == NOERROR) && UndoID) {	 error = UndoUnreadStatus (db_handle, Z_STRVAL_PP(user_name), UserNameLen, ActionTable,								ActionCount, UndoID);	}    /* Close the database */	error = NSFDbClose (db_handle);	if (NOERROR == error) {		RETURN_TRUE;	} else {		OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));		php_error(E_WARNING,"Unable to close database: %s", error_string);		RETURN_FALSE;	}}/* }}} *//* {{{ proto string notes_mark_unread(string database_name, string user_name, string note_id)   Marks a note_id as unread for the User user_name.  Note: user_name must be fully distinguished user name */PHP_FUNCTION(notes_mark_unread){	int argc;	int ActionCount;	pval *argv[3];	STATUS error;	DBHANDLE db_handle;	pval **db;	pval **note_id;	pval **user_name;/* Local data declarations */	WORD        UserNameLen = 0;	char       *pEnd;	int         curAction;	int         curArg;	NOTEID      UndoID = 0L;	char		error_string[200];	argc = ARG_COUNT(ht);	if (getParametersArray(ht, argc, argv) == FAILURE){		WRONG_PARAM_COUNT;	}	if (zend_get_parameters_ex(3, &db, &user_name, &note_id)==FAILURE) {		RETURN_FALSE;	}	convert_to_string_ex(db);	convert_to_string_ex(note_id);	convert_to_string_ex(user_name);	error = NotesInitExtended( argc, (char **) argv );	if( error ){		OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));		php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);		RETURN_FALSE;	}		curArg = 2;	UserNameLen = strlen (Z_STRVAL_PP(user_name));	curAction = 0;	ActionCount = 1;	ActionTable[curAction].AddFlag = TRUE;	ActionTable[curAction].NoteID =	 strtoul (Z_STRVAL_PP(note_id), &pEnd, 16);	if (error = NSFDbOpen (Z_STRVAL_PP(db), &db_handle)){			OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));		php_error(E_WARNING,"Unable to open database: %s", error_string);		NotesTerm();		RETURN_FALSE;	}	error = UpdateUnread (db_handle, Z_STRVAL_PP(user_name), UserNameLen,				ActionTable, ActionCount, &UndoID);	if ( (error == NOERROR) && UndoID ){		error = UndoUnreadStatus (db_handle, Z_STRVAL_PP(user_name), UserNameLen, ActionTable,								ActionCount, UndoID);	}    /* Close the database */	error = NSFDbClose (db_handle);	if (NOERROR == error){			RETURN_TRUE;	}	else{		OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));		php_error(E_WARNING,"Unable to close the database: %s", error_string);		RETURN_FALSE;	}}/* }}} *//* *      UpdateUnread - Update the Unread Note list */STATUS UpdateUnread (         DBHANDLE      db_handle,         char          *pName,         WORD          nameLen,         ACTION_ENTRY  *pActions,         int           actionCount,         NOTEID        *pUndoID){	STATUS         error;	HANDLE         table_handle;	HANDLE         hOriginalTable;	NOTEHANDLE     note_handle;	BOOL           gotUndoID = FALSE;	/* Get the unread list */	error = NSFDbGetUnreadNoteTable (			  db_handle,			  pName,			  nameLen,			  TRUE,         /* Create the list if it's not already there */			  &table_handle);	if (NOERROR != error){	  return (error);	}	/* Notes requires the original unread table to merge changes */	error = IDTableCopy (table_handle, &hOriginalTable);	if (NOERROR != error){	  IDDestroyTable (table_handle);	  return (error);	}	/* Bring table up to date */	error = NSFDbUpdateUnread (db_handle, table_handle);	if (NOERROR == error){		if (pActions[0].AddFlag){			/* Adding a Note ID */			/* (Marks note as Unread) */			if (IDIsPresent (table_handle, pActions[0].NoteID)){				php_error(E_WARNING,"Note %lX is already marked unread", pActions[0].NoteID);			}			else{				/* make sure we check to see if this note really exists 				  at all */				error = NSFNoteOpen(db_handle, pActions[0].NoteID, OPEN_SUMMARY, &note_handle);				/* if it does we'll add it to the unread list */				if (error == NOERROR){				   NSFNoteClose(note_handle);				   error = IDInsert (table_handle, pActions[0].NoteID,									  (NOTESBOOL NOTESPTR) NULL);				}			}   		}		else{			/* Removing a Note ID */			/* (Marks note as Read) */			if (IDIsPresent (table_handle, pActions[0].NoteID)){			   error = IDDelete (table_handle, pActions[0].NoteID,				  (NOTESBOOL NOTESPTR) NULL);			   if (NOERROR == error){				  if (!gotUndoID){					 *pUndoID = pActions[0].NoteID;					 gotUndoID = TRUE;				  }			   }			}			else{				php_error(E_WARNING,"Note %lX is already marked read", pActions[0].NoteID);			}		}		if (NOERROR == error){			error = NSFDbSetUnreadNoteTable (db_handle, pName, nameLen,										   FALSE,      /* Don't force the 														  write to disk */										   hOriginalTable,										   table_handle);		}	}	error = IDDestroyTable (hOriginalTable);	if (NOERROR == error){	  error = error;	}	error = IDDestroyTable (table_handle);	if (NOERROR == error){		error = error;	}	return (error);}/* *      UndoUnreadStatus - Update a note in the database without                           changing its read/unread mark */STATUS UndoUnreadStatus (         DBHANDLE       db_handle,         char           *pName,         WORD           nameLen,         ACTION_ENTRY   *pActions,         int            actionCount,         NOTEID         UndoID){	STATUS         error;	HANDLE         table_handle;	HANDLE         hOriginalTable;	DWORD          noteID = 0L;	NOTEHANDLE     note_handle;	BOOL           bWasRead = TRUE;	/* Get the unread list */	error = NSFDbGetUnreadNoteTable (db_handle, pName, nameLen,									 TRUE, /* Create the list if it's 											  not already there */									  &table_handle);	if (NOERROR != error){	  return (error);	}	/* Notes requires the original unread table to merge changes */		error = IDTableCopy (table_handle, &hOriginalTable);	if (NOERROR != error){		IDDestroyTable (table_handle);		return (error);	}	/* See if note to be modified is marked as read */	bWasRead = !(IDIsPresent (table_handle, UndoID));	/* Make a change to this note and update it. */	error = NSFNoteOpen (db_handle, UndoID, 0, &note_handle);	if (error){  		IDDestroyTable (table_handle);		IDDestroyTable (hOriginalTable);		return (error);	}	error = NSFItemSetText (note_handle, "plain_text", "Unread undone", 							(WORD) strlen("Unread undone"));	if (error){		NSFNoteClose (note_handle);		IDDestroyTable (table_handle);		IDDestroyTable (hOriginalTable);		return (error);	}  	error = NSFNoteUpdate (note_handle, 0L);	if (error){		NSFNoteClose (note_handle);		IDDestroyTable (table_handle);		IDDestroyTable (hOriginalTable);		return (error);	}  	error = NSFNoteClose (note_handle);	if (error){		IDDestroyTable (table_handle);		IDDestroyTable (hOriginalTable);		return (error);	}	/* The note just modified is now marked as unread.	  Bring table up to date */	error = NSFDbUpdateUnread (db_handle, table_handle);	if ( (NOERROR == error) && bWasRead ){		/* Remove the Note ID that we just modified to mark it as read*/		error = IDDelete (table_handle, UndoID,				  (NOTESBOOL NOTESPTR) NULL);		if( error != NOERROR ){			php_error(E_NOTICE,"Note %lX is already marked read.", UndoID);		}	}	/* Save unread table to disk */	if (NOERROR == error){	  error = NSFDbSetUnreadNoteTable (db_handle, pName, nameLen,										FALSE,  /* Don't force the write 												   to disk */										hOriginalTable, table_handle);	}	/* Clean up */	IDDestroyTable (hOriginalTable);	IDDestroyTable (table_handle);	return (error);}/* {{{ proto string notes_unread(string database_name, string user_name)   Returns the unread note id's for the current User user_name.  Note: user_name must be fully distinguished user name */PHP_FUNCTION(notes_unread){	int argc;	pval *argv[2];		STATUS		error;	DBHANDLE	db_handle;	WORD		UserNameLen;	HANDLE		table_handle;	DWORD	    noteID;	BOOL        FirstNote;	char		error_string[200];	pval **db;	pval **user_name;	argc = ARG_COUNT(ht);	if (getParametersArray(ht, argc, argv) == FAILURE){		WRONG_PARAM_COUNT;	}	if (zend_get_parameters_ex(2, &db, &user_name)==FAILURE) {		RETURN_FALSE;	}	convert_to_string_ex(db);	convert_to_string_ex(user_name);	error = NotesInitExtended( argc, (char **) argv );	if( error ){		OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));		php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);		RETURN_FALSE;	}	if (error = NSFDbOpen (Z_STRVAL_PP(db), &db_handle)){			OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));		php_error(E_WARNING,"Unable to open database: %s", error_string);		NotesTerm();		RETURN_FALSE;	}	UserNameLen = strlen(Z_STRVAL_PP(user_name));	/* Get the unread list */	if( error = NSFDbGetUnreadNoteTable (		   db_handle,		   Z_STRVAL_PP(user_name),		   UserNameLen,		   TRUE,         /* Create the list if it's not already there */		   &table_handle) ){		OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));		php_error(E_WARNING,"Unable to get unread list: %s", error_string );		NotesTerm();		RETURN_FALSE;	}   error = NSFDbUpdateUnread (db_handle, table_handle);   if (NOERROR != error)   {		IDDestroyTable (table_handle);		OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));		php_error(E_WARNING,"Unable to get unread list: %s", error_string );		NotesTerm();		RETURN_FALSE;   }		FirstNote = TRUE;	array_init(return_value);	/* Print the entries in the unread list */	while (IDScan (table_handle, FirstNote, &noteID)){		FirstNote = FALSE;		add_next_index_long(return_value, (long) noteID );	}   	error = IDDestroyTable (table_handle);    /* Close the database */	error = NSFDbClose (db_handle);	if( error != NOERROR ){		OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));		php_error(E_WARNING,"Unable to close database: %s", error_string);		RETURN_FALSE;	}}/* }}} */#define     ERR_READMAIL_NOUNIQUE   (PKG_ADDIN + 0)#define     READMAIL_BODY_LINELEN   40STATUS near pascal GetUniqueFileName(char *Drive, char *Ext, char *FileName);/* {{{ proto object notes_header_info(string server, string mailbox, int msg_number)   Opens the message msg_number in the specified mailbox on the specified server (leave server blank for local) *//*		Elements:		originator (Contains orignal message sender. Relevant only when forwarded messages)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -