mn8 Language Reference | Index    

JabberClient

SUMMARY: ATTRIBUTES SUMMARY  NO ELEMENTS  CONSTRUCTORS SUMMARY  NO OPERATORS  METHODS SUMMARYDETAIL: ATTRIBUTE DETAILS  NO ELEMENTS  CONSTRUCTOR DETAILS  NO OPERATORS  METHOD DETAILS

Description

Concept allow to paging messages to sent via a jabber server.

            Format of HTML message is:<body>...</body>
            Example:<body>Hello it is a <b>test</b>.</body>

Usage

This example connect to jabber Server with specified 'userID' and 'passwd' and sent 'message' message to 'send_to_user', until waiting for response.

            define jabberTest [
                static : main ( $arg typeof Series ) [
                    $instance typeof jabberTest

                    $jabber = JabberClient.create("jabber.org", 5222)
                    $jabber.addHandler( $instance, "showMessage")
                    $jabber.login("userID", "passwd")
                    $jabber.send("send_to_user", "message")

                    print "Waiting for response ..."
                    while( $jabber/response@length $lt; 100 ) do [
                    ]
                ]

                : showMessage( $inst typeof JabberClient, $e typeof Element ) [
                    print "Reply:" + $e.toXML
                ]
            ]
        

Version: 0.1
Authors:Szabo Csaba
Inherits: Concept

Attribute List

 @response TYPEOF Series LABEL "response"
top

Constructor List

create (String $host, Integer $port)
top

Method List

login (String $user, String $pwd)
send (String $to, String $message, String $html)
send (String $to, String $message)
addHandler (Concept $concept, String $methodName)
top
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getConceptsAtPath, getErrorHandler, getInheritedConcepts, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML

Detailed Attribute Info

@response

Label:response
Type:Series
Is Static:false
Is Hidden:false
Show Empty:true

Contains the series of the responses that you get from the server.

top

Detailed Constructor Info

create (String $host, Integer $port)
Parameters:
$host :

The name of the jabber server to connect to.

$port :

The port of the jabber server to connect to.

Method to set up the jabber server host and port.

top

Detailed Method Info

login (String $user, String $pwd)
Parameters:
$user :

The username to log into jabber server with.

$pwd :

The password to log into jabber server with.

Exceptions:
connectionFailed :
(Error)
Connection refuzed by Jabber server.

Method to log into Jabber server. This method established connection to jabber server.

top
send (String $to, String $message, String $html)
Parameters:
$to :

The user to send the message to.

$message :

The text message to send.

$html :

The html message to send.

Exceptions:
recipientMissing :
(Warning)
No recipient has been specified.
messageMissing :
(Warning)
No message text has been specified.
connectionFailed :
(Error)
Connection refuzed by Jabber server.

Method to send to specified user the specified message.

top
send (String $to, String $message)
Parameters:
$to :

The user to send the message to.

$message :

The text message to send.

Exceptions:
recipientMissing :
(Warning)
No recipient has been specified.
messageMissing :
(Warning)
No message text has been specified.
connectionFailed :
(Error)
Connection refuzed by Jabber server.

Method to send to specified user the specified message.

top
addHandler (Concept $concept, String $methodName)
Parameters:
$concept :Instance of current concept.
$methodName :The handler method name that will be called when JabberClient receive a message.

Adds a handler to this JabberClient. Singature of handler method is :
methodName( $inst typeof JabberClient, $e typeof Element ), where

top