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>
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("server.intranet", 5222)
$jabber.login("mn8Bot", "botpassword")
$jabber.send("crow@server.intranet", "Hello Csabi")
print "Waiting for response ..."
$resp = 0
while( $jabber/response@length < 100 ) do [
if ( $resp != $jabber/response@length ) then [
$resp = $jabber/response@length
if ( $jabber/response/item.getConceptType == "Element" ) then [
print $jabber/response/item.toXML
] else [
print $jabber/response/item/$resp.toXML
]
]
]
]
]
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getErrorHandler, getInheritedConcepts, getResourceURI, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML, setResourceURI |
|
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.
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.
Parameters: |
$user : |
The username to log into jabber server with.
|
$pwd : |
The password to log into jabber server with.
|
|
Exceptions: |
connectionException :
(Error) | Connection refuzed by Jabber server. |
Method to log into Jabber server.
This method established connection to jabber server.
$jabber = JabberClient.create("server.intranet", 5222)
$jabber.login("mn8Bot", "botpassword")
-- the result is --
Estabilish connection with specified jabber server and logining in
with specified username and password.
Parameters: |
$to : |
The user to send the message to.
|
$message : |
The text message to send.
|
$html : |
The html message to send.
|
|
Exceptions: |
recipientException :
(Warning) | No recipient has been specified. |
messageException :
(Warning) | No message text has been specified. |
connectionException :
(Error) | Connection refuzed by Jabber server. |
Method to send to specified user the specified message.
$jabber = JabberClient.create("server.intranet", 5222)
$jabber.login("mn8Bot", "botpassword")
$jabber.send("crow@server.intranet", "Hello Crow", "<body><b>Hello</b> Crow</body>")
-- the result is --
Estabilish connection with specified jabber server and logining in
with specified username and password.
Send HTML formated 'Hello Crow' massage to specified user.
Parameters: |
$to : |
The user to send the message to.
|
$message : |
The text message to send.
|
|
Exceptions: |
recipientException :
(Warning) | No recipient has been specified. |
messageException :
(Warning) | No message text has been specified. |
connectionException :
(Error) | Connection refuzed by Jabber server. |
Method to send to specified user the specified message.
$jabber = JabberClient.create("server.intranet", 5222)
$jabber.login("mn8Bot", "botpassword")
$jabber.send("crow@server.intranet", "Hello Crow")
-- the result is --
Estabilish connection with specified jabber server and logining in
with specified username and password.
Send simple 'Hello Crow' message to specified user.
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
- $inst : instance of current concept
- $e : XML document that will be showed.
define JabberTest [
static : main ( $arg typeof Series ) [
$instance typeof JabberTest
$jabber = JabberClient.create("server.intranet", 5222)
$jabber.addHandler( $instance, "inMess")
$jabber.login("mn8Bot", "botpassword")
$jabber.send("crow@server.intranet", "Hello Crow")
while( $jabber/response@length < 100 ) do [
]
]
: inMess($inst typeof JabberClient, $e typeof Element ) [
print $e.toXML
$inst.send($e@fromId, $e.getValue)
]
]
-- the result is --
Estabilish connection with specified jabber server and logining in
with specified username and password.
Send simple messages to specified user, while not received 100
messages from sender.