<?xml version="1.0" encoding="utf-8"?>
<service name="bebo"
         version="$Id: bebo.xml 22415 2009-04-29 08:01:17Z justin $"
         xmlns="http://www.flock.com/web-detective#">

  <strings>
    <string name="domains" value="bebo.com,my.screenname.aol.com" />
    <string name="homePageURL" locale="default">
      <![CDATA[http://www.bebo.com/]]>
    </string>
    <string name="loginURL" locale="default">
      <![CDATA[http://www.bebo.com/SignIn.jsp]]>
    </string>
    <string name="endpoint">
      <![CDATA[http://api.bebo.com/restserver.php]]>
    </string>
    <string name="authTokenEndpoint">
      <![CDATA[http://www.bebo.com]]>
    </string>
    <string name="inviteFriendsURL">
      <![CDATA[http://www.bebo.com/Invite.jsp]]>
    </string>
    <string name="profileURL">
      <![CDATA[http://www.bebo.com/Profile.jsp?MemberId=%userId%]]>
    </string>
    <string name="topPhotosUid">
      <![CDATA[7819682324]]>
    </string>
    <!-- Friend Card -->
    <string name="friendViewProfile">
      <![CDATA[newtab:http://www.bebo.com/Profile.jsp?MemberId=%friendid%]]>
    </string>
    <string name="friendMessage">
      <![CDATA[newtab:http://www.bebo.com/mail/MailCompose.jsp?ToMemberId=%friendid%]]>
    </string>
    <string name="friendDrawWB">
      <![CDATA[newtab:http://www.bebo.com/WhiteBoardPostDraw1.jsp?MemberId=%friendid%]]>
    </string>
    <string name="friendWriteWB">
      <![CDATA[newtab:http://www.bebo.com/WhiteBoardPostWrite.jsp?MemberId=%friendid%]]>
    </string>
    <string name="friendViewBands">
      <![CDATA[mediaquery:userdefined:bands]]>
    </string>
    <string name="friendShareFlock">
      <![CDATA[method:shareFlock]]>
    </string>
    <string name="meMessages_URL">
      <![CDATA[http://www.bebo.com/mail/Mail.jsp]]>
    </string>
    <string name="meFriendRequests_URL">
      <![CDATA[http://www.bebo.com/Pending.jsp]]>
    </string>
    <!-- Access to Message Form -->
    <string name="bebomail_URL">
      <![CDATA[http://www.bebo.com/mail/MailCompose.jsp?ToMemberId=%friendid%]]>
    </string>
    <string name="bebomail_subjectXPath">
      <![CDATA[//div[@id="mail"]//form[@id="mainForm"]//input[@name="Subject"]]]>
    </string>
    <string name="bebomail_bodyXPath">
      <![CDATA[//div[@id="mail"]//form[@id="mainForm"]//textarea[@name="Message"]]]>
    </string>
    <!-- Access to Post Link Form (Bebo "saying") -->
    <string name="bebosay_URL">
      <![CDATA[http://www.bebo.com/Saying.jsp?From=Home&MemberId=%userId%]]>
    </string>
    <string name="bebosay_textXPath">
      <![CDATA[//div[@class="mod"]//form//textarea[@name="SayingTx"]]]>
    </string>
    <!-- Write on White Board -->
    <string name="dndXPathFields">
      <![CDATA[bebomail_bodyXPath,text/unicode;beboWhiteboard_bodyXPath,text/unicode]]>
    </string>
    <string name="beboWhiteboard_bodyXPath">
      <![CDATA[//div[@id="form"]//textarea[@name="MessageTx"]]]>
    </string>
  </strings>

  <sessioncookies>
    <cookie host=".bebo.com" name="bdaysession" path="/" />
    <cookie host=".aol.com" name="SNS_AA" path="/" />
    <cookie host=".bebo.com" name="Password" path="/" />
  </sessioncookies>

  <detect type="login">
    <url domain="bebo.com" />
    <form>
      <field tagname="input" fieldid="username" extractas="username" />
      <field tagname="input" fieldid="password" type="password" extractas="password" />
    </form>
  </detect>
  <detect type="login">
    <url domain="bebo.com" />
    <form>
      <xpath name="username" extract="value">
        <![CDATA[//input[@name="EmailUsername"]]]>
      </xpath>
      <xpath name="password" extract="value">
        <![CDATA[//input[@name="Password"]]]>
      </xpath>
    </form>
  </detect>
  <detect type="login">
    <url domain="bebo.com">
      <path contains="SignIn.jsp" />
    </url>
    <form>
      <field tagname="input" fieldid="EmailUsername" extractas="username" />
      <field tagname="input" fieldid="Password" type="password" extractas="password" />
    </form>
  </detect>
  <!-- Sign in with AOL/AIM SNS -->
  <detect type="login">
    <url domain="my.screenname.aol.com">
      <path contains="login.psp" />
      <path contains="sitedomain=www.bebo.com" />
    </url>
    <form>
      <field tagname="input" fieldid="lgnId1" extractas="username" />
      <field tagname="input" fieldid="pwdId1" type="password" extractas="password" />
    </form>
  </detect>

  <detect type="signup">
    <url domain="bebo.com">
      <path contains="InviteJoin.jsp" />
    </url>
    <form>
      <field tagname="input" name="Email" extractas="username" />
      <field tagname="input" name="Password" type="password" extractas="password" />
    </form>
  </detect>

  <detect type="loggedin">
    <url domain="bebo.com">
      <path notcontains="c/account/sign_out" />
    </url>
    <xpath>
      <![CDATA[//div[@class="logged-in"]//a[contains(@href,"/c/account/sign_out")]]]>
    </xpath>
  </detect>
  <detect type="loggedin">
    <url domain="bebo.com">
      <path notcontains="c/account/sign_out" />
    </url>
    <xpath>
      <![CDATA[//div[@id="global-nav"]//a[contains(@href,"/c/account/sign_out")]]]>
    </xpath>
  </detect>

  <detect type="loggedincookies">
    <cookie host=".bebo.com" name="Password" re1="password">
      <![CDATA[/^(.*)$/]]>
    </cookie>
  </detect>

  <detect type="loggedout">
    <url domain="bebo.com">
      <path contains="PleaseSignIn.jsp" />
    </url>
    <xpath>
      <![CDATA[//body[@id="PleaseSignIn_jsp"]]]>
    </xpath>
  </detect>
  <detect type="loggedout">
    <url domain="bebo.com">
      <path contains="c/account/sign_out" />
    </url>
    <xpath>
      <![CDATA[//div[@id="main-container"]//a[contains(@href,"/SignIn.jsp")]]]>
    </xpath>
  </detect>
  <!-- Sign out when logged in with AOL/AIM SNS -->
  <detect type="loggedout">
    <url domain="bebo.com">
      <path contains="c/account/aol_sns_return" />
    </url>
    <xpath>
      <![CDATA[//div[@id="main-container"]//a[contains(@href,"/SignIn.jsp")]]]>
    </xpath>
  </detect>

  <detect type="accountinfo">
    <regexp re1="accountid">
      <![CDATA[/"Member":{"id":"(\d+)"/]]>
    </regexp>
  </detect>

  <detect type="person">
    <conditions>
      <url domain="bebo.com">
        <path contains="/Profile.jsp?MemberId=" />
      </url>
    </conditions>
    <results>
      <document>
        <xpath extract="attribute:href">
          <![CDATA[//div[@id="profile_nav"]//a[@class="profile_tab_active"]]]>
          <regexp re1="userid">
            <![CDATA[/MemberId=(.+)/]]>
          </regexp>
        </xpath>
        <!-- Get the user name for built-ins, like "Top Photos" -->
        <xpath name="username" extract="#text">
          <![CDATA[//div[@class="profilePagetitle"]/span]]>
        </xpath>
        <!-- Get the user name for normal users; must come second -->
        <xpath name="username" extract="#text">
          <![CDATA[//div[@class="profilePagetitle"]]]>
        </xpath>
      </document>
    </results>
  </detect>

  <detect type="isStreamUrl">
    <regexp><![CDATA[/^https?:\/\/[^\.]*\.bebo\.com\/.+\/large\/.+\.jpg$/]]></regexp>
  </detect>

  <detect type="statustoken">
    <regexp re1="token">
      <![CDATA[/value="(.+)" id="bcrumb"/]]>
    </regexp>
  </detect>

  <detect type="sayingid">
    <regexp re1="sayingid">
      <![CDATA[/<a href="SayingDelete\.jsp\?From=Profile&SayingId=(.*)">/]]>
    </regexp>
  </detect>

</service>
