File/plugins/gpg/gpg_hook_functions.php

Description

gpg_hook_functions.php ----------- GPG plugin hook functions file, included by setup.php.

Copyright (c) 2002-2005 Braverock Ventures Copyright (c) 2007 The NaSMail Project Licensed under the GNU GPL. For full terms see the file COPYING.

  • author: Aaron van Meerten
  • author: Brian Peterson
  • version: $Id: gpg_hook_functions.php 1058 2007-12-09 12:54:48Z tokul $
  • todo: leave only functions that don't need gpg_functions.php
  • todo: remove outdated/unused functions
Includes
 include_once (SM_PATH.'plugins/gpg/gpg_functions.php') (line 18)
 include_once (SM_PATH.'functions/forms.php') (line 19)
Functions
add_openpgp_header (line 888)

This function adds the openpgp header to the outgoing message.

void add_openpgp_header ( &$composeMessage)
  • &$composeMessage
gpg_check_sign_pgp_mime (line 628)

Used to read a detached signature file of type applicatiion/pgp-signature

This function is called by the read_body hook (above)

integer gpg_check_sign_pgp_mime (object Message &$message, string $fullbodytext)
  • string $fullbodytext: Body text string as retrieved directly from IMAP
  • object Message &$message: message object See sqimap_get_message() return
gpg_compose_row_do (line 942)

This function adds a "Encrypt Now" and "GPG Sign" link to the "Compose" row during message composition.

void gpg_compose_row_do ()
gpg_compose_send_do (line 719)

This function is called by the main SM plugin_init (above) to initialize our compose_send hook functions

This is where the Encrypt on Send and Encrypt and Sign on Send functions go. $composeMessage is in second array key.

void gpg_compose_send_do ( &$args)
  • &$args
gpg_decrypt_link (line 358)

This function is called by the read_body hook (above)

Use to see if the message contains an encrypted body if the message contains encrypted text, display a link to the decrypt code.

void gpg_decrypt_link (string $body)
  • string $body
gpg_fetch_full_body (line 246)

This function is called before gpg_check_sign and gpg_decrypt_link to retrieve the messge body for those functions

  • return: as string
string gpg_fetch_full_body (integer $imapConnection, integer $passed_id)
  • integer $imapConnection: handle to the IMAP connection
  • integer $passed_id: message ID to retreive from the IMAP folder
gpg_get_message_body_imap (line 318)

get the body of a given part of a message

  • return: (body stuffed into message object)
void gpg_get_message_body_imap (class &$message, integer $imapConnection, integer $passed_id)
  • class &$message: Message object to get the body for
  • integer $imapConnection: handle to the IMAP connection
  • integer $passed_id: message ID to retreive from the IMAP folder
gpg_get_mime_header (line 334)

download just the mime header from imap (note: this does not setup a MessageHeader class

  • return: RFC 822 header to parse for mime type
string gpg_get_mime_header (class $message, integer $imapConnection, integer $passed_id)
  • class $message: Message object to get the entity out of
  • integer $imapConnection: handle to the IMAP connection
  • integer $passed_id: message ID to retreive from the IMAP folder
gpg_handle_signature_do (line 71)

Hook function for application/gpg-signature attachments This function looks for the previous attachment and checks the signature against it. The resulting info is also placed in a session variable gpgverifyinfo

void gpg_handle_signature_do (attachinfo &$attachinfo)
  • attachinfo &$attachinfo: array passed by NaSMail to attachment handlers
gpg_identity_table_hook (line 27)

Function to display possible gpg secret keys for user to select

  • return: String used to output option list
string gpg_identity_table_hook (array $args)
  • array $args: Array passed from identities_option_table
gpg_import_link (line 461)

This function is called by the read_body hook (above)

Use to see if the message contains an encrypted body if the message contains encrypted text, display a link to the decrypt code.

void gpg_import_link (string $body)
  • string $body: message body
gpg_message_encrypt_and_sign (line 1169)

Encrypts or signs messages

Currently signonly action is not finished. Attachments are not signed.

unknown gpg_message_encrypt_and_sign (object Message &$composeMessage, string &$body, string $recipients, integer $session, integer $action, [integer $id = 0])
  • string $recipients
  • integer $session
  • integer $action: 0 - no action, 1 - encrypt, 2 - sign, 3 - encrypt and sign
  • integer $id: starting attachment id. 0 for compose_form_process, 1 for compose_send
  • object Message &$composeMessage: composed message
  • string &$body: body
gpg_openpgp_header (line 201)

This function is called to parse whatever "openpgp:" headers are found in the message and to display add and respond links to those headers.

  • todo: Attached rfc822 messages with OpenPGP headers. passed_ent_id
void gpg_openpgp_header (stream $imapConnection, int $passed_id)
  • stream $imapConnection: IMAP connection
  • int $passed_id: Message ID
gpg_optpage_register_block_do (line 909)

This function formats and adds the plugin and its description to the Options screen.

void gpg_optpage_register_block_do ()
gpg_read_body_header_do (line 141)

This function is called by setup.php, within a hook to initialize our read_body_header functions.

void gpg_read_body_header_do ()
gpg_strip_sign (line 585)

This function strips a gpg signature from the text

  • return: unsigned body
string gpg_strip_sign (string $signedtext)
  • string $signedtext

Documentation generated on Sun, 22 Nov 2009 17:36:37 +0200 by phpDocumentor 1.4.3