Net::Citadel(3pm)
π NAME π
Net::Citadel β bestie, this is your all-access pass to the Citadel.org protocol, like the whole thing, cover to cover. It's a Perl module (3pm, she's a manual-page girlie π
).
β¨ VERSION β¨
This is Version 0.25, no cap.
π¦ SYNOPSIS π¦
okay so here's the vibe, in code:
use Net::Citadel;
my $c = new Net::Citadel (host => 'citadel.example.org');
$c->login ('Administrator', 'goodpassword');
my @floors = $c->floors;
eval {
$c->assert_floor ('Level 6 (Management)');
}; warn $@ if $@;
$c->retract_floor ('Level 6 (Management)');
$c->logout;
look at her go πβ¨
πΈ DESCRIPTION πΈ
So Citadel is, quoting the marketing girlies, a "turnkey open-source solution for email and collaboration" β and honestly that's as far as marketing can go :-). The main character of the whole thing is the citadel server. To talk to it you've got options: a web interface, or β if you're the automation type (and you are, you're here) β a protocol:
L<http://www.citadel.org/doku.php?id=documentation:appproto:start>
This package does a lil bit of abstraction (more could honestly be done, ngl) and handles some of the protocol handling for you. The whole idea is that whatever app is using this package gets to deal with Citadel's objects: rooms, floors, users. Cute, right? π
π CONSTANTS π
π§ Configuration
CITADEL_PORTβ the constant$CITADEL_PORTequals504, which is the IANA standard Citadel port. iconic number fr.
π Result Codes
LISTING_FOLLOWSβ the result code$LISTING_FOLLOWSequals100, and the Citadel server uses it to say: heads up, after this response I'm gonna dump a listing of some sort. πCIT_OKβ the result code$CIT_OKequals200, and it means the thing you asked for worked. slay.MORE_DATAβ the result code$MORE_DATAequals300, and it means the operation succeeded but you gotta send another command to actually finish it. cliffhanger energy.SEND_LISTINGβ the result code$SEND_LISTINGequals400, and it means the operation is progressing and the server is now expecting zero or more lines of text from you.ERRORβ the result code$ERRORequals500, and it means the operation failed π. The second and third digits of the error code and/or the error message following it will tell you why.BINARY_FOLLOWSβ the result code$BINARY_FOLLOWSequals600, and it means: after this line, read "n" bytes. (<Cn>follows after a blank.)SEND_BINARYβ the result code$SEND_BINARYequals700, and it means you can now send "n" bytes of binary data. ("n" follows after a blank.START_CHAT_MODEβ the result code$START_CHAT_MODEequals800, and it means the system is in chat mode now. Every single line you send gets broadcasted. main character energy, everyone's watching πASYNC_MSGβ the result code$ASYC_MSGequals900, and it means there's a page waiting that needs to be fetched.
πͺ Room Access
PUBLICβ the room access code$PUBLICequals0, and it means the room is to have public access. come on in π«ΆPRIVATEβ the room access code$PRIVATEequals1, and it means the room is to have private access.PRIVATE_PASSWORDβ the room access code$PRIVATE_PASSWORDequals2, and it means the room is to have private access using a password.PRIVATE_INVITATIONβ the room access code$PRIVATE_INVITATIONequals3, and it means the room is to have private access by invitation. you're on the list or you're not πPERSONALβ the room access code$PERSONALequals4, and it means the room is to be a private mailbox only for a particular user.
π§βπ€βπ§ User related
DELETED_USERβ the room access code$DELETED_USERequals0.NEW_USERβ the User related constant$NEW_USERequals1.PROBLEM_USERβ the User related constant$PROBLEM_USERequals2.LOCAL_USERβ the User related constant$LOCAL_USERequals3.NETWORK_USERβ the User related constant$NETWORK_USERequals4.PREFERRED_USERβ the User related constant$PREFERRED_USERequals5.AIDE_USERβ the User related constant$AIDE userequals6.
π INTERFACE π
ποΈ Constructor
"$c = new Net::Citadel (host =" $ctdl_host)>
The constructor creates a handle to the citadel server β and yes, it literally makes the TCP connection while it's at it. It takes these named parameters:
host(default:"localhost") β the hostname (or IP address) where the citadel server is running. Defaults to"localhost".port(default:$CITADEL_PORT) β the port where the citadel server is running. Defaults to the standard Citadel port number504.
β οΈ The constructor will croak if no connection can be established. no server, no vibes.
π οΈ Methods
π Authentication
loginβ$c->login ($user, $pwd)Logs in this user, or will croak if that fails. it's giving gatekeeping.logoutβ$c->logoutWell, logs out the current user. bye bestie π
π’ Floors
floorsβ@floors = $c->floorsRetrieves a list (ARRAY) of known floors. Each entry is a hash reference with the name, the number of rooms in that floor and the index as ID. The index within the array is also the ID of the floor. β¨assert_floorβ$c->assert_floor ($floor_name)Creates the floor with the name provided, or if it already exists it simply returns. This only croaks if there are insufficient privileges.retract_floorβ$c->retract_floor ($floor_name)Retracts a floor with this name. Croaks if that fails because of insufficient privileges. Does not croak if the floor did not exist.
π NOTE: Citadel server (v7.20) seems to have the bug that you cannot delete an empty floor without restarting the server. Not much I can do here about that. π
roomsβ@rooms = $c->rooms ($floor_name)Retrieves the rooms on that given floor.
πͺ Rooms
assert_roomβ$c->assert_room ($floor_name, $room_name, [ $room_attributes ])Creates the room on the given floor. If the room already exists there, nothing else happens. If the floor does not exist, it will complain. π€
The optional room attributes are provided as a hash with the following fields:
"access"(default:"PUBLIC") β one of the constants"PUBLIC","PRIVATE","PRIVATE_PASSWORD","PRIVATE_INVITATION"or"PERSONAL"."password"(default: empty)"default_view"(default: empty)
retract_roomβ$c->retract_room ($floor_name, $room_name)
π NOTE: Not implemented yet. she's a work in progress, be patient π«Ά
π§ Users
create_userβ$c->create_user ($username, $password)Tries to create a user with name and password. Fails if this user already exists (or for some other reason). no dupes allowed πchange_userβ$c->change_user ($user_name, $aspect => $value)Changes certain aspects of a user. Currently understood aspects are:"password"(string)"access_level"(0..6, constants available)
remove_userβ$c->remove_user ($name)Removes the user (actually it sets their level to"DELETED_USER"). it's not a delete delete, it's a vibe delete.
π Miscellaneous
citadel_echoβ$c->citadel_echo ($string)Tests a connection to the Citadel server by sending a message string to it and then checking to see if that same string is echoed back. like yelling into a cave but productive.citadel_infoβ$info_aref = $c->citadel_info()Sends the"INFO"command to the Citadel server and returns the lines it receives from that as a reference to an array. An example of getting and then displaying the server information lines is the following:
my $c = new Net::Citadel (host => $host_name);
my $info_aref = $c->citadel_info;
foreach $line (@{$info_aref}) {
print $line;
}
For more details about the server information lines that are returned, see the "INFO" entry at <http://www.citadel.org/doku.php/documentation:appproto:connection>.
citadel_mrtgβ%mrtg_hash = $c->citadel_mrtg($type)Sends the"MRTG"command to the Citadel server. It expects a type of either"users"or"messages"to be passed to it and returns a hash containing the information from the server.ActiveUsersβ Number of active users on the system. Only returned for type"users".ConnectedUsersβ Number of connected users on the system. Only returned for type"users".HighMsgβ Highest message number on the system. Only returned for type"messages".SystemUptimeβ The uptime for the system formatted as days, hours, minutes.SystemNameβ Human readable name of the Citadel system.
citadel_timeβ$t = $c->citadel_timeGets the current system time and time zone offset from UTC in UNIX timestamp format from the Citadel server.
π "TODO": Rewrite function to return the unpacked parameters as a hash upon success.
π TODOs π
- Decent GUI using Mason + AJAX
manifesting it β¨
π SEE ALSO π
L<http://www.citadel.org/doku.php?id=documentation:appproto:app_proto>
π«Ά AUTHORS π«Ά
Robert Barta, <drrho@cpan.org> Robert James Clay, <jame@rocasa.us>
π COPYRIGHT AND LICENSE π
Copyright (C) 2007-2008 by Robert Barta Copyright (C) 2012-2018 by Robert James Clay
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
and that's the whole page, bestie π this manual page dropped on 2018-06-28 and ships with perl v5.26.2 β go forth and talk to your Citadel server, you've got this π β¨
π¦ where this page comes from
- debian bookworm: libnet-citadel-perl 0.25-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libnet-citadel-perl 0.25-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libnet-citadel-perl 0.25-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libnet-citadel-perl 0.25-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms