{
    "mode": "perldoc",
    "parameter": "Net::XMPP::Message",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Net%3A%3AXMPP%3A%3AMessage/json",
    "generated": "2026-06-13T00:00:01Z",
    "synopsis": "Net::XMPP::Message is a companion to the Net::XMPP module.\nIt provides the user a simple interface to set and retrieve all\nparts of an XMPP Message.",
    "sections": {
        "NAME": {
            "content": "Net::XMPP::Message - XMPP Message Module\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "Net::XMPP::Message is a companion to the Net::XMPP module.\nIt provides the user a simple interface to set and retrieve all\nparts of an XMPP Message.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "A Net::XMPP::Message object is passed to the callback function for\nthe message.  Also, the first argument to the callback functions is\nthe session ID from XML::Stream.  There are some cases where you\nmight want thisinformation, like if you created a Client that\nconnects to two servers at once, or for writing a mini server.\n\nuse Net::XMPP;\n\nsub message {\nmy ($sid,$Mess) = @;\n.\n.\n.\n}\n\nYou now have access to all of the retrieval functions available.\n\nTo create a new message to send to the server:\n\nuse Net::XMPP;\n\n$Mess = Net::XMPP::Message->new();\n\nNow you can call the creation functions below to populate the tag\nbefore sending it.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "",
            "subsections": [
                {
                    "name": "Retrieval functions",
                    "content": "GetTo()      - returns the value in the to='' attribute for the\nGetTo(\"jid\")   <message/>.  If you specify \"jid\" as an argument\nthen a Net::XMPP::JID object is returned and\nyou can easily parse the parts of the JID.\n\n$to    = $Mess->GetTo();\n$toJID = $Mess->GetTo(\"jid\");\n\nGetFrom()      - returns the value in the from='' attribute for the\nGetFrom(\"jid\")   <message/>.  If you specify \"jid\" as an argument\nthen a Net::XMPP::JID object is returned and\nyou can easily parse the parts of the JID.\n\n$from    = $Mess->GetFrom();\n$fromJID = $Mess->GetFrom(\"jid\");\n\nGetType() - returns the type='' attribute of the <message/>.  Each\nmessage is one of four types:\n\nnormal        regular message (default if type is blank)\nchat          one on one chat\ngroupchat     multi-person chat\nheadline      headline\nerror         error message\n\n$type = $Mess->GetType();\n\nGetSubject() - returns the data in the <subject/> tag.\n\n$subject = $Mess->GetSubject();\n\nGetBody() - returns the data in the <body/> tag.\n\n$body = $Mess->GetBody();\n\nGetThread() - returns the data in the <thread/> tag.\n\n$thread = $Mess->GetThread();\n\nGetError() - returns a string with the data of the <error/> tag.\n\n$error = $Mess->GetError();\n\nGetErrorCode() - returns a string with the code='' attribute of the\n<error/> tag.\n\n$errCode = $Mess->GetErrorCode();\n\nGetTimeStamp() - returns a string that represents the time this\nmessage object was created (and probably received)\nfor sending to the client.  If there is a\njabber:x:delay tag then that time is used to show\nwhen the message was sent.\n\n$date = $Mess->GetTimeStamp();\n"
                },
                {
                    "name": "Creation functions",
                    "content": "SetMessage(to=>string|JID,    - set multiple fields in the <message/>\nfrom=>string|JID,    at one time.  This is a cumulative\ntype=>string,        and over writing action.  If you set\nsubject=>string,     the \"to\" attribute twice, the second\nbody=>string,        setting is what is used.  If you set\nthread=>string,      the subject, and then set the body\nerrorcode=>string,   then both will be in the <message/>\nerror=>string)       tag.  For valid settings read the\nspecific Set functions below.\n\n$Mess->SetMessage(TO=>\"bob\\@jabber.org\",\nSubject=>\"Lunch\",\nBoDy=>\"Let's do lunch!\");\n$Mess->SetMessage(to=>\"bob\\@jabber.org\",\nfrom=>\"jabber.org\",\nerrorcode=>404,\nerror=>\"Not found\");\n\nSetTo(string) - sets the to='' attribute.  You can either pass\nSetTo(JID)      a string or a JID object.  They must be valid JIDs\nor the server will return an error message.\n(ie.  bob@jabber.org/Work)\n\n$Mess->SetTo(\"test\\@jabber.org\");\n\nSetFrom(string) - sets the from='' attribute.  You can either pass\nSetFrom(JID)      a string or a JID object.  They must be valid JIDs\nor the server will return an error message. (ie.\njabber:bob@jabber.org/Work) This field is not\nrequired if you are writing a Client since the\nserver will put the JID of your connection in\nthere to prevent spamming.\n\n$Mess->SetFrom(\"me\\@jabber.org\");\n\nSetType(string) - sets the type attribute.  Valid settings are:\n\nnormal         regular message (default if blank)\nchat           one one one chat style message\ngroupchat      multi-person chatroom message\nheadline       news headline, stock ticker, etc...\nerror          error message\n\n$Mess->SetType(\"groupchat\");\n\nSetSubject(string) - sets the subject of the <message/>.\n\n$Mess->SetSubject(\"This is a test\");\n\nSetBody(string) - sets the body of the <message/>.\n\n$Mess->SetBody(\"To be or not to be...\");\n\nSetThread(string) - sets the thread of the <message/>.  You should\ncopy this out of the message being replied to so\nthat the thread is maintained.\n\n$Mess->SetThread(\"AE912B3\");\n\nSetErrorCode(string) - sets the error code of the <message/>.\n\n$Mess->SetErrorCode(403);\n\nSetError(string) - sets the error string of the <message/>.\n\n$Mess->SetError(\"Permission Denied\");\n\nReply(hash) - creates a new Message object and populates the\nto/from, and the subject by putting \"re: \" in\nfront.  If you specify a hash the same as with\nSetMessage then those values will override the\nReply values.\n\n$Reply = $Mess->Reply();\n$Reply = $Mess->Reply(type=>\"chat\");\n"
                },
                {
                    "name": "Removal functions",
                    "content": "RemoveTo() - removes the to attribute from the <message/>.\n\n$Mess->RemoveTo();\n\nRemoveFrom() - removes the from attribute from the <message/>.\n\n$Mess->RemoveFrom();\n\nRemoveType() - removes the type attribute from the <message/>.\n\n$Mess->RemoveType();\n\nRemoveSubject() - removes the <subject/> element from the\n<message/>.\n\n$Mess->RemoveSubject();\n\nRemoveBody() - removes the <body/> element from the\n<message/>.\n\n$Mess->RemoveBody();\n\nRemoveThread() - removes the <thread/> element from the <message/>.\n\n$Mess->RemoveThread();\n\nRemoveError() - removes the <error/> element from the <message/>.\n\n$Mess->RemoveError();\n\nRemoveErrorCode() - removes the code attribute from the <error/>\nelement in the <message/>.\n\n$Mess->RemoveErrorCode();\n"
                },
                {
                    "name": "Test functions",
                    "content": "DefinedTo() - returns 1 if the to attribute is defined in the\n<message/>, 0 otherwise.\n\n$test = $Mess->DefinedTo();\n\nDefinedFrom() - returns 1 if the from attribute is defined in the\n<message/>, 0 otherwise.\n\n$test = $Mess->DefinedFrom();\n\nDefinedType() - returns 1 if the type attribute is defined in the\n<message/>, 0 otherwise.\n\n$test = $Mess->DefinedType();\n\nDefinedSubject() - returns 1 if <subject/> is defined in the\n<message/>, 0 otherwise.\n\n$test = $Mess->DefinedSubject();\n\nDefinedBody() - returns 1 if <body/> is defined in the <message/>,\n0 otherwise.\n\n$test = $Mess->DefinedBody();\n\nDefinedThread() - returns 1 if <thread/> is defined in the <message/>,\n0 otherwise.\n\n$test = $Mess->DefinedThread();\n\nDefinedErrorCode() - returns 1 if <error/> is defined in the\n<message/>, 0 otherwise.\n\n$test = $Mess->DefinedErrorCode();\n\nDefinedError() - returns 1 if the code attribute is defined in the\n<error/>, 0 otherwise.\n\n$test = $Mess->DefinedError();\n"
                }
            ]
        },
        "AUTHOR": {
            "content": "Originally authored by Ryan Eatmon.\n\nPreviously maintained by Eric Hacker.\n\nCurrently maintained by Darian Anthony Patrick.\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "This module is free software, you can redistribute it and/or modify it under the LGPL 2.1.\n",
            "subsections": []
        }
    },
    "summary": "Net::XMPP::Message - XMPP Message Module",
    "flags": [],
    "examples": [],
    "see_also": []
}