<?xml version="1.0" encoding="utf-8"?>
<service name="digg"
         version="$Id: digg.xml 21361 2008-12-09 22:30:48Z justin $"
         xmlns="http://www.flock.com/web-detective#">

  <strings>
    <string name="domains" value="digg.com" />
    <string name="diggmessage_sendXPath">
      <![CDATA[//form[@id="send-shout"]//textarea[@id="shout"]]]>
    </string>
    <string name="trackingCode">
      <![CDATA[otc-fl]]>
    </string>
    <string name="profileURL">
      <![CDATA[http://digg.com/users/%accountid%]]>
    </string>
    <string name="friendActivityURL">
      <![CDATA[http://digg.com/users/%accountid%/friends]]>
    </string>
    <string name="inviteFriendsURL">
      <![CDATA[http://digg.com/users/%accountid%/friends/add]]>
    </string>
    <string name="submitUrl">
      <![CDATA[http://digg.com/submit?phase=2&url=%url%]]>
    </string>
    <!-- friend actions -->
    <string name="friendShout">
      <![CDATA[newtab:http://digg.com/users/%friendid%#send-shout]]>
    </string>
    <string name="friendDiggs">
      <![CDATA[newtab:http://digg.com/users/%friendid%/history/diggs]]>
    </string>
    <string name="friendComments">
      <![CDATA[newtab:http://digg.com/users/%friendid%/history/comments]]>
    </string>
    <string name="friendSubmissions">
      <![CDATA[newtab:http://digg.com/users/%friendid%/history/submissions]]>
    </string>
    <string name="friendFavorites">
      <![CDATA[newtab:http://digg.com/users/%friendid%/history/favorites]]>
    </string>
    <string name="friendGallery">
      <![CDATA[newtab:http://digg.com/users/%friendid%/gallery]]>
    </string>
    <string name="friendShareFlock" 
            value="method:flockIDiggAccount:shareFlock" />
    <string name="shareAction_shout"
            value="method:flockIDiggAccount:diggShout" />
    <!-- me notification URLs -->
    <string name="meMessages_URL">
      <![CDATA[http://digg.com/users/%accountid%/friends/shoutsin]]>
    </string>
    <string name="meComments_URL">
      <![CDATA[http://digg.com/users/%accountid%/friends/comments]]>
    </string>
    <!-- DnD fields -->
    <string name="dndXPathFields">
      <![CDATA[shoutXPath,text/unicode;commentXPath,text/unicode;commentReplyXPath,text/unicode]]>
    </string>
    <string name="shoutXPath">
      <![CDATA[//textarea[@id="shout"]]]>
    </string>
    <string name="commentXPath">
      <![CDATA[//div[@id="comment-reply"]//textarea]]>
    </string>
    <string name="commentReplyXPath">
      <![CDATA[//div[contains(@id, "c-reply-c")]//textarea]]>
    </string>
    <string name="homePageURL" locale="default">
      <![CDATA[http://digg.com/]]>
    </string>
    <string name="loginURL" locale="default">
      <![CDATA[http://digg.com/login]]>
    </string>
  </strings>

  <sessioncookies>
    <cookie host="digg.com" name="PHPSESSID" path="/" />
    <cookie host="digg.com" name="loginname" path="/" />
  </sessioncookies>

  <detect type="login">
    <url domain="digg.com"></url>
    <form>
      <xpath name="username" extract="value">
        <![CDATA[//input[contains(@class, "login-digg-username")]]]>
      </xpath>
      <xpath name="password" extract="value">
        <![CDATA[//input[contains(@class, "login-digg-password")]]]>
      </xpath>
    </form>
  </detect>

  <!-- Matches on digg.com/login -->
  <detect type="login">
    <url domain="digg.com"><path contains="/login" /></url>
    <form>
      <field tagname="input" fieldid="name" extractas="username" />
      <field tagname="input" fieldid="password" extractas="password" />
    </form>
  </detect>

  <!-- Matches for the header login form found on most pages -->
  <detect type="login">
    <form>
      <field tagname="input" fieldid="side-username" extractas="username" />
      <field tagname="input" fieldid="side-password" extractas="password" />
    </form>
  </detect>

  <!-- Matches on digg.com/remote-login -->
  <detect type="login">
    <url domain="digg.com"><path contains="/remote-login" /></url>
    <form>
      <field tagname="input" fieldid="username" extractas="username" />
      <field tagname="input" fieldid="password" extractas="password" />
    </form>
  </detect>

  <detect type="signup">
    <url domain="digg.com"><path contains="/register" /></url>
    <form>
      <field tagname="input" fieldid="username" extractas="username" />
      <field tagname="input" fieldid="password" extractas="password" />
    </form>
  </detect>

  <detect type="signup">
    <url domain="digg.com" />
    <form>
      <xpath name="username" extract="value">
        <![CDATA[//input[@name="username"]]]>
      </xpath>
      <xpath name="password" extract="value">
        <![CDATA[//input[contains(@name, "password")]]]>
      </xpath>
    </form>
  </detect>

  <detect type="changepassword">
    <url domain="digg.com"><path contains="/settings/password" /></url>
    <document>
      <xpath name="username" extract="attribute:alt">
        <![CDATA[//a[@id="section-profile"]/img]]>  
      </xpath>
    </document>
    <form>
      <field tagname="input" fieldid="new1" extractas="password" />
    </form>
  </detect>

  <detect type="loggedin">
    <xpath><![CDATA[//a[@class="sign-out"]]]></xpath>
  </detect>

  <detect type="accountinfo">
    <xpath name="accountid" extract="attribute:alt">
      <![CDATA[//a[@id="section-profile"]/img]]>
    </xpath>
  </detect>

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

  <detect type="loggedout">
    <xpath><![CDATA[//a[@id="header-login"]]]></xpath>
  </detect>
 
  <detect type="shouts">
    <regexp re1="shoutCount">
      <![CDATA[/<a .* href=".*\/shoutsin">\((\d+) .*/]]>
    </regexp>
  </detect>

  <!-- Possibly obsolete as of 2008-09-12 -->
  <detect type="shouts">
    <regexp re1="shoutCount">
      <![CDATA[/<a href=".*\/shoutsin"><em>(\d+) .*/]]>
    </regexp>
  </detect>

  <detect type="loggedoutcookies">
    <cookie nomatch="true" host="digg.com" name="loginname" path="/" />
  </detect>

  <!-- media detection -->
  <detect type="person">
    <!-- http://digg.com/users/joeuser -->
    <url domain="digg.com">
      <regexp re1="userid">
        <![CDATA[/users\/([^\/#]+)/]]>
      </regexp>
    </url>
  </detect>

</service>
