.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "LiveJournal 3pm" .TH LiveJournal 3pm "2022-11-19" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" LiveJournal \- A Perl implementation of the LiveJournal protocol .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use LiveJournal; \& \& my %info = ( \& user => \*(Aqfoo\*(Aq, \& password => \*(Aqbar\*(Aq, \& ); \& \& my $lj = LiveJournal\->new(\e%info); \& \& my $response = $lj\->login(); \& \& print "Logged in successfully\en" if ($response\->{success} eq "OK"); \& \& ... \& \& my $friend = LiveJournal::Friend\->new(); \& \& my $response = $friend\->check(); \& \& ... \& \& my $journal = LiveJournal::Journal\->new(); \& \& my $response = $journal\->syncitems(); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module is implements the LiveJournal protocol. See http://www.livejournal.com/developer/protocol.bml for details. Data is requested from the server through \fImode lines\fR. Many methods return a hash reference containing key/value pairs returned by the server. Descriptions of possible responses can be found at http://www.livejournal.com/developer/modelist.bml .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" .IP "new (\s-1INFO\s0)" 4 .IX Item "new (INFO)" This is the constructor for a new LiveJournal object. \f(CW\*(C`INFO\*(C'\fR is a hash containing at least \fIusername\fR and \fIpassword\fR (plaintext) or \fIhpassword\fR (\s-1MD5\s0 hash) key/value pairs. You may also include a \fI\s-1URL\s0\fR, for which the default is http://www.livejournal.com/cgi\-bin/log.cgi. To use a proxy, add a \fIproxy\fR key and value. .IP "LiveJournal::livejournal\->new([ \s-1FILES\s0 ])" 4 .IX Item "LiveJournal::livejournal->new([ FILES ])" If you want to use a file in the livejournalrc format to store your data, you can use this method instead. \f(CW\*(C`FILES\*(C'\fR is an array reference to the file(s) you want to load. If you don't specify any, it will use the first one found of ~/.livejournalrc, ~/.livejournal.rc, or /etc/livejournalrc. This will return an object in the LiveJournal class. .SH "BASE CLASS METHODS" .IX Header "BASE CLASS METHODS" .IP "login ([ \s-1INFO\s0 ])" 4 .IX Item "login ([ INFO ])" Log in to the LiveJournal server. Returns a hash reference. The server returns whether the password is good or not, the user's name, an optional message to be displayed to the user, and the list of the user's friend groups. \f(CW\*(C`INFO\*(C'\fR is an optional hash reference containing the optional keys \&\fBgetmoods\fR, \fBgetmenus\fR, and \fBgetpickws\fR. .Sp \&\fBgetmoods\fR should exist and be the number of the highest mood \s-1ID\s0 you have cached/stored on the user's computer. For example, if you logged in last time with and got mood IDs 1, 2, 4, and 5, then send \*(L"5\*(R" as the value of \&\*(L"getmoods\*(R". The server will return every new mood that has an internal MoodID greater than 5. If you've never downloaded moods before, send \*(L"0\*(R". .Sp \&\fBgetmenus\fR should exist if you want to get a list/tree of web jump menus to show in your client. .Sp \&\fBgetpickws\fR should exist if you want to receive that list of picture keywords. .IP "user ()" 4 .IX Item "user ()" Returns the username .IP "password ()" 4 .IX Item "password ()" Returns the password or hpassword, whichever is set. .IP "version ([\s-1VERSION\s0])" 4 .IX Item "version ([VERSION])" Returns the version string. You may alter the version string by passing a \&\f(CW\*(C`VERSION\*(C'\fR. .IP "access ([ \s-1INFO\s0 ])" 4 .IX Item "access ([ INFO ])" Sets/returns the journals that the user has the ability to post to. This method is called automatically by \f(CW\*(C`parse_login()\*(C'\fR. It returns a list reference containing each journal. .IP "friend_group ([ \s-1INFO\s0 ])" 4 .IX Item "friend_group ([ INFO ])" Sets/returns the friend group information. This method is called automatically by \f(CW\*(C`parse_login()\*(C'\fR. It returns a hash of hashes containing \&\fBname\fR and \fBsortorder\fR key/value pairs. We use a hash instead of an array here because the group numbers start from 1 and it seemed more appropriate than having an undef 0 element or requiring adding 1 all the time. .IP "friend_group_max ([ \s-1MAX\s0 ])" 4 .IX Item "friend_group_max ([ MAX ])" Sets/returns the maximum friend_group number. This method is called automatically by \f(CW\*(C`parse_login()\*(C'\fR. .IP "menu ([ \s-1INFO\s0 ])" 4 .IX Item "menu ([ INFO ])" Sets/returns the menu text and \s-1URL\s0 information. This method is called automatically by \f(CW\*(C`parse_login()\*(C'\fR. You can use the list of lists of hashes it returns as data for menus. .IP "mood ([ \s-1INFO\s0 ])" 4 .IX Item "mood ([ INFO ])" Sets/returns the mood information. This method is called automatically by \&\f(CW\*(C`parse_login()\*(C'\fR. Returns a list of hashes containing the keys \fBid\fR and \&\fBname\fR for each mood. .IP "mood_count ([ \s-1COUNT\s0 ])" 4 .IX Item "mood_count ([ COUNT ])" Sets/returns the number of moods. This method is called automatically by \&\f(CW\*(C`parse_login()\*(C'\fR. .IP "name ([ \s-1NAME\s0 ])" 4 .IX Item "name ([ NAME ])" Sets/returns the name of the the logged in user. This method is called automatically by \f(CW\*(C`parse_login()\*(C'\fR. .IP "pic_keyword ([ \s-1KEYWORDS\s0 ])" 4 .IX Item "pic_keyword ([ KEYWORDS ])" Sets/returns the picture keywords. This method is called automatically by \&\f(CW\*(C`parse_login()\*(C'\fR. Returns a reference to a list of the keywords. .IP "escape (\s-1STRING\s0)" 4 .IX Item "escape (STRING)" Use this method to escape strings. \f(CW\*(C`STRING\*(C'\fR is any string. All non-alphanumeric characters and non-whitespace are converted to their \f(CW%hex\fR values. Spaces are converted to \fB+\fRs. .SH "FRIEND METHODS" .IX Header "FRIEND METHODS" .IP "check ()" 4 .IX Item "check ()" Poll the server to see if the friends list has been updated. This request is extremely quick, and is the preferred way for users to see when their friends list is updated. Returns a hash reference. .IP "get ([ [ \s-1FRIENDOF\s0 ] [, \s-1GROUPS\s0 ] ])" 4 .IX Item "get ([ [ FRIENDOF ] [, GROUPS ] ])" Takes two optional arguments. If \f(CW\*(C`FRIENDOF\*(C'\fR is set to 1, you will also get back the info from the \*(L"friendof\*(R" mode. If \f(CW\*(C`GROUPS\*(C'\fR is set to 1, you will get the info from the \*(L"getfriendgroups\*(R" mode. This method returns a hash reference which should be passed to \fB\fBparse()\fB\fR to be more useful. \fB\s-1YOU SHOULD ALWAYS USE THIS METHOD BEFORE VIEWING AND AFTER MODIFYING YOUR FRIENDS LIST TO AVOID INCONSISTENCIES.\s0\fR .IP "parse (\s-1FRIENDS\s0)" 4 .IX Item "parse (FRIENDS)" Takes one argument: the hash reference returned from \fB\fBget()\fB\fR. Returns a hash of lists of hashes containing the info (user, name, fg, bg, etc) for each friend such as: .Sp \&'friend' => [ { 'fg' => '#000000', 'bg' => '#FFFFFF', 'groupmask' => '3', 'user' => 'SomeUser', 'name' => 'Some X. Name' } ] .Sp You should call \fB\fBparse()\fB\fR anytime you call \fB\fBget()\fB\fR to keep your friend count up to date. .IP "edit (\s-1FRIENDS\s0)" 4 .IX Item "edit (FRIENDS)" This method is used to add and edit friends to your friends list. It takes a hash of hash references structure which has the \fBusername\fR as the first level of keys. The second level contains optional \fBfg\fR and \fBbg\fR colors in #RRGGBB format. .Sp \&'newfriend' => { 'fg' => '#000000', 'bg' => '#FFFFFF', } .Sp \&\fBnewfriend\fR is the name of the new user. \fBnumber\fR should be the sum of \f(CW\*(C`numfriends() + n\*(C'\fR where n is incremented for each friend you are adding. .IP "add (\s-1FRIEND,\s0 [ \s-1FG\s0 [, \s-1BG\s0 ] ])" 4 .IX Item "add (FRIEND, [ FG [, BG ] ])" Use this method to add a user from your friends list. \f(CW\*(C`FRIEND\*(C'\fR is a username. \f(CW\*(C`FG\*(C'\fR and \f(CW\*(C`BG\*(C'\fR are foreground and background values in #RRGGBB format. .IP "remove (\s-1USERS\s0)" 4 .IX Item "remove (USERS)" Use this method to remove users from your friends list. Pass it an array reference containing usernames. Returns a hash reference. .IP "friendof ()" 4 .IX Item "friendof ()" This method returns a hash reference of the users that list you as a friend. This hash reference can be passed to \fB\fBparse()\fB\fR. .IP "lastupdate ([ \s-1LAST\s0 ])" 4 .IX Item "lastupdate ([ LAST ])" Returns or sets the last time \fBcheck\fR was used. \fB\fBcheck()\fB\fR sets this value so you don't have to. .IP "numfriends ([ \s-1NUMBER\s0 ])" 4 .IX Item "numfriends ([ NUMBER ])" This method sets and returns the number of friends you have. It is automatically called from \fB\fBparse()\fB\fR so you shouldn't have to worry about setting it manually. .IP "friends ()" 4 .IX Item "friends ()" Sets and returns your friends list. This method is called by \&\f(CW\*(C`parse()\*(C'\fR automatically to propagate the hash. .IP "getgroups ()" 4 .IX Item "getgroups ()" This method returns a hash reference containing information about your friend groups .IP "editgroups (\s-1INFO\s0)" 4 .IX Item "editgroups (INFO)" Use this method to create or edit a friend group. You can modify the name, sort order, and public attributes of the group by passing a hashref containing the keys called \fBname\fR, \fBsort\fR, or \fBpublic\fR and respective new values. You can also add a friend to a group or groups by passing their username as a key and the new groupmask as a value. .IP "deletegroups (\s-1NUMBERS\s0)" 4 .IX Item "deletegroups (NUMBERS)" This method deletes a friend group. Pass it an array reference containing the numbers of the groups to delete. .IP "friends_by_group ()" 4 .IX Item "friends_by_group ()" Returns a hash of list references containing users and the groups they are members of. .IP "add_friend_to_group (\s-1USER, GROUP\s0)" 4 .IX Item "add_friend_to_group (USER, GROUP)" Use this method to add a friend to a user group. \f(CW\*(C`USER\*(C'\fR is the username of the person and \f(CW\*(C`GROUP\*(C'\fR is the group number. .IP "remove_friend_from_group (\s-1USER, GROUP\s0)" 4 .IX Item "remove_friend_from_group (USER, GROUP)" Use this method to remove a friend from a user group. \f(CW\*(C`USER\*(C'\fR is the username of the person and \f(CW\*(C`GROUP\*(C'\fR is the group number. .SH "JOURNAL METHODS" .IX Header "JOURNAL METHODS" .IP "get (\s-1INFO\s0)" 4 .IX Item "get (INFO)" Use this method to download parts of a user's journal. \f(CW\*(C`INFO\*(C'\fR is a hash reference containing at least a key called \fBselecttype\fR and a value of either \fBsyncitems\fR, \fBday\fR, \fBlastn\fR, or \fBone\fR. .Sp \&\fBsyncitems\fR will use the \f(CW\*(C`lastcync()\*(C'\fR method by default, otherwise pass it a date in the \fIyyyy-mm-dd hh::mm::ss\fR format. .Sp If you use \fBday\fR, you may provide \fByear\fR, \fBmonth\fR, and \fBday\fR keys to specify which day. Default is today. .Sp The \fBlastn\fR value requires a \fBhowmany\fR key which says how many of the most recent items to download. Maximum is 50. Default is 20. .Sp If you want a particular entry, you should use the \fBone\fR value and a complimentary \fBitemid\fR key containing the id of the item you want to grab. .Sp For further detail, see http://www.livejournal.com/developer/modeinfo.bml?getevents .IP "post (\s-1INFO\s0)" 4 .IX Item "post (INFO)" This method is used to post a journal entry. \f(CW\*(C`INFO\*(C'\fR is a hash reference containing at least an \fBevent\fR key with a value of the post content. The date keys are created for you. .Sp For further detail, see http://www.livejournal.com/developer/modeinfo.bml?postevent .IP "edit (\s-1INFO\s0)" 4 .IX Item "edit (INFO)" Used to edit user's past journal entry. \f(CW\*(C`INFO\*(C'\fR is a a hash reference containing at least the \fIitemid\fR and \fIevent\fR being submitted. Other optional values are documented at http://www.livejournal.com/developer/modeinfo.bml?editevent .IP "remove (\s-1ITEMID\s0)" 4 .IX Item "remove (ITEMID)" Used to delete a past journal entry. \f(CW\*(C`ITEMID\*(C'\fR is a scalar containing the unique item id to delete. .IP "syncitems ()" 4 .IX Item "syncitems ()" Returns a hash reference containing items (journal entries, to-do items, comments) that have been created or updated on LiveJournal since you last downloaded them. .IP "lastsync ([ \s-1LAST\s0 ])" 4 .IX Item "lastsync ([ LAST ])" Returns or sets the last time \fB\fBsyncitems()\fB\fR was used. \fB\fBsyncitems()\fB\fR sets this value so you don't have to. .IP "getdaycounts ()" 4 .IX Item "getdaycounts ()" This mode retrieves the number of journal entries per day. Useful for populating calendar widgets in \s-1GUI\s0 clients. .SH "AUTHOR" .IX Header "AUTHOR" Frank Sheiness http://feeding.frenzy.com/~rainking/ .SH "CREDITS" .IX Header "CREDITS" .IP "\(bu" 4 Brad 'bradfitz' Fitz for unconfusing me .IP "\(bu" 4 Joe 'pinman' Wreschnig for his idea providing ventures into Perl-LiveJournal land .SH "URL" .IX Header "URL" .IP "\(bu" 4 http://forbidden.dough.net/~archon/lj/ .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\(bu" 4 \&\fBperl\fR\|(1). .IP "\(bu" 4 http://www.livejournal.com/developer/