<refentry id="liblivejournal-serveruser">
<refmeta>
<refentrytitle>Servers and Users</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LIBLIVEJOURNAL Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Servers and Users</refname><refpurpose>Data structures representing LiveJournal servers and users.</refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>

<synopsis>



struct      <link linkend="LJServer">LJServer</link>;
struct      <link linkend="LJUser">LJUser</link>;
enum        <link linkend="LJAuthScheme">LJAuthScheme</link>;
<link linkend="LJServer">LJServer</link>*   <link linkend="lj-server-new">lj_server_new</link>                   (const char *url);
int         <link linkend="lj-server-get-last-cached-moodid">lj_server_get_last_cached_moodid</link>
                                            (<link linkend="LJServer">LJServer</link> *server);
#define     <link linkend="lj-server-unicode">lj_server_unicode</link>               (s)
<link linkend="LJUser">LJUser</link>*     <link linkend="lj-user-new">lj_user_new</link>                     (<link linkend="LJServer">LJServer</link> *server);
<link linkend="gint">gint</link>        <link linkend="lj-user-compare">lj_user_compare</link>                 (<link linkend="gconstpointer">gconstpointer</link> a,
                                             <link linkend="gconstpointer">gconstpointer</link> b);
#define     <link linkend="lj-mood-new">lj_mood_new</link>                     ()
#define     <link linkend="lj-mood-id-from-name">lj_mood_id_from_name</link>            (server, name)
#define     <link linkend="lj-mood-name-from-id">lj_mood_name_from_id</link>            (server, id)
#define     <link linkend="lj-mood-compare">lj_mood_compare</link>
#define     <link linkend="lj-friendgroup-new">lj_friendgroup_new</link>              ()
#define     <link linkend="lj-friendgroup-from-id">lj_friendgroup_from_id</link>          (user, id)
#define     <link linkend="lj-friend-group-free">lj_friend_group_free</link>
typedef     <link linkend="LJWebMenuItem">LJWebMenuItem</link>;
#define     <link linkend="lj-webmenuitem-new">lj_webmenuitem_new</link>              ()
void        <link linkend="lj-webmenu-free">lj_webmenu_free</link>                 (<link linkend="GSList">GSList</link> *menu);
</synopsis>
</refsynopsisdiv>







<refsect1>
<title>Description</title>
<para>

</para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="LJServer">struct LJServer</title>
<programlisting>struct LJServer {

	char *url;

	GSList *moods;

	int protocolversion;
	LJAuthScheme authscheme;
};
</programlisting>
<para>
A LiveJournal server.
</para><variablelist role="struct">
<varlistentry>
<term>char *<structfield>url</structfield></term>
<listitem><simpara>url to the LiveJournal installation on the server.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GSList">GSList</link> *<structfield>moods</structfield></term>
<listitem><simpara>a list of <link linkend="LJMood">LJMood</link>.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>int <structfield>protocolversion</structfield></term>
<listitem><simpara>protocol version to use on the server.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="LJAuthScheme">LJAuthScheme</link> <structfield>authscheme</structfield></term>
<listitem><simpara>

</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="LJUser">struct LJUser</title>
<programlisting>struct LJUser {

	LJServer *server;

	char *username;
	char *password;
	char *fullname;

	gboolean checkfriends;

	GSList *pickws;
	GSList *friendgroups;
	GSList *usejournals;
	GSList *webmenu;
};
</programlisting>
<para>
A LiveJournal user.  Fields other than <parameter>server</parameter>, <parameter>username</parameter>, and <parameter>password</parameter>
are provided by the server in the login mode.
</para><variablelist role="struct">
<varlistentry>
<term><link linkend="LJServer">LJServer</link> *<structfield>server</structfield></term>
<listitem><simpara>the <link linkend="LJServer">LJServer</link> this user is on.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>char *<structfield>username</structfield></term>
<listitem><simpara>the username.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>char *<structfield>password</structfield></term>
<listitem><simpara>the password.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>char *<structfield>fullname</structfield></term>
<listitem><simpara>the full name for this user.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="gboolean">gboolean</link> <structfield>checkfriends</structfield></term>
<listitem><simpara>
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GSList">GSList</link> *<structfield>pickws</structfield></term>
<listitem><simpara>a list of strings comprising the picture keywords for this user.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GSList">GSList</link> *<structfield>friendgroups</structfield></term>
<listitem><simpara>a list of <link linkend="LJFriendGroup">LJFriendGroup</link>.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GSList">GSList</link> *<structfield>usejournals</structfield></term>
<listitem><simpara>a list of journal usernames this user can post in.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GSList">GSList</link> *<structfield>webmenu</structfield></term>
<listitem><simpara>a list of <link linkend="LJWebMenuItem">LJWebMenuItem</link>.

</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="LJAuthScheme">enum LJAuthScheme</title>
<programlisting>typedef enum {
	LJ_AUTH_SCHEME_UNKNOWN,
	LJ_AUTH_SCHEME_NONE, /* we use md5 passwords by default.
	                        they're replayable, but at least you're not sending
	                        in plaintext. */
	LJ_AUTH_SCHEME_C0, /* challenge/response.
	                      http://www.livejournal.com/~lj_dev/599743.html. */
	LJ_AUTH_SCHEME_OTHER /* for authschemes we don't know about yet. */
} LJAuthScheme;
</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="lj-server-new">lj_server_new ()</title>
<programlisting><link linkend="LJServer">LJServer</link>*   lj_server_new                   (const char *url);</programlisting>
<para>
Create a new <link linkend="LJServer">LJServer</link>.
</para><variablelist role="params">
<varlistentry><term><parameter>url</parameter>&nbsp;:</term>
<listitem><simpara>url to the LiveJournal installation on the server.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>a new <link linkend="LJServer">LJServer</link>.


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="lj-server-get-last-cached-moodid">lj_server_get_last_cached_moodid ()</title>
<programlisting>int         lj_server_get_last_cached_moodid
                                            (<link linkend="LJServer">LJServer</link> *server);</programlisting>
<para>
Get the last moodid in the mood list of <parameter>server</parameter>.  Used in the login mode
to only retrieve new moodids.
</para><variablelist role="params">
<varlistentry><term><parameter>server</parameter>&nbsp;:</term>
<listitem><simpara>an <link linkend="LJServer">LJServer</link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>integer moodid.


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="lj-server-unicode">lj_server_unicode()</title>
<programlisting>#define lj_server_unicode(s) ((s)-&gt;protocolversion &gt; 0)
</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>s</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="lj-user-new">lj_user_new ()</title>
<programlisting><link linkend="LJUser">LJUser</link>*     lj_user_new                     (<link linkend="LJServer">LJServer</link> *server);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>server</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="lj-user-compare">lj_user_compare ()</title>
<programlisting><link linkend="gint">gint</link>        lj_user_compare                 (<link linkend="gconstpointer">gconstpointer</link> a,
                                             <link linkend="gconstpointer">gconstpointer</link> b);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>a</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>b</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="lj-mood-new">lj_mood_new()</title>
<programlisting>#define lj_mood_new() g_new0(LJMood, 1)
</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="lj-mood-id-from-name">lj_mood_id_from_name()</title>
<programlisting>#define lj_mood_id_from_name(server, name) _lj_nid_by_name(server-&gt;moods, name)
</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>server</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>name</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="lj-mood-name-from-id">lj_mood_name_from_id()</title>
<programlisting>#define lj_mood_name_from_id(server, id) _lj_nid_by_id(server-&gt;moods, id)
</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>server</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>id</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="lj-mood-compare">lj_mood_compare</title>
<programlisting>#define lj_mood_compare _lj_nid_compare_alpha
</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="lj-friendgroup-new">lj_friendgroup_new()</title>
<programlisting>#define lj_friendgroup_new() g_new0(LJFriendGroup, 1)
</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="lj-friendgroup-from-id">lj_friendgroup_from_id()</title>
<programlisting>#define lj_friendgroup_from_id(user, id) _lj_nid_by_id(user-&gt;friendgroups, id)
</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>user</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>id</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="lj-friend-group-free">lj_friend_group_free</title>
<programlisting>#define lj_friend_group_free _lj_nid_free
</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="LJWebMenuItem">LJWebMenuItem</title>
<programlisting>typedef struct {
	char *text;
	char *url;
	GSList *subitems;
} LJWebMenuItem;
</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="lj-webmenuitem-new">lj_webmenuitem_new()</title>
<programlisting>#define lj_webmenuitem_new() g_new0(LJWebMenuItem, 1)
</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="lj-webmenu-free">lj_webmenu_free ()</title>
<programlisting>void        lj_webmenu_free                 (<link linkend="GSList">GSList</link> *menu);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>menu</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
