DJabber...nt::Node(3)

πŸ“¦ version 0.85, in arch rolling

πŸ’… DJabber...nt::Node(3) β€” User Contributed Perl Documentation πŸŽ€

okay so bestie, listen: this is the User Contributed Perl Documentation page for DJabberd::Agent::Node. grab a strawberry drink and let's get into it πŸ“βœ¨


✨ NAME ✨

DJabberd::Agent::Node β€” it's an abstract class for an agent that handles one specific node. like, one job, one node, main character energy πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

package MyPackage::DJabberd::MyNode;
use base DJabberd::Agent::Node;

# Example of an agent that responds to incoming chat messages

sub handle_message {
    my ($self, $vhost, $stanza) = @_;

    my $response = $stanza->make_response();
    $response->set_raw("<body>Hello. I'm a software agent.</body>");
    $response->deliver($vhost);
}

so this class is the parent class for agents that receive stanzas addressed to a particular nodename inside a domain. iykyk πŸ’…

and bestie, an agent like this is often called a "Bot". there's also a higher-level API for making "chat bots" over in DJabberd::Bot, if you want the fancy version 🧚


🌸 USAGE 🌸

this class is a specialization of DJabberd::Agent. most of the time you'll just use the API that DJabberd::Agent gives you β€” no cap, it's the move. but there are a couple of special behaviours to note, plus some extra methods that aren't part of the basic agent class. so like, stay with me πŸ™ˆ

⭐ handles_destination($self, $to_jid, $vhost)

this class has an overridden version of this method, and it responds with a true value if and only if the domain and the nodename of the destination JID both match the ones this instance handles. both. not one. both. periodt πŸ’―

⭐ vcard($self, $requester_jid)

the overridden version of this method returns a vCard whose full name is set to the nodename of this instance. cute, right? πŸŽ€ subclasses will probably want to override this one to do something more fancy β€” go off, honestly ✨


πŸ”₯ SEE ALSO πŸ”₯

  • DJabberd::Agent
  • DJabberd::Component

(go read them, they're giving lore πŸ“š)


Copyright 2007-2008 Martin Atkins

this module is part of the DJabberd distribution and is covered by the distribution's overall licence. slay, legally speaking 🫢


fr fr that's the whole page β€” no secrets, no extra flags hiding anywhere, i promise 😭

okay bye bestie!! this page came from perl v5.42.0 dated 2025-12-14 β€” that's the version and date in the footer, consider them shouted out with love πŸ’–πŸŒˆπŸ¦‹

πŸ“¦ where this page comes from