This commit is contained in:
2019-02-06 00:49:12 +03:00
commit 8dbb1bb605
4796 changed files with 506072 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
<?xml version="1.0"?>
<!-- LiveJournal XSLT stylesheet created by Tribeless Nomad (AJW) -->
<!-- converts DB schema documentation from custom XML to DocBook XML -->
<!-- The source document should comply with dbschema.dtd version 1.0.4. -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<!-- W3C-compliant processors emit an XML declaration by default. -->
<reference>
<title>Schema Browser</title>
<xsl:for-each select="dbschema/dbtbl">
<refentry><xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
<refnamediv>
<refname><database class="table"><xsl:value-of select="name"/></database></refname>
<refpurpose><xsl:apply-templates select="description/node()"/></refpurpose>
</refnamediv>
<refsect1>
<title><database class="table"><xsl:value-of select="name"/></database></title>
<informaltable><tgroup cols="5">
<thead>
<row>
<entry>Column name</entry>
<entry>Type</entry>
<entry>Null</entry>
<entry>Default</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<xsl:for-each select="dbcol">
<row>
<entry><database class="field"><xsl:value-of select="name"/></database></entry>
<entry><type><xsl:value-of select="@type"/></type></entry>
<entry align="center"><xsl:if test="@required[.='false']">YES</xsl:if></entry>
<entry align="center"><xsl:if test="@default"><literal role="value"><xsl:value-of select="@default"/></literal></xsl:if></entry>
<entry><xsl:apply-templates select="description/node()"/></entry>
</row>
</xsl:for-each>
</tbody>
</tgroup></informaltable>
<xsl:choose>
<xsl:when test="dbkey">
<informaltable><tgroup cols="3">
<thead>
<row>
<entry>Key name</entry>
<entry>Type</entry>
<entry>Column(s)</entry>
</row>
</thead>
<tbody>
<xsl:for-each select="dbkey">
<row>
<entry>
<database class="key1"><xsl:value-of select="@name"/></database>
</entry>
<entry>
<type><xsl:value-of select="@type"/></type>
</entry>
<entry>
<xsl:for-each select="id(@colids)">
<database class="field"><xsl:value-of select="name"/></database>
<xsl:if test="position() != last()">, </xsl:if>
</xsl:for-each>
</entry>
</row>
</xsl:for-each>
</tbody>
</tgroup></informaltable>
</xsl:when>
<xsl:otherwise>
<para>No keys defined.</para>
</xsl:otherwise>
</xsl:choose>
</refsect1>
</refentry>
</xsl:for-each>
</reference>
</xsl:template>
<xsl:template match="dbtblref"><link><xsl:attribute name="linkend"><xsl:value-of select="@tblid"/></xsl:attribute><database class="table"><xsl:value-of select="."/></database></link></xsl:template>
<xsl:template match="dbcolref"><database class="field"><xsl:value-of select="."/></database></xsl:template>
<!-- I don't think the following template should be necessary, but in IE5 it is: -->
<xsl:template match="text()"><xsl:value-of select="."/></xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,35 @@
<!-- DTD for LiveJournal database schema documentation in XML -->
<!-- draft version created by Tribeless Nomad (AJW), April 30, 2001 -->
<!-- Send questions and comments to: tribelessnomad (at) att.net -->
<!-- Revision history:
1.0.2 2001 May 1 AJW modified dbtbl, dbcol, dbkey, dbtblref, dbcolref
1.0.1 2001 May 1 AJW added dbkey, modified dbtbl, dbcol
1.0.0 2001 Apr 30 AJW released first draft version
-->
<!-- Documents are expected to use 'dbschema' as the root element. -->
<!ELEMENT dbschema (dbtbl+)>
<!ELEMENT dbtbl (name, description?, dbcol+, dbkey*, data?)>
<!ATTLIST dbtbl id ID #IMPLIED public_browsable (0|1) #IMPLIED>
<!ELEMENT dbcol (name, description?)>
<!ATTLIST dbcol type CDATA #REQUIRED size CDATA #IMPLIED required (true|false) #REQUIRED default CDATA #IMPLIED>
<!ELEMENT dbkey EMPTY>
<!ATTLIST dbkey name NMTOKEN #IMPLIED type (INDEX|UNIQUE|PRIMARY) #REQUIRED colids IDREFS #REQUIRED>
<!ELEMENT data ANY>
<!ELEMENT name (#PCDATA)>
<!ELEMENT description (#PCDATA | dbtblref | dbcolref)*>
<!ELEMENT dbtblref (#PCDATA)>
<!ATTLIST dbtblref tblid IDREF #REQUIRED>
<!ELEMENT dbcolref (#PCDATA)>
<!ATTLIST dbcolref colid IDREF #REQUIRED>

View File

@@ -0,0 +1,126 @@
#!/usr/bin/perl
#
use strict;
require "$ENV{'LJHOME'}/cgi-bin/ljlib.pl";
my $dbr = LJ::get_dbh("slave", "master");
my $sth;
sub magic_links
{
my $des = shift;
$$des =~ s!table\[(\w+?)\]!<dbtblref tblid="_$1">$1</dbtblref>!g;
}
sub dump_xml
{
my $tables = shift;
print "<?xml version=\"1.0\" ?>\n";
print "<!DOCTYPE dbschema SYSTEM \"dbschema.dtd\">\n";
print "<dbschema>\n";
foreach my $table (sort keys %$tables)
{
print "<dbtbl id=\"_$table\">\n";
# table name
print "<name>$table</name>\n";
# description of table
if ($tables->{$table}->{'des'}) {
my $des = $tables->{$table}->{'des'};
&magic_links(\$des);
print "<description>$des</description>\n";
}
# columns
foreach my $col (@{$tables->{$table}->{'cols'}})
{
print "<dbcol id=\"_$table.$col->{'name'}\" type=\"$col->{'type'}\" required=\"$col->{'required'}\" default=\"$col->{'default'}\">\n";
print "<name>$col->{'name'}</name>\n";
if ($col->{'des'}) {
my $des = $col->{'des'};
&magic_links(\$des);
print "<description>$des</description>\n";
}
print "</dbcol>\n";
}
# indexes
foreach my $indexname (sort keys %{$tables->{$table}->{'index'}})
{
my $index = $tables->{$table}->{'index'}->{$indexname};
print "<dbkey name=\"$indexname\" type=\"$index->{'type'}\" colids=\"", join(" ", @{$index->{'cols'}}), "\" />\n";
}
print "</dbtbl>\n";
}
print "</dbschema>\n";
}
my %table;
my %coldes;
$sth = $dbr->prepare("SHOW TABLES");
$sth->execute;
while (my ($table) = $sth->fetchrow_array) {
$table{$table} = {};
}
$sth = $dbr->prepare("SELECT tablename, public_browsable, des FROM schematables");
$sth->execute;
while (my ($name, $public, $des) = $sth->fetchrow_array) {
next unless (defined $table{$name});
$table{$name} = { 'public' => $public, 'des' => $des };
}
$sth = $dbr->prepare("SELECT tablename, colname, des FROM schemacols");
$sth->execute;
while (my ($table, $col, $des) = $sth->fetchrow_array) {
next unless (defined $table{$table});
$coldes{$table}->{$col} = $des;
}
foreach my $table (sort keys %table)
{
$sth = $dbr->prepare("DESCRIBE $table");
$sth->execute;
while (my $r = $sth->fetchrow_hashref)
{
my $col = {};
$col->{'name'} = $r->{'Field'};
my $type = $r->{'Type'};
$type =~ s/int\(\d+\)/int/g;
if ($r->{'Extra'} eq "auto_increment") {
$type .= " auto_increment";
}
$col->{'type'} = $type;
$col->{'default'} = $r->{'Default'};
$col->{'required'} = $r->{'Null'} eq "YES" ? "false" : "true";
$col->{'des'} = $coldes{$table}->{$r->{'Field'}};
push @{$table{$table}->{'cols'}}, $col;
}
$sth = $dbr->prepare("SHOW INDEX FROM $table");
$sth->execute;
while (my $r = $sth->fetchrow_hashref)
{
my $name = $r->{'Key_name'};
my $type = $r->{'Non_unique'} ? "INDEX" : "UNIQUE";
if ($name eq "PRIMARY") { $type = "PRIMARY"; }
$table{$table}->{'index'}->{$name}->{'type'} = $type;
push @{$table{$table}->{'index'}->{$name}->{'cols'}}, "_$table.$r->{'Column_name'}";
}
}
&dump_xml(\%table);

View File

@@ -0,0 +1,9 @@
<chapter>
<?dbhtml filename="schema.html"?>
<title>Database Schema</title>
<para>
FIXME: Since a reference can't go in a chapter (?), this has nothing here. Go look at the reference in the book. :P
</para>
</chapter>

View File

@@ -0,0 +1,204 @@
<chapter>
<?dbhtml filename="programming-guidelines.html"?>
<title>Programming Guidelines</title>
<para>
If you're contributing code back into LiveJournal, be sure to follow
the following guidelines:
</para>
<!-- SECURITY -->
<itemizedlist>
<title>
Security
</title>
<listitem><para>
all GET/POST form values go into %FORM into BML, but check
<function>LJ::did_post()</function> on critical actions. GET requests can be easily
spoofed, or hidden in images, etc.
</para></listitem>
<listitem><para>
never read in arbitrary amounts of input
</para></listitem>
<listitem><para>
never use unsanitized data in a command or SQL
</para></listitem>
</itemizedlist>
<!-- GENERAL -->
<itemizedlist>
<title>
General
</title>
<listitem><para>
BML pages shouldn't interface with the database much. Use the
LJ::* API &amp; the protocol handler.
</para></listitem>
<listitem><para>
always use the <function>LJ::</function> functions that take an explicit database
handle. don't use the old <function>main::</function> functions that use the global
$dbh.
</para></listitem>
<listitem><para>
all files should have <sgmltag>&lt;LJDEP&gt;</sgmltag> edge dependency somewhere, usually
at the bottom.
</para></listitem>
<listitem><para>
using userids (integers) for things is better than using
users (strings), except in URL arguments, where pretty
is more important than speed.
</para></listitem>
<listitem><para>
in BML page, use BML blocks defined in global.look:
LJUSER, P, H1, H2, STANDOUT, HR, etc...
</para></listitem>
<listitem><para>
all HTML should be XHTML compliant.:
<itemizedlist>
<listitem><para>
lower case tags, <sgmltag>&lt;BR&gt;</sgmltag> &rArr; <sgmltag>&lt;br /&gt;</sgmltag>
</para></listitem>
<listitem><para>
quotes around attributes &lt;font face="helvetica"&gt;
</para></listitem>
<listitem><para>
no bare &amp; chars ... always escape them: &amp;amp; and
&lt;a href="foo.bml?a=1&amp;amp;b=2"&gt;...&lt;/a&gt;
</para></listitem>
</itemizedlist>
</para></listitem>
<listitem><para>
use of multiple files to do one function is deprecated. there
should no longer be "foo.bml" and "foo_do.bml" like there used
to. that's ugly.
</para></listitem>
<listitem><para>
tab is a formatting command, not a character. (TODO: add note
about save hooks for emacs &amp; vi) there should be spaces in the
files, not tab characters
</para></listitem>
</itemizedlist>
<!-- DATABASE -->
<itemizedlist>
<title>Database</title>
<listitem><para>
check your db index usage... mysql's "EXPLAIN" is your friend.
</para></listitem>
<listitem><para>
between LOCK TABLES &amp; UNLOCK TABLES, never call a subroutine.
</para></listitem>
<listitem><para>
check the DB error code after an SQL statement. just because
it worked once and the SQL is correct, that doesn't mean the
table might not go corrupt, a disk might fill up, or index
space within the file might not fill up. errors happen.
deal with them.
</para></listitem>
<listitem><para>
preferred way to break up a long SQL query:
<programlisting>
$sth = $dbh->prepare("SELECT cola, colb, colc, cold FROM foo ".
"WHERE colb&lt;&gt;cola AND colc=22");
</programlisting>
</para></listitem>
<listitem><para>
Note on variable naming:
<informaltable>
<tgroup cols="2">
<tbody>
<row>
<entry><computeroutput>$sth</computeroutput></entry>
<entry>statement handle</entry>
</row>
<row>
<entry><computeroutput>$dbh</computeroutput></entry>
<entry>one database handle (usually the master)</entry>
</row>
<row>
<entry><computeroutput>$dbs</computeroutput></entry>
<entry>set of database handles [master(, slave)]</entry>
</row>
<row>
<entry><computeroutput>$dbr</computeroutput></entry>
<entry>read-only slave db handle (used for selects)</entry>
</row>
<row>
<entry><computeroutput>$dbarg</computeroutput></entry>
<entry>argument that can take a $dbh/r or $dbs</entry>
</row>
<row>
<entry><computeroutput>$remote</computeroutput></entry>
<entry>
hashref of remote user, based on cookies. will contain 'userid' and
'user' params, unless faster get_remote_noauth was used, in which case
only 'user' will be present.
</entry>
</row>
<row>
<entry><computeroutput>$u</computeroutput></entry>
<entry>a user 'object' (a hashref)</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para></listitem>
</itemizedlist>
<!-- Performance and Scalability -->
<itemizedlist>
<title>Performance &amp; Scalability</title>
<listitem><para>
Large chunks of code should be preloaded in libraries. Code
in BML pages is re-evaled on every request, so it should
be small. If you need a lot of code, put it in a library
and load it in cgi-bin/lj-bml-(init|local).pl
</para></listitem>
<listitem><para>
don't write temporary files to disk... all LJ code should be able
to run on a cluster of web servers with no session persistence
</para></listitem>
<listitem><para>
if you're calling a function with a $dbarg parameter and you
have both a <computeroutput>$dbs</computeroutput> and <computeroutput>$dbh</computeroutput> available, call the function with
your <computeroutput>$dbs</computeroutput> ... otherwise the function and all its callees
can't ever use the slave databases.
</para></listitem>
</itemizedlist>
<!-- Patches -->
<itemizedlist>
<title>Patches</title>
<listitem><para>
all patches sent in should be in diff -u format
</para></listitem>
<listitem><para>
don't send in patches that comment out old code. if
we want the old code, we'll go get it from CVS.. that's
what it's for
</para></listitem>
</itemizedlist>
<!-- Perl Style -->
<itemizedlist>
<title>Perl Style</title>
<listitem><para>
<computeroutput>foo()</computeroutput> looks prettier than
<computeroutput>&amp;foo()</computeroutput>. let perl 4 die.
</para></listitem>
<listitem><para>
lines longer than 80 characters are okay, but not great.
</para></listitem>
<listitem><para>
if you're in package LJ and calling an LJ::* API function,
go ahead and type the extra four characters (LJ::) even
if they're not necessary... being explicit is nice for
the reader.
</para></listitem>
</itemizedlist>
</chapter>

View File

@@ -0,0 +1,14 @@
all: reference.gen testbook.html
reference.gen: to_docbook.xsl xmlrpc.xml
(xsltproc to_docbook.xsl xmlrpc.xml > reference.gen~) || true
mv reference.gen~ reference.gen
xmlrpc.xml: xmlrpc.dtd authinfo.ent.xml checkfriends.mode.xml editevent.mode.xml editfriendgroups.mode.xml editfriends.mode.xml friendgroups.ent.xml friendof.mode.xml friendslist.ent.xml getdaycounts.mode.xml getevents.mode.xml getfriendgroups.mode.xml getfriends.mode.xml login.mode.xml moods.ent.xml postevent.mode.xml syncitems.mode.xml usejournal.ent.xml usejournals.ent.xml
testbook.html: reference.gen testbook.xml
xsltproc $(LJHOME)/doc/raw/docbook-xsl-1.45/html/docbook.xsl testbook.xml > testbook.html~ || true
mv testbook.html~ testbook.html
clean:
rm reference.gen testbook.html

View File

@@ -0,0 +1,16 @@
<key name="username" count="1">
<scalar><des>
Username of user logging in.
</des></scalar>
</key>
<key name="password" count="opt">
<scalar><des>
Password of user logging in in plaintext. Either this or "hpassword" must be present.
</des></scalar>
</key>
<key name="hpassword" count="opt">
<scalar><des>
MD5 digest of user's password. Not much more secure than password, but at least it's not in plain text.
</des></scalar>
</key>

View File

@@ -0,0 +1,42 @@
<method name="checkfriends">
<shortdes>
Checks to see if your friends list has been updated since a specified time.
</shortdes>
<des>
Mode that clients can use to poll the server to see if their 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, rather than pounding on reload in their browser, which is stressful on the serves.
</des>
<arguments><struct count="1">
&authInfo;
<key name="lastupdate" count="1"><scalar><des>
The time that this mode request returned last time you called it. If this is the first time you've ever called it (since your client has been running), leave this blank. It's strongly recommended that you do not remember this value across invocations of your client, as it's very likely your friends will update since the client was running so the notification is pointless... the user probably read his/her friends page already before starting the client.
</des></scalar></key>
<key name="mask" count="opt"><scalar><des>
The friend group(s) in which the client is checking for new entries, represented as a 32-bit unsigned int. Turn on any combination of bits 1-30 to check for entries by friends in the respective friend groups. Turn on bit 0, or leave the mask off entirely, to check for entries by any friends.
</des></scalar></key>
</struct></arguments>
<!--===================[ RETURN ]==============================-->
<returns><struct count="1">
<key name="new"><scalar><des>
This is what you should use to determine if there are new entries. Its value is "1" if there is new stuff, or "0" if there isn't. A few people requested that this return the number of new entries, but that's a lot more resource intensive, and this protocol mode is supposed to be very quick and painless. In the future we may add a "new_count" response value that says how many new items there are. Note that once this values becomes "1" and you alert the user, <emphasis>stop polling!</emphasis> It'd be pointless to have the client hitting the server all night while the user slept. Once the user acknowleges the notifcation (double-clicks the system tray or panel applet or whatnot), then resume your polling.
</des></scalar></key>
<key name="interval"><scalar><des>
How many seconds you <emphasis>must</emphasis> wait before polling the server again. If your client disobeys, this protocol will just return error messages saying "slow down, bad client!" instead of giving you the data you were trying to cheat to obtain. Note that this also means your client should have an option to disable polling for updates, since some users run multiple operating systems with multiple LiveJournal clients, and both would be fighting each other.
</des></scalar></key>
<key name="count" count="1"><scalar><des>
The number of items that are contained in this response (numbered started at 1). If sync_count is equal to sync_total, then you can stop your sync after you complete fetching every item in this response.
</des></scalar></key>
<key name="total" count="1"><scalar><des>
The total number of items that have been updated since the time specified.
</des></scalar></key>
</struct></returns>
</method>

View File

@@ -0,0 +1,61 @@
<method name="consolecommand">
<shortdes>
Run an administrative command.
</shortdes>
<des>
The LiveJournal server has a text-based shell-like admininistration
console where less-often used commands can be entered. There's a web
interface to this shell online, and this is another gateway to that.
</des>
<arguments><struct count="1">
&authInfo;
<key name="commands" count="1"><list count="1">
<scalar count="0more"><des>
The commands to send, with double quotes around any arguments with spaces,
and double quotes escaped by backslashes, and backslashes escaped with
backslashes. Optionally, you can send a listref instead of a string
for this argument, in which case, we'll use your argument separation
and not parse it ourselves.
</des></scalar>
</list></key>
</struct></arguments>
<!--===================[ RETURN ]==============================-->
<returns><struct count="1">
<key name="results" count="1">
<list count="1"><des>
One stuct returned for each command run,
that struct containing both the overall return value,
and the line-by-line output of the command, with
each line of output being tagged by type (think
stdout vs. stderr, but with stdinfo also). The web interface
shows 'error' with red, '' (stdout) with black, and 'info'
with green. Clients are encouraged to also, if possible.
</des>
<struct count="0more">
<key name="success" count="1">
<scalar><des>
Return status of nth command. 0 or 1.
</des></scalar>
</key>
<key name="output" count="1">
<list count="1">
<scalar count="1"><des>
Type of output line. Either "" (normal output), "error", or "info",
something to be emphasized over normal output.
</des></scalar>
<scalar count="1"><des>
The text of that line.
</des></scalar>
</list>
</key>
</struct>
</list>
</key>
</struct></returns>
</method>

View File

@@ -0,0 +1,79 @@
<method name="editevent">
<shortdes>
Edit or delete a user's past journal entry
</shortdes>
<des>
Modify an already created event. If fields are empty, it will delete the event.
</des>
<arguments><struct count="1">
&authInfo;
<key name="itemid" count="1"><scalar><des>
The unique ItemID of the item being modified or deleted.
</des></scalar></key>
<key name="event" count="1"><scalar><des>
The revised event/log text the user is submitting. Or, to delete an entry, just send no text at all. Carriage returns are okay (0x0A, 0x0A0D, or 0x0D0A), although 0x0D are removed internally to make everything into Unix-style line-endings (just \ns). Posts may also contain HTML, but be aware that the LiveJournal server converts newlines to HTML &lt;BR&gt;s when displaying them, so your client should not try to insert these itself.
</des></scalar></key>
<key name="lineendings" count="1"><scalar><des>
Specifies the type of line-endings you're using. Possible values are <emphasis>unix</emphasis> (0x0A (\n)), <emphasis>pc</emphasis> (0x0D0A (\r\n)), or <emphasis>mac</emphasis> (
0x0D (\r) ). The default is not-Mac. Internally, LiveJournal stores all text as Unix-form
atted text, and it does the conversion by removing all \r characters. If you're sending a
multi-line event on Mac, you have to be sure and send a lineendings value of mac or you
r line endings will be removed. PC and Unix clients can ignore this setting, or you can s
end it. It may be used for something more in the future.
</des></scalar></key>
<key name="subject" count="1"><scalar><des>
The subject for this post. Limited to 255 characters. No newlines.
</des></scalar></key>
<key name="security" count="opt"><scalar><des>
Specifies who can read this post. Valid values are <emphasis>public</emphasis> (default), <emphasis>private</emphasis> and <emphasis>usemask</emphasis>. When value is usemask, viewability is controlled by the allowmask.
</des></scalar></key>
<key name="allowmask" count="opt"><scalar><des>
Relevant when security is usemask. A 32-bit unsigned integer representing which of the user's groups of friends are allowed to view this post. Turn bit 0 on to allow any defined friend to read it. Otherwise, turn bit 1-30 on for every friend group that should be allowed to read it. Bit 31 is reserved.
</des></scalar></key>
<key name="props" count="opt"><struct count="0more"><des>
Properties and their values for the item being returned.
</des></struct></key>
<key name="usejournal" count="opt"><scalar><des>
If editing a shared journal entry, include this key and the username you wish to edit the entry in. By default, you edit the entry as if it were in user "user"'s journal, as specified above.
</des></scalar></key>
<key name="year" count="1"><scalar><des>
If modifying only, the 4-digit year of the event (from the user's local timezone).
</des></scalar></key>
<key name="mon" count="1"><scalar><des>
If modifying only, the 1- or 2-digit month of the event (from the user's local timezone).
</des></scalar></key>
<key name="day" count="1"><scalar><des>
If modifying only, the 1- or 2-digit day of the month of the event (from the user's local timezone).
</des></scalar></key>
<key name="hour" count="1"><scalar><des>
If modifying only, the 1- or 2-digit hour from 0 to 23 of the event (from the user's local timezone).
</des></scalar></key>
<key name="min" count="1"><scalar><des>
If modifying only, the 1- or 2-digit minute of the event (from the user's local timezone).
</des></scalar></key>
</struct></arguments>
<!--===================[ RETURN ]==============================-->
<returns><struct count="1">
<key name="itemid" count="1"><scalar><des>
The unique ItemID of the item being modified or deleted.
</des></scalar></key>
</struct></returns>
</method>

View File

@@ -0,0 +1,45 @@
<method name="editfriendgroups">
<shortdes>
Edit the user's defined groups of friends.
</shortdes>
<des>
Given several optional lists, will add/delete/update/rename the friends groups for a user.
</des>
<arguments><struct count="1">
&authInfo;
<key name="groupmasks" count="opt"><struct count="1">
<des>
A structure of friend userids. The values of each are a string representing an unsigned 32-bit integer with bit 0 set (or the server will force it on anyway), bits 1-30 set for each group the friend belongs to, and bit 31 unset (reserved for future use).
</des>
</struct></key>
<key name="set" count="opt"><struct count="1">
<des>
Given the bit of a friend group, the value contains a structure of information on it.
</des>
<struct count="0more">
<key name="name" count="1"><scalar><des>
Create or rename the friend group by sending this key. The value is the name of the group.
</des></scalar></key>
<key name="sort" count="opt"><scalar><des>
This field should be sent to indicate the sorting order of this group. The value must be in the range of 0-255. The default is 50.
</des></scalar></key>
<key name="public" count="opt"><scalar><des>
If this is "1", then this group is marked as public. If public, other users can see the name of the group and the people that are in it.
</des></scalar></key>
</struct>
</struct></key>
<key name="delete" count="opt"><list count="1"><scalar count="0more"><des>
A number of a friend group to delete (which can be from 1-30, inclusive). The server will modify all old entries that allow access to that friend group, so a new friend group using that number won't have access to old non-related entries. However, it is the client's responsibility to modify each friend's groupmask to remove them from the group as it's deleted.
</des></scalar></list></key>
</struct></arguments>
<!--===================[ RETURN ]==============================-->
<returns><struct count="1">
</struct></returns>
</method>

View File

@@ -0,0 +1,59 @@
<method name="editfriends">
<shortdes>
Add, edit, or delete friends from the user's friends list.
</shortdes>
<des>
Takes up to two lists, one of friends to delete and one of friends to add. Several options are allowed to be specified when adding a friend. It returns a verbose list of the friends added, if any were.
</des>
<arguments><struct count="1">
&authInfo;
<key name="delete" count="opt"><list count="1">
<des>
A list of variable of this form removes the friend users from the user's friend list. It is not an error to delete an already non-existant friend. The value should just be 1.
</des>
<scalar count="0more"><des>
A username of a friend to remove.
</des></scalar>
</list></key>
<key name="add" count="opt"><list count="1">
<des>
To add friends, send a variable list of this form.
</des>
<struct count="0more">
<key name="username" count="1"><scalar><des>
A username of a friend to remove.
</des></scalar></key>
<key name="fgcolor" count="opt"><scalar><des>
Sets the text color of the friend being added. This value is a HTML-style hex-triplet, and must either be of the form <emphasis>#rrggbb</emphasis> or not sent at all. By default, the value assumed is #000000, black.
</des></scalar></key>
<key name="bgcolor" count="opt"><scalar><des>
Sets the background color of the friend being added. This value is a HTML-style hex-triplet, and must either be of the form <emphasis>#rrggbb</emphasis> or not sent at all. By default, the value assumed is #FFFFFF, white.
</des></scalar></key>
<key name="groupmask" count="opt"><scalar><des>
Sets this user's groupmask. Only use this in clients if you've very recently loaded the friend groups. If your client has been loaded on the end user's desktop for days and you haven't loaded friend groups since it started, they may be inaccurate if they've modified their friend groups through the website or another client. In general, don't use this key unless you know what you're doing.
</des></scalar></key>
</struct>
</list></key>
</struct></arguments>
<!--===================[ RETURN ]==============================-->
<returns><struct count="1">
<key name="added" count="opt"><des>
A list of the users who have been added with this transaction.
</des>
<list count="1"><struct count="0more">
<key name="username"><scalar><des>
The username of the friend that was added.
</des></scalar></key>
<key name="fullname"><scalar><des>
The full name of the friend that was added.
</des></scalar></key>
</struct></list></key>
</struct></returns>
</method>

View File

@@ -0,0 +1,21 @@
<list count="1">
<struct count="0more">
<key name="id" count="1"><scalar><des>
The bit number for this friend group, from 1-30.
</des></scalar></key>
<key name="name" count="1"><scalar><des>
The name of this friend group.
</des></scalar></key>
<key name="sortorder" count="1"><scalar><des>
The sort integer for this friend group, from 0-255.
</des></scalar></key>
<key name="public" count="1"><scalar><des>
Either '0' or '1' for if this friend group is public.
</des></scalar></key>
</struct>
</list>

View File

@@ -0,0 +1,29 @@
<method name="friendof">
<shortdes>
Returns a list of which other LiveJournal users list this user as their friend.
</shortdes>
<des>
Returns a "friends of" list for a specified user. An optional limit of returned friends can be supplied.
</des>
<arguments><struct count="1">
&authInfo;
<key name="friendoflimit" count="opt"><scalar><des>
If set to a numeric value greater than zero, this mode will only return the number of results indicated. Useful only for building pretty lists for display which might have a button to view the full list nearby.
</des></scalar></key>
</struct></arguments>
<!--===================[ RETURN ]==============================-->
<returns><struct count="1">
<key name="friendofs" count="1">
<des>
The list of people who list this user as a friend.
</des>
&friendsList;
</key>
</struct></returns>
</method>

View File

@@ -0,0 +1,29 @@
<list count="1">
<struct count="0more">
<key name="username" count="1"><scalar><des>
The username of the friend.
</des></scalar></key>
<key name="fullname" count="1"><scalar><des>
The full name of the friend.
</des></scalar></key>
<key name="journaltype" count="1"><scalar><des>
The type of journal the friend item is.
</des></scalar></key>
<key name="fgcolor" count="1"><scalar><des>
The foreground color of the friend item.
</des></scalar></key>
<key name="bgcolor" count="1"><scalar><des>
The background color of the friend item.
</des></scalar></key>
<key name="groupmask" count="1"><scalar><des>
If the group mask is not "1" (just bit 0 set), then this variable is returned with an 32-bit unsigned integer with a bit 0 always set, and bits 1-30 set for each group this friend is a part of. Bit 31 is reserved.
</des></scalar></key>
</struct>
</list>

View File

@@ -0,0 +1,33 @@
<method name="getdaycounts">
<shortdes>
This mode retrieves the number of journal entries per day.
</shortdes>
<des>
This mode retrieves the number of journal entries per day. Useful for populating calendar widgets in GUI clients. Optionally a journal can be specified. It returns a list of the dates and accompanied counts.
</des>
<arguments><struct count="1">
&authInfo;
<key name="usejournal" count="opt">
<des>
If getting the day counts of a shared journal, include this key and the username you wish to get the counts of. By default, you load the counts of "user" as specified above.
</des>
&useJournal;
</key>
</struct></arguments>
<!--===================[ RETURN ]==============================-->
<returns><struct count="1">
<key name="daycounts" count="1"><list count="1"><struct count="0more"><des>
For each day that the user has posted a journal entry, a struct is returned in the list.
</des>
<key name="date"><scalar><des>The date, in yyyy-dd-mm format.</des></scalar></key>
<key name="count"><scalar><des>The number of journal entries on that date.</des></scalar></key>
</struct>
</list></key>
</struct></returns>
</method>

View File

@@ -0,0 +1,109 @@
<method name="getevents">
<shortdes>
Download parts of the user's journal.
</shortdes>
<des>
Given a set of specifications, will return a segment of entries up to a limit set by the server. Has a set of options for less, extra, or special data to be returned.
</des>
<arguments><struct count="1">
&authInfo;
<key name="truncate" count="opt"><scalar><des>
A value that if greater than or equal to 4, truncates the length of the returned events (after being decoded) to the value specified. Entries less than or equal to this length are left untouched. Values greater than this length are truncated to the specified length minus 3, and then have "... " appended to them, bringing the total length back up to what you specified. This is good for populating list boxes where only the beginning of the entry is important, and you'll double-click it to bring up the full entry.
</des></scalar></key>
<key name="prefersubject" count="opt"><scalar><des>
If this setting is set to true (1 ), then no subjects are returned, and the events are actually subjects if they exist, or if not, then they're the real events. This is useful when clients display history and need to give the user something to double-click. The subject is shorter and often more informative, so it'd be best to download only this.
</des></scalar></key>
<key name="noprops" count="opt"><scalar><des>
If this setting is set to true (1), then no meta-data properties are returned.
</des></scalar></key>
<key name="selecttype" count="1"><scalar><des>
Determines how you want to specify what part of the journal to download. Valid values are <emphasis>day</emphasis> to download one entire day, <emphasis>lastn</emphasis> to get the most recent n entries (where n is specified in the howmany field), <emphasis>one</emphasis> to download just one specific entry, or <emphasis>syncitems</emphasis> to get some number of items (which the server decides) that have changed since a given time (specified in the lastsync parameter>). Not that because the server decides what items to send, you may or may not be getting everything that's changed. You should use the syncitems selecttype in conjuntions with the syncitems protocol mode.
</des></scalar></key>
<key name="lastsync" count="opt"><scalar><des>
For a selecttype of <emphasis>syncitems</emphasis>, the date (in "yyyy-mm-dd hh:mm:ss" format) that you want to get updates since.
</des></scalar></key>
<key name="year" count="opt"><scalar><des>
For a selecttype of <emphasis>day</emphasis>, the 4-digit year of events you want to retrieve.
</des></scalar></key>
<key name="month" count="opt"><scalar><des>
For a selecttype of <emphasis>day</emphasis>, the 1- or 2-digit month of events you want to retrieve.
</des></scalar></key>
<key name="day" count="opt"><scalar><des>
For a selecttype of <emphasis>day</emphasis>, the 1- or 2-digit day of the month of events you want to retrieve.
</des></scalar></key>
<key name="howmany" count="opt"><scalar><des>
For a selecttype of <emphasis>lastn</emphasis>, how many entries to get. Defaults to 20. Maximum is 50.
</des></scalar></key>
<key name="beforedate" count="opt"><scalar><des>
For a selecttype of <emphasis>lastn</emphasis>, you can optionally include this variable and restrict all entries returned to be before the date you specify, which must be of the form <emphasis>yyyy-mm-dd hh:mm:ss</emphasis>.
</des></scalar></key>
<key name="itemid" count="opt"><scalar><des>
For a selecttype of <emphasis>one</emphasis>, the journal entry's unique ItemID for which you want to retrieve. Or, to retrieve the most recent entry, use the value -1. Using -1 has the added effect that the data is retrieved from the master database instead of a replicated slave. Clients with an "Edit last entry" feature might want to send -1, to make sure the data that comes back up is accurate, in case a slave database is a few seconds behind in replication.
</des></scalar></key>
<key name="lineendings" count="1"><scalar><des>
Specifies the type of line-endings you're using. Possible values are <emphasis>unix</emphasis> (0x0A (\n)), <emphasis>pc</emphasis> (0x0D0A (\r\n)), or <emphasis>mac</emphasis> (0x0D (\r) ). The default is not-Mac. Internally, LiveJournal stores all text as Unix-formatted text, and it does the conversion by removing all \r characters. If you're sending a multi-line event on Mac, you have to be sure and send a lineendings value of mac or your line endings will be removed. PC and Unix clients can ignore this setting, or you can send it. It may be used for something more in the future.
</des></scalar></key>
<key name="usejournal" count="opt">
<des>
If getting the history of a shared journal, include this key and the username you wish to get the history of. By default, you load the history of "user" as specified above.
</des>
&useJournal;
</key>
</struct></arguments>
<!--===================[ RETURN ]==============================-->
<returns><struct count="1">
<key name="events" count="1"><list count="1"><des>
A list of structs for all of the returned events.
</des>
<struct count="0more">
<key name="itemid" count="1"><scalar><des>
The unique integer ItemID of the item being returned.
</des></scalar></key>
<key name="eventtime" count="1"><scalar><des>
The time the user posted (or said they posted, rather, since users can back-date posts) the item being returned.
</des></scalar></key>
<key name="security" count="1"><scalar><des>
If this variable is not returned, then the security of the post is <emphasis>public</emphasis>, otherwise this value will be <emphasis>private</emphasis> or usemask.
</des></scalar></key>
<key name="allowmask" count="opt"><scalar><des>
If security is <emphasis>usemask</emphasis> then this is defined with the 32-bit unsigned int bit-mask of who is allowed to access this post.
</des></scalar></key>
<key name="subject" count="opt"><scalar><des>
The subject of the journal entry. This won't be returned if "prefersubjects" is set, instead the subjects will show up as the events.
</des></scalar></key>
<key name="event" count="1"><scalar><des>
The event text itself. This value is first truncated if the truncate variable is set, and then it is URL-encoded (alphanumerics stay the same, weird symbols to %hh, and spaces to + signs, just like URLs or post request). This allows posts with line breaks to come back on one line.
</des></scalar></key>
<key name="props" count="opt"><struct count="0more"><des>
Properties and their values for the item being returned.
</des></struct></key>
</struct>
</list></key>
</struct></returns>
</method>

View File

@@ -0,0 +1,22 @@
<method name="getfriendgroups">
<shortdes>
Retrieves a list of the user's defined groups of friends.
</shortdes>
<des>
Retrieves a list of the user's defined groups of friends.
</des>
<arguments><struct count="1">
&authInfo;
</struct></arguments>
<!--===================[ RETURN ]==============================-->
<returns><struct count="1">
<key name="friendgroups" count="1">
&friendGroups;
</key>
</struct></returns>
</method>

View File

@@ -0,0 +1,40 @@
<method name="getfriends">
<shortdes>
Returns a list of which other LiveJournal users this user lists as their friend.
</shortdes>
<des>
Returns a verbose list of information on friends a user has listed. Optionally able to include their friends of list, the friends group associated with each user, and a limit on the number of friends to return.
</des>
<arguments><struct count="1">
&authInfo;
<key name="includefriendof" count="opt"><scalar><des>
If set to 1, you will also get back the info from the "friendof" mode. Some clients show friends and friendof data in separate tabs/panes. If you're always going to load both, then use this flag (as opposed to a tabbed dialog approach, where the user may not go to the second tab and thus would not need to load the friendof data.) friendof request variables can be used.
</des></scalar></key>
<key name="includegroups" count="opt"><scalar><des>
If set to 1, you will also get back the info from the "getfriendgroups" mode. See above for the reason why this would be useful.
</des></scalar></key>
<key name="friendlimit" count="opt"><scalar><des>
If set to a numeric value greater than zero, this mode will only return the number of results indicated. Useful only for building pretty lists for display which might have a button to view the full list nearby.
</des></scalar></key>
</struct></arguments>
<!--===================[ RETURN ]==============================-->
<returns><struct count="1">
&friendGroups;
<key name="friendofs">
&friendsList;
</key>
<key name="friends">
&friendsList;
</key>
</struct></returns>
</method>

View File

@@ -0,0 +1,118 @@
<method name="login">
<shortdes>
validate user's password and get base information needed for client to function
</shortdes>
<des>
Login to the server, while announcing your client version. The server returns with whether the password is good or not, the user's name, an optional message to be displayed to the user, the list of the user's friend groups, and other things.
</des>
<arguments><struct count="1">
&authInfo;
<key name="clientversion" count="opt"><scalar><des>
Although optional, this <emphasis>should</emphasis> be a string of the form <literal>Platform-ProductName/ClientVersionMajor.Minor.Rev</literal>, like <emphasis>Win32-MFC/1.2.7</emphasis> or <emphasis>Gtk-LoserJabber/1.0.4</emphasis>. Note in this case that "Gtk" is not a platform, but rather a toolkit, since the toolkit is multi-platform (Linux, FreeBSD, Solaris, Windows...). You make the judge what is best to send, but if it's of this form, we'll give you cool statistics about your users.
</des></scalar></key>
<key name="getmoods" count="opt"><scalar><des>
If your client supports moods, send this key with a value of the highest mood ID 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 "5" as the value of "getmoods". The server will return every new mood that has an internal MoodID greater than 5. If you've never downloaded moods before, send "0". If you don't care about getting any moods at all (if your client doesn't support them), then don't send this key at all.
</des></scalar></key>
<key name="getmenus" count="opt"><scalar><des>
Send something for this key if you want to get a list/tree of web jump menus to show in your client.
</des></scalar></key>
<key name="getpickws" count="opt"><scalar><des>
If your client supports picture keywords and you want to receive that list, send something for this key, like "1", and you'll receieve the list of picture keywords the user has defined.
</des></scalar></key>
<key name="getpickwurls" count="opt"><scalar><des>
If your client supports picture keywords and can also display the pictures somehow, send something for this key, like "1", and you'll receieve the list of picture keyword URLs that correspond to the picture keywords as well as the URL for the default picture. You must send getpickws for this option to even matter.
</des></scalar></key>
</struct></arguments>
<!--===================[ RETURN ]==============================-->
<returns><struct count="1">
<key name="name" count="1"><scalar><des>
The user's full name. Often, clients use this to change the top-level window's title bar text to say something like "LiveJournal - User name". You can just ignore this if you'd like.
</des></scalar></key>
<key name="message" count="opt"><scalar><des>
A message that <emphasis>should</emphasis> be displayed in a dialog box (or to the screen in a console application). The message is rarely present but when used notifies the user of software updates they've requested to hear about, problems with their account (if mail is bouncing to them, we'd like them to give us a current email address), etc. To test this if you're developing a client, use the user account <literal role="username">test</literal> with the password <literal>test</literal> and a message will always be returned.
</des></scalar></key>
<key name="friendgrounds" count="1">
&friendGroups;
</key>
<key name="usejournals" count="opt">
&useJournals;
</key>
<key name="moods" count="opt">
<des>
If you sent the 'getmoods' key in your request, this is returned. The contents are the new moods that have been added on the server since you last requested the list. Your client should cache the mood list on the client's computer to avoid requesting the whole list everytime.
</des>
&moods;
</key>
<key name="pickws" count="opt">
<des>
This is requrned if you set "getpickws" in your request. Picture keywords are used to identify which userpic (100x100 icon) to use for that particular post. For instance, the user may have "Angry", "Happy", and "Sleepy" picture keywords which map to certain pictures. The client should also do a case-insensitive compare on this list when a mood is selected or entered, and auto-select the current picture keyword. That way it seems that selecting a mood also sets their corresponding picture.
</des>
<list count="1"><scalar count="0more"><des>
The picture keyword.
</des></scalar></list>
</key>
<key name="pickwurls" count="opt">
<des>
The URLs of the user pictures. They correspond with the list of
picture keywords returned. Note that the content behind these URLs
can never change, so if your client downloads these to display, just
cache them locally and never hit the servers again to re-download them
or to even check if they've been modified.
</des>
<list count="1"><scalar count="0more"><des>
The picture URL.
</des></scalar></list>
</key>
<key name="defaultpicurl" count="opt"><scalar><des>
The URL of the default picture (if you sent the 'getpickwurls' key). Note that the content behind this URL can never change, so you can cache it locally; also note that the default picture might have no keyword associated with it.
</des></scalar></key>
<key name="fastserver" count="opt"><scalar><des>
LiveJournal sites may have priority servers for paying customers. If this key is both present and set to value "1", then the client has permission to set the "ljfastserver" cookie in subsequent requests. The HTTP request header to send is "Cookie: ljfastserver=1". If you send this header without getting permission from the login mode, your requests will fail. That is, you'll trick the load balancer into directing your request towards the priority servers, but the server you end up hitting won't be happy that you're trying to scam faster access and will deny your request.
</des></scalar></key>
<key name="userid" count="1"><scalar><des>
The userid of this user on the system. Not required for any other requests to
the server, but some developers have wanted it.
</des></scalar></key>
<key name="menus" count="opt">
<des>Returned if you set "getmenus" in your request.</des>
<list count="1">
<des>List of menu items in order that should be in the LiveJournal web menu in the client application.</des>
<struct count="0more">
<key name="text" count="1"><scalar><des>
The text of the menu item, or "-" for a separator.
</des></scalar></key>
<key name="url" count="opt"><scalar><des>
The URL the menu item should launch, present for all menu items
except separators and submenus.
</des></scalar></key>
<key name="sub" count="opt"><des>
If this is present, this menu item is a submenu.
</des><list count="0more">
<des>Same format as top-level menu structure</des>
<struct></struct>
</list></key>
</struct>
</list>
</key>
</struct></returns>
</method>

View File

@@ -0,0 +1,15 @@
<list count="1">
<struct count="0more">
<key name="id"><scalar><des>
The integer moodid.
</des></scalar></key>
<key name="name"><scalar><des>
The mood name.
</des></scalar></key>
<key name="parent"><scalar><des>
The mood's parent (base) moodid.
</des></scalar></key>
</struct>
</list>

View File

@@ -0,0 +1,74 @@
<method name="postevent">
<shortdes>
The most important mode, this is how a user actually submits a new log entry to the server.
</shortdes>
<des>
Given all of the require information on a post, optioanlly adding security or meta data, will create a new entry. Will return the itemid of the new post.
</des>
<arguments><struct count="1">
&authInfo;
<key name="event" count="1"><scalar><des>
The event/log text the user is submitting. Carriage returns are okay (0x0A, 0x0A0D, or 0x0D0A), although 0x0D are removed internally to make everything into Unix-style line-endings (just \ns). Posts may also contain HTML, but be aware that the LiveJournal server converts newlines to HTML &lt;BR&gt;s when displaying them, so your client should not try to insert these itself.
</des></scalar></key>
<key name="lineendings" count="1"><scalar><des>
Specifies the type of line-endings you're using. Possible values are <emphasis>unix</emphasis> (0x0A (\n)), <emphasis>pc</emphasis> (0x0D0A (\r\n)), or <emphasis>mac</emphasis> (0x0D (\r) ). The default is not-Mac. Internally, LiveJournal stores all text as Unix-formatted text, and it does the conversion by removing all \r characters. If you're sending a multi-line event on Mac, you have to be sure and send a lineendings value of mac or your line endings will be removed. PC and Unix clients can ignore this setting, or you can send it. It may be used for something more in the future.
</des></scalar></key>
<key name="subject" count="1"><scalar><des>
The subject for this post. Limited to 255 characters. No newlines.
</des></scalar></key>
<key name="security" count="opt"><scalar><des>
Specifies who can read this post. Valid values are <emphasis>public</emphasis> (default), <emphasis>private</emphasis> and <emphasis>usemask</emphasis>. When value is usemask, viewability is controlled by the allowmask.
</des></scalar></key>
<key name="allowmask" count="opt"><scalar><des>
Relevant when security is usemask. A 32-bit unsigned integer representing which of the user's groups of friends are allowed to view this post. Turn bit 0 on to allow any defined friend to read it. Otherwise, turn bit 1-30 on for every friend group that should be allowed to read it. Bit 31 is reserved.
</des></scalar></key>
<key name="year" count="1"><scalar><des>
The current 4-digit year (from the user's local timezone).
</des></scalar></key>
<key name="mon" count="1"><scalar><des>
The current 1- or 2-digit month (from the user's local timezone).
</des></scalar></key>
<key name="day" count="1"><scalar><des>
The current 1- or 2-digit day of the month (from the user's local timezone).
</des></scalar></key>
<key name="hour" count="1"><scalar><des>
The current 1- or 2-digit hour from 0 to 23 (from the user's local timezone).
</des></scalar></key>
<key name="min" count="1"><scalar><des>
The current 1- or 2-digit minute (from the user's local timezone).
</des></scalar></key>
<key name="props" count="1"><des>
Set an arbitrary (but restricted) meta-data property to this log item. See the document on properties for the discussion of them and the list of valid names. You may send zero or more keys like this, one for each property you're setting.
</des>
</key>
<key name="usejournal" count="opt">
<des>
If posting to a shared journal, include this key and the username you wish to post to. By default, you post to the journal of "user" as specified above.
</des>
&useJournal;
</key>
</struct></arguments>
<!--===================[ RETURN ]==============================-->
<returns><struct count="1">
<key name="itemid" count="1"><scalar><des>
The unique number the server assigned to this post. Currently nothing else in the protocol requires the use of this number so it's pretty much useless, but somebody requested it be returned, so it is.
</des></scalar></key>
</struct></returns>
</method>

View File

@@ -0,0 +1,42 @@
<method name="syncitems">
<shortdes>
Returns a list of all the items that have been created or updated for a user.
</shortdes>
<des>
Returns a list (or part of a list) of all the items (journal entries, to-do items, comments) that have been created or updated on LiveJournal since you last downloaded them. Note that the items themselves are not returned --- only the item type and the item number. After you get this you have to go fetch the items using another protocol mode. For journal entries (type "L"), use the getevents mode with a selecttype of "syncitems".
</des>
<arguments><struct count="1">
&authInfo;
<key name="lastsync" count="opt"><scalar><des>
The date you last downloaded synced, in "yyyy-mm-dd hh:mm:ss" format. <emphasis>Note</emphasis>: do not make this date up from the client's local computer... send the date from this mode's response of the newest item you have saved on disk.
</des></scalar></key>
</struct></arguments>
<!--===================[ RETURN ]==============================-->
<returns><struct count="1">
<key name="syncitems" count="1"><list count="1"><struct count="0more">
<key name="item" count="1"><scalar><des>
The nth item, in the form "Type-Number". Type can be one of "L" for log entries (journal entries), "C" for comments (not implemented), "T" for to-do items (not implemented), or many other things presumably. If your client doesn't know how to fetch an item of a certain type, just ignore them. A new version of your client could later see that it has never downloaded anything of type "T" and go back and fetch everything of that type from the beginning.
</des></scalar></key>
<key name="action" count="1"><scalar><des>
Either "create" or "update". This field isn't too useful, but you may want to make your client verbose and tell the user what it's doing. For example, "Downloading entry 5 of 17: Updated".
</des></scalar></key>
<key name="time" count="1"><scalar><des>
The server time (in the form "yyyy-mm-dd hh:mm:ss") that this creation or update took place. Remember in your local store the most recent for each item type ("L", "T", "C", etc...). This is what you send in subsequent requests in lastsync.
</des></scalar></key>
</struct></list></key>
<key name="count" count="1"><scalar><des>
The number of items that are contained in this response (numbered started at 1). If sync_count is equal to sync_total, then you can stop your sync after you complete fetching every item in this response.
</des></scalar></key>
<key name="total" count="1"><scalar><des>
The total number of items that have been updated since the time specified.
</des></scalar></key>
</struct></returns>
</method>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"docbook/dtd/xml/4.1.2/docbookx.dtd"
[
<!ENTITY ref SYSTEM "reference.gen">
]>
<book>
<title>xmlrpc ref test</title>
&ref;
</book>

View File

@@ -0,0 +1,108 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" indent="no"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="ljxmlrpc">
<reference>
<title>XML/RPC Protocol Reference</title>
<xsl:apply-templates/>
</reference>
</xsl:template>
<xsl:template match="method">
<refentry>
<refnamediv>
<refname><xsl:value-of select="@name"/></refname>
<refpurpose><xsl:value-of select="shortdes"/></refpurpose>
</refnamediv>
<refsect1>
<title>Mode Description</title>
<para>
<xsl:value-of select="des"/>
</para>
</refsect1>
<refsect1>
<title>Arguments</title>
<orderedlist>
<xsl:for-each select="arguments">
<xsl:apply-templates/>
</xsl:for-each>
</orderedlist>
</refsect1>
<refsect1>
<title>Return Values</title>
<orderedlist>
<xsl:for-each select="returns">
<xsl:apply-templates/>
</xsl:for-each>
</orderedlist>
</refsect1>
</refentry>
</xsl:template>
<xsl:template match="struct">
<listitem><para>
<emphasis>[struct]</emphasis>
<xsl:call-template name="count"/>
Containing keys:
<itemizedlist>
<xsl:for-each select="*">
<xsl:apply-templates select="."/>
</xsl:for-each>
</itemizedlist>
</para></listitem>
</xsl:template>
<xsl:template match="scalar">
<listitem><para>
<emphasis>[scalar]</emphasis>
<xsl:call-template name="count"/>
<xsl:value-of select="des"/>
</para></listitem>
</xsl:template>
<xsl:template match="key">
<listitem><para>
<emphasis role="bold"><xsl:value-of select="@name"/></emphasis>:
<itemizedlist>
<xsl:value-of select="./des"/>
<xsl:for-each select="*">
<xsl:apply-templates select="."/>
</xsl:for-each>
</itemizedlist>
</para></listitem>
</xsl:template>
<xsl:template match="list">
<listitem><para>
<emphasis>[list]</emphasis>
<xsl:call-template name="count"/>
<xsl:value-of select="des"/>
Containing items:
<itemizedlist>
<xsl:for-each select="scalar|struct|list">
<xsl:apply-templates select="."/>
</xsl:for-each>
</itemizedlist>
</para></listitem>
</xsl:template>
<xsl:template name="count">
<xsl:choose>
<xsl:when test="@count='1'">(required)</xsl:when>
<xsl:when test="@count='opt'">(optional)</xsl:when>
<xsl:when test="@count='1more'">(required; multiple allowed)</xsl:when>
<xsl:when test="@count='0more'">(optional; multiple allowed)</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,3 @@
<scalar count="1"><des>
Journal username that authenticating user has 'usejournal' access in, as given in the 'login' mode.
</des></scalar>

View File

@@ -0,0 +1,7 @@
<des>
List of shared/news/community journals that the user has permission
to post in.
</des>
<list count="1"><scalar count="0more"><des>
Username of community journal.
</des></scalar></list>

View File

@@ -0,0 +1,37 @@
<!-- the 'count' attribute indicates how many times it appears in its
parent container. either:
1 (once always),
opt (optionally once),
1more (1 or more times),
0more (0 or more times) -->
<!ENTITY % countatt "count (1|opt|1more|0more) '1'">
<!-- presence of keys are either there or optionally there,
can't be more than 1: -->
<!ENTITY % keycountatt "count (1|opt) '1'">
<!ELEMENT ljxmlrpc (method*)>
<!ELEMENT method (shortdes?, des?, arguments, returns)>
<!ATTLIST method name NMTOKEN #REQUIRED>
<!-- arguments and return both have a list of values, either structs, lists, or scalars -->
<!ELEMENT arguments (struct | list | scalar)*>
<!ELEMENT returns (struct | list | scalar)*>
<!ELEMENT scalar (des?)>
<!ATTLIST scalar %countatt;>
<!ELEMENT struct (key*)>
<!ATTLIST struct %countatt;>
<!ELEMENT key (des?, (scalar | struct | list))>
<!ATTLIST key name NMTOKEN #REQUIRED %keycountatt;>
<!ELEMENT list (des?, (struct | list | scalar)*)>
<!ATTLIST list %countatt;>
<!ELEMENT shortdes (#PCDATA)>
<!ELEMENT des (#PCDATA)>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0"?>
<!DOCTYPE ljxmlrpc SYSTEM "xmlrpc.dtd" [
<!ENTITY authInfo SYSTEM "authinfo.ent.xml">
<!ENTITY useJournals SYSTEM "usejournals.ent.xml">
<!ENTITY useJournal SYSTEM "usejournal.ent.xml">
<!ENTITY friendGroups SYSTEM "friendgroups.ent.xml">
<!ENTITY moods SYSTEM "moods.ent.xml">
<!ENTITY friendsList SYSTEM "friendslist.ent.xml">
<!ENTITY mode.checkfriends SYSTEM "checkfriends.mode.xml">
<!ENTITY mode.consolecommand SYSTEM "consolecommand.mode.xml">
<!ENTITY mode.editevent SYSTEM "editevent.mode.xml">
<!ENTITY mode.editfriendgroups SYSTEM "editfriendgroups.mode.xml">
<!ENTITY mode.editfriends SYSTEM "editfriends.mode.xml">
<!ENTITY mode.friendof SYSTEM "friendof.mode.xml">
<!ENTITY mode.getdaycounts SYSTEM "getdaycounts.mode.xml">
<!ENTITY mode.getevents SYSTEM "getevents.mode.xml">
<!ENTITY mode.getfriendgroups SYSTEM "getfriendgroups.mode.xml">
<!ENTITY mode.getfriends SYSTEM "getfriends.mode.xml">
<!ENTITY mode.login SYSTEM "login.mode.xml">
<!ENTITY mode.postevent SYSTEM "postevent.mode.xml">
<!ENTITY mode.syncitems SYSTEM "syncitems.mode.xml">
]>
<ljxmlrpc>
&mode.login;
&mode.postevent;
&mode.editevent;
&mode.editfriendgroups;
&mode.editfriends;
&mode.getevents;
&mode.getfriends;
&mode.friendof;
&mode.getfriendgroups;
&mode.getdaycounts;
&mode.syncitems;
&mode.checkfriends;
&mode.consolecommand;
</ljxmlrpc>