<?xml version="1.0" encoding="utf-8"?>
<service name="livejournal"
         version="$Id: livejournal.xml 22667 2009-07-03 23:59:47Z campbell $"
         xmlns="http://www.flock.com/web-detective#">

  <strings>
    <string name="domains" value="livejournal.com"/>
    <string name="userprofile">
      <![CDATA[http://%accountid%.livejournal.com/profile]]>
    </string>
    <string name="editprofile">
      <![CDATA[http://www.livejournal.com/manage/profile/]]>
    </string>
    <string name="userblog">
      <![CDATA[http://%accountid%.livejournal.com/]]>
    </string>
    <string name="userfriends">
      <![CDATA[http://%accountid%.livejournal.com/friends]]>
    </string>
    <string name="userphotos">
      <![CDATA[http://pics.livejournal.com/%accountid%]]>
    </string>
    <string name="userpics">
      <![CDATA[http://www.livejournal.com/allpics.bml?user=%accountid%]]>
    </string>
    <string name="userfoaf">
      <![CDATA[http://www.livejournal.com/users/%accountid%/data/foaf]]>
    </string>
    <string name="homePageURL" locale="default">
      <![CDATA[http://www.livejournal.com/]]>
    </string>
  </strings>

  <sessioncookies>
    <cookie host=".livejournal.com" name="ljloggedin" path="/"/>
    <cookie host=".livejournal.com" name="ljsession" path="/"/>
  </sessioncookies>

  <detect type="login">
    <url domain="livejournal.com"/>
    <form>
      <field tagname="input" name="user" extractas="username"/>
      <field tagname="input" name="password"/>
    </form>
  </detect>

  <detect type="signup">
    <url domain="livejournal.com"><path contains="create"/></url>
    <form>
      <field tagname="input" fieldid="create_user" extractas="username" />
      <field tagname="input" fieldid="create_password2" type="password" extractas="password" />
    </form>
  </detect>

  <detect type="loggedin">
    <!-- Final page in the account setup wizard -->
    <xpath><![CDATA[//a[contains(@href,"manage/profile")]]]></xpath>
  </detect>

  <detect type="loggedin">
    <xpath><![CDATA[//form[@id="Greeting"][contains(@action,"logout")]]]></xpath>
  </detect>

  <detect type="loggedin">
    <xpath><![CDATA[//div/div/div//div[@id="WelcomeLinks"]/a/text()[contains(.,"Logout")]]]></xpath>
  </detect>

  <detect type="loggedout">
    <xpath><![CDATA[//form[@id="login"]]]></xpath>
  </detect>

  <detect type="loggedoutcookies">
    <cookie nomatch="true" host=".livejournal.com" name="ljloggedin" />
  </detect>

  <detect type="accountinfo">
    <!-- Final page in the account setup wizard -->
    <xpath>
      <![CDATA[//div[@class="welcomebox"]//a[contains(@href,".livejournal.com")]]]>
      <regexp re1="accountid"><![CDATA[/http:\/\/(.*).livejournal.com/]]></regexp>
    </xpath>
  </detect>

  <detect type="accountinfo">
    <xpath>
      <![CDATA[//form[@id="Greeting"][contains(@action,"logout")]//input[@name="user"]/@value]]>
      <regexp re1="accountid"><![CDATA[/(.*)/]]></regexp>
    </xpath>
  </detect>

  <detect type="accountinfo">
    <conditions>
      <xpath><![CDATA[//div/div/div//div[@id="WelcomeLinks"]/a[contains(@href,"/logout.bml?user=")]]]></xpath>
    </conditions>
    <results>
      <regexp re1="accountid">
        <![CDATA[/logout.bml\?user=([^&]+)&/]]>
      </regexp>
    </results>
  </detect>

  <detect type="person">
    <url>
      <regexp re1="friendrequest">
        <![CDATA[/http...(\w+)/]]>
      </regexp>
    </url>
  </detect>

</service>
