Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Stanzas: Message

Lance Stout edited this page Oct 25, 2010 · 5 revisions

Stanzas: Message

Creating a Message Stanza:

msg = sleekxmpp.Message()
msg['type'] # can be "", "normal", "chat", "headline", "error", "groupchat"
msg['to']   # can be JID or any combination of "usernode@serverdomain/resource"
msg['from'] # same as to
msg['id']   # any string
msg['body'] # any string (the plain text message body)
msg['subject'] # any string
msg['mucroom'] # return only object that returns the room if type is groupchat 
               # -- same as msg['from'].bare
msg['mucnick'] # return only object that returns the nickname of the user 
               # who sent the message if type is groupchat
               # -- same as msg['from'].resource

Plugins: HTML-IM XEP-0071

msg['html']['body'] can be cElementTree Element. Will wrap in {http://www.w3.org/1999/xhtml}body for you if you don't include it. Returns {http://www.w3.org/1999/xhtml}body Element w/ children.

Clone this wiki locally