<?xml version="1.0" encoding="utf-8"?>
<service name="gmail"
         version="$Id: gmail.xml 21376 2008-12-11 01:34:40Z justin $"
         xmlns="http://www.flock.com/web-detective#">

  <strings>
    <string name="domains" value="google.com" />
    <string name="composerFrameName_v1" value="main" />
    <string name="composerIFrame1Id_v1" value="v1" />
    <string name="composerIFrame2Id_v1" value="hc_compose" />
    <string name="composerIFrame1Id_v2" value="canvas_frame" />
    <string name="composeURL_v1">
      <![CDATA[https://mail.google.com/mail/?ui=1&view=cm&fs=1&%params%]]>
    </string>
    <string name="composeURL_v2">
      <![CDATA[https://mail.google.com/mail/?ui=2&%params%#compose]]>
    </string>
    <string name="composeParams" value="subject=su" />
    <string name="inboxURL">
      <![CDATA[https://mail.google.com/mail/#inbox]]>
    </string>
    <string name="onComposeURLLoadedVersion2" value="all" />
    <string name="refreshUnreadMessageListDelay" value="6000" />
    <string name="unreadQuery">
      <![CDATA[/?search=query&q=is%3Aunread&view=tl&start=0&init=1&ui=1]]>
    </string>
    <string name="dndXPathFields">
      <![CDATA[v1PlainComposerXPath,text/unicode;v2PlainComposerXPath,text/unicode]]>
    </string>
    <string name="v1PlainComposerXPath">
      <![CDATA[//textarea[@id="ta_compose"]]]>
    </string>
    <string name="v2PlainComposerXPath">
      <![CDATA[//form/div/table//div//textarea]]>
    </string>
    <string name="homePageURL" locale="default">
      <![CDATA[https://mail.google.com/]]>
    </string>
    <string name="inboxDataPacketRegExp">
      <![CDATA[D\(\["ds",[\s\S]*?\]\n\);\n]]>
    </string>
    <string name="messageDataPacketRegExp">
      <![CDATA[D\(\["t",[\s\S]*?\]\n\);\n]]>
    </string>
    <string name="inboxCountRegExp">
      <![CDATA[\["inbox",(\d+)\]]]>
    </string>
    <string name="messageRegExp">
      <![CDATA[(\["t",[\s\S]*?\])\n\);]]>
    </string>
  </strings>

  <sessioncookies>
    <cookie host="www.google.com" name="LSID" path="/accounts"/>
    <cookie host=".mail.google.com" name="GX" path="/mail"/>
    <cookie host=".google.com" name="SID" path="/"/>
  </sessioncookies>

  <detect type="composerFrame_v1">
    <xpath>
      <![CDATA[//frame[@name="main"]]]>
    </xpath>
  </detect>

  <detect type="composerIFrame1_v1">
    <xpath>
      <![CDATA[//iframe[@id="v1"]]]>
    </xpath>
  </detect>

  <detect type="composerIFrame2_v1">
    <xpath>
      <![CDATA[//iframe[@id="hc_compose"]]]>
    </xpath>
  </detect>

  <detect type="composerBody_v1">
    <xpath>
      <![CDATA[//body//text()[string-length(.)>0]]]>
    </xpath>
  </detect>

  <detect type="composerIFrame1_v2">
    <xpath>
      <![CDATA[//iframe[@id="canvas_frame"]]]>
    </xpath>
  </detect>

  <detect type="composerForm_v2">
    <xpath>
      <![CDATA[//form]]>
    </xpath>
  </detect>

  <detect type="composerTo_v2">
    <xpath name="to" extract="this">
      <![CDATA[//form/table//textarea[@name="to"]]]>
    </xpath>
  </detect>

  <detect type="composerCc_v2">
    <xpath name="cc" extract="this">
      <![CDATA[//form/table//textarea[@name="cc"]]]>
    </xpath>
  </detect>

  <detect type="composerAddCc_v2">
    <xpath name="add_cc" extract="this">
      <![CDATA[//form/table/tbody/tr[3]/td[1]/span[0]]]>
    </xpath>
  </detect>

  <detect type="composerBcc_v2">
    <xpath name="bcc" extract="this">
      <![CDATA[//form/table//textarea[@name="bcc"]]]>
    </xpath>
  </detect>

  <detect type="composerAddBcc_v2">
    <xpath name="add_bcc" extract="this">
      <![CDATA[//form/table/tbody/tr[3]/td[1]/span[1]]]>
    </xpath>
  </detect>

  <detect type="composerSubject_v2">
    <xpath name="subject" extract="this">
      <![CDATA[//form/table//input[@name="subject"]]]>
    </xpath>
  </detect>

  <detect type="composerEditor_v2"> <!-- Rich -->
    <xpath name="node" extract="this">
      <![CDATA[//form/div/table//td/div[not(contains(@style,"display: none"))]//iframe]]>
    </xpath>
  </detect>

  <detect type="composerEditor_v2"> <!-- Plain -->
    <xpath name="node" extract="this">
      <![CDATA[//form/div/table//td/div[not(contains(@style,"display: none"))]//textarea]]>
    </xpath>
  </detect>

  <detect type="composerBody_v2">
    <xpath>
      <![CDATA[//body//br]]>
    </xpath>
  </detect>

  <detect type="signup">
    <url domain="google.com">
      <path contains="/accounts/NewAccount" />
      <querystring contains="service=mail" />
    </url>
    <form>
      <xpath name="username" extract="value">
        <![CDATA[//input[@id="Email"]]]>
      </xpath>
      <xpath name="password" extract="value">
        <![CDATA[//input[@type="password"][@name="PasswdAgain"]]]>
      </xpath>
    </form>
  </detect>

  <detect type="login">
    <url domain="google.com">
      <path contains="/accounts/ServiceLogin" />
      <querystring contains="service=mail" />
    </url>
    <form>  
      <xpath name="username" extract="value">
        <![CDATA[//input[@id="Email"]]]>
      </xpath>
      <xpath name="password" extract="value">
        <![CDATA[//input[@id="Passwd"]]]>
      </xpath>
    </form> 
  </detect>

  <detect type="loggedin">
    <url domain="mail.google.com" />
    <regexp>
      <![CDATA[/\["ui",".+@g(?:|oogle)mail\.com",/]]>
    </regexp>
  </detect>

  <detect type="loggedin">
    <url domain="mail.google.com" />
    <regexp>
      <![CDATA[/USER_EMAIL:".+@g(?:|oogle)mail\.com",/]]>
    </regexp>
  </detect>

  <detect type="loggedin">
    <url domain="mail.google.com" />
    <regexp>
      <![CDATA[/USER_EMAIL:'.+@g(?:|oogle)mail\.com'/]]>
    </regexp>
  </detect>

  <detect type="loggedin"><!-- Older or non-en-US version -->
    <url domain="mail.google.com" />
    <regexp>
      <![CDATA[/USER_EMAIL = '.+@g(?:|oogle)mail\.com'/]]>
    </regexp>
  </detect>

  <detect type="loggedin"><!-- Older or non-en-US version -->
    <url domain="mail.google.com" />
    <xpath>
      <![CDATA[//div[@id="guser"]//b/text()]]>
    </xpath>
  </detect>

  <detect type="loggedin"><!-- Older or non-en-US version -->
    <url domain="mail.google.com" />
    <regexp>
      <![CDATA[/><b>.+@g(?:|oogle)mail\.com<\/b> \| <span class="setl" id="prf_g">/]]>
    </regexp>
  </detect>

  <detect type="loggedin">
    <url domain="mail.google.com" />
    <regexp>
      <![CDATA[/><b>.+@g(?:|oogle)mail\.com<\/b> \| <span id=/]]>
    </regexp>
  </detect>

  <detect type="loggedin"><!-- Data Packet -->
    <url domain="mail.google.com" />
    <regexp>
      <![CDATA[/D\(\["ui",".+@g(?:|oogle)mail\.com","(.+)","g(?:|oogle)mail\.com"/]]>
    </regexp>
  </detect>

  <detect type="loggedoutCookies">
    <cookie nomatch="true" host=".mail.google.com" name="GX" />
  </detect>

  <detect type="loggedout">
    <url domain="www.google.com">
      <path contains="/accounts/ServiceLogin" />
      <querystring contains="service=mail" />
    </url>
    <xpath><![CDATA[//input[@id="Passwd"]]]></xpath>
  </detect>

  <detect type="accountinfo">
    <url domain="mail.google.com" />
    <regexp re1="email" re2="accountid">
      <![CDATA[/\["ui","((.+)@g(?:|oogle)mail\.com)",/]]>
    </regexp>
  </detect>

  <detect type="accountinfo">
    <url domain="mail.google.com" />
    <regexp re1="email" re2="accountid">
      <![CDATA[/USER_EMAIL:"((.+)@g(?:|oogle)mail\.com)",/]]>
    </regexp>
  </detect>

  <detect type="accountinfo">
    <url domain="mail.google.com" />
    <regexp re1="email" re2="accountid">
      <![CDATA[/USER_EMAIL:'((.+)@g(?:|oogle)mail\.com)'/]]>
    </regexp>
  </detect>

  <detect type="accountinfo"><!-- Older or non-en-US version -->
    <url domain="mail.google.com" />
    <regexp re1="email" re2="accountid">
      <![CDATA[/USER_EMAIL = '((.+)@g(?:|oogle)mail\.com)'/]]>
    </regexp>
  </detect>

  <detect type="accountinfo"><!-- Older or non-en-US version -->
    <url domain="mail.google.com" />
    <xpath>
      <![CDATA[//div[@id="guser"]//b/text()]]>
      <regexp re1="email" re2="accountid">
        <![CDATA[/((.+)@g(?:|oogle)mail\.com)/]]>
      </regexp>
    </xpath>
  </detect>

  <detect type="accountinfo"><!-- Older or non-en-US version -->
    <url domain="mail.google.com" />
    <regexp re1="email" re2="accountid">
      <![CDATA[/><b>((.+)@g(?:|oogle)mail\.com)<\/b> \| <span class="setl" id="prf_g">/]]>
    </regexp>
  </detect>

  <detect type="accountinfo">
    <url domain="mail.google.com" />
    <regexp re1="email" re2="accountid">
      <![CDATA[/><b>((.+)@g(?:|oogle)mail\.com)<\/b> \| <span id=/]]>
    </regexp>
  </detect>

  <detect type="accountinfo"><!-- Data Packet -->
    <url domain="mail.google.com" />
    <regexp re1="email" re2="accountid">
      <![CDATA[/D\(\["ui","((.+)@g(?:|oogle)mail\.com)",/]]>
    </regexp>
  </detect>

  <detect type="ownsDocument">
    <url domain="mail.google.com" />
  </detect>

  <detect type="ownsDocument">
    <url domain="google.com">
      <querystring contains="service=mail" />
    </url>
  </detect>

  <detect type="uiVersion2">
    <url domain="mail.google.com" />
    <xpath>
      <![CDATA[//iframe[@id="canvas_frame"]]]>
    </xpath>
  </detect>

</service>
