ibmime Tcl API

Note:  ibmime is included for backwards compatibility only. Help for the ibmime Tcl package is available in the online Tclhelp under integrator/tcl/lib/cloverleaf/help/hci/ibmime.

Before the ibmime extension can be used by a Tcl procedure, you must put package require ibmime in the Start mode of the procedure.

This is a list of the Tcl methods used to create and access various parts of the ibmime message:

  • ibmimecreate

    This creates an empty IB Mime object. When called without any parameter, ibmimecreate creates an empty ibmime object whose content can then be populated later with the various API methods.

    Example:

    set ih1 [ibmimecreate]

    To instantiate the input IB Mime message:

    set ih1 [ibmimecreate $cont]
    Note: The ibmimecreate method must be used, with the message received from Intelligent Broker as its parameter, to instantiate the ibmime object. This object is populated with the content of the message. This can then be passed to other ibmime API methods.
  • ibmimeheaderadd

    This adds protocol (HTTP, SMTP, POP3) headers.

    Example:

    ibmimeheaderadd $ih1 header_name_1 header_value_1
    ibmimeheaderadd $ih1 header_name_2 header_value_2
  • ibpartcreate

    This creates the first part of the IB Mime.

    For example, this adds headers to the current part:

    set phl [ibpartcreate

    Example:

    ibpartheaderadd $ih1 $phl "Content-Type" "text/xml"
  • ibpartcontentset

    This sets the content of the part.

    Example:

    # Set the content of the 1st part
    ibpartcontentset $ih1 $phl soap_envelope
    # create the 2nd part of this IB Mime
    set phl [ibpartcreate $ih1]
    # add headers of the 2nd part
    ibpartheaderadd $ih1 $phl "Content-Type" "text/plain"
    # add content of the 2nd part. 
    ibpartcontentset $ih1 $phl $cont
  • ibmimeencode

    This generates an IB MIME string from an ibmime object. ibmimeencode must be used to convert an ibmime object, created with the ibmimecreate method, to an actual ibmime message. This message is then sent to the Intelligent Broker server.

    Example:

    msgset $mh1 [ibmimeencode $ih1]
  • ibmimeheaderget

    This gets the protocol headers.

    Example:

    set header_value_1 [ibmimeheaderget $ih1 header_name_1]
    set header_value_2 [ibmimeheaderget $ih1 header_name_2]
  • ibmimecountget

    This gets the number of parts in the MIME message.

    Example:

    set count [ibmimecountget $ih1]
  • ibpartheaderget

    This gets the header of a part.

    For example, to get the header named file_name in the second part (Part ID = 1) of the MIME message:

    set header_value [ibpartheaderget $ih1 1 "file_name"]
  • ibpartcontentget

    This gets the content of a part.

    For example, the second part (Part ID = 1) content is the message:

    set content [ibpartcontentget $ih1 1]
    set content [ibpartcontentget $ih1 1]
  • ibmimeheadercountget

    This returns the number of headers in the main mime package.

    Example:

    ibmimeheadercountget $ih
  • ibmimeheadernames

    This returns a list of header names in the main mime package.

    Example:

    ibmimeheadernames $ih1
  • ibmimeheaderexists

    This returns a 0 or 1 if the header name exists in the main mime package.

    Example:

    ibmimeheaderexists $ih1 $name
  • ibmimeheadersget

    This gets all headers out, for example as a list of lists with two elements. This is similar to a keyed list, but avoids the risk that there is a dot in a key name.

    Example:

    ibmimeheadersget $ih1
  • ibmimesize

    This returns the size in bytes of the main mime package. If inbound, then this is equal to [msglength $mh].

    Example:

    ibmimesize $ih1
  • ibpartheadercountget

    This returns the number of headers in the mime part.

    Example:

    ibpartheadercountget $ih1 $p
  • ibpartheadernames

    This returns a list of header names in the mime part.

    Example:

  • ibpartheaderexists

    This returns 0 or 1 if the header name exists in the mime part

    Example:

    ibpartheaderexists $ih1 $p $name
  • ibpartsize

    This returns the size in bytes of the mime part.

    Example:

    ibpartsize $ih1 $p
  • ibpartheadersget

    This gets all headers out, for example as a list of lists with two elements. This is similar to a keyed list, but avoids the risk that there is a dot in a key name.

    Example:

    ibpartheadersget $ih1 $p