<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE widget SYSTEM "gmail.dtd"><widget xmlns:f="http://bar.yandex.ru/dev/functional" icon="gmailsend.png" name="&gmail.name;" unique="false" xmlns="http://bar.yandex.ru/dev/gui">
    <f:setting default="true" name="show_label" scope="widget">
        <control label="&gmail.write.settings.checktext;" type="checkbox"/>
    </f:setting>
    <f:data name="cookie_name_1">
        <f:cookie>
            <f:value type="string">https://mail.google.com/mail/u/0</f:value>
            <f:value type="string">gmailchat</f:value>
            <f:value type="bool">true</f:value>
        </f:cookie>
    </f:data>
    <f:data name="cookie_name_2">
        <f:cookie>
            <f:value type="string">https://google.com/</f:value>
            <f:value type="string">GAUSR</f:value>
            <f:value type="bool">true</f:value>
        </f:cookie>
    </f:data>
    <f:data name="username1">
        <f:try>
            <f:regex-search>
                <f:value type="string">([^@]+@.*?)/</f:value>
                <f:value-of name="cookie_name_1"/>
            </f:regex-search>
            <f:param name="...">
                <f:value type="empty"/>
            </f:param>
        </f:try>
    </f:data>
    <f:data name="username2">
        <f:try>
            <f:regex-search>
                <f:value type="string">\:([^@]+@.+\..+)</f:value>
                <f:value-of name="cookie_name_2"/>
            </f:regex-search>
            <f:param name="...">
                <f:value type="empty"/>
            </f:param>
        </f:try>
    </f:data>
    <f:data name="username">
        <f:if>
            <f:is-empty>
                <f:value-of name="username1"/>
            </f:is-empty>
            <f:if>
                <f:is-empty>
                    <f:value-of name="username2"/>
                </f:is-empty>
                <f:value type="empty"/>
                <f:value-of name="username2"/>
            </f:if>
            <f:value-of name="username1"/>
        </f:if>
    </f:data>
    <f:data name="mail_cookie">
        <f:cookie>
            <f:value type="string">https://mail.google.com/mail/</f:value>
            <f:value type="string">GX</f:value>
            <f:value type="bool">true</f:value>
        </f:cookie>
    </f:data>
    <f:data name="is_logged">
        <f:not>
            <f:is-empty>
                <f:value-of name="mail_cookie"/>
            </f:is-empty>
        </f:not>
    </f:data>
    <button>
        <url>
            <f:if>
                <f:value-of name="is_logged"/>
                <f:value type="string">&gmail.write_letter.url;</f:value>
                <f:value type="string">&gmail.notlogged.url;</f:value>
            </f:if>
        </url>
        <icon>
            <f:if>
                <f:value-of name="is_logged"/>
                <f:value type="string">gmailsend.png</f:value>
                <f:value type="string">gmailsendlock.png</f:value>
            </f:if>
        </icon>
        <text>
            <f:if>
                <f:value-of name="show_label"/>
                <f:value type="string">&gmail.write;</f:value>
                <f:value type="string"/>
            </f:if>
        </text>
        <f:optional>
            <f:not>
                <f:value-of name="is_logged"/>
            </f:not>
            <tooltip>
                <grid>
                    <row>
                        <cell>&gmail.write.tooltip.one;</cell>
                    </row>
                    <row>
                        <cell>&gmail.write.tooltip.two;</cell>
                    </row>
                </grid>
            </tooltip>
        </f:optional>
        <f:optional>
            <f:value-of name="is_logged"/>
            <tooltip>&gmail.write.tooltip.good;</tooltip>
        </f:optional>
    </button>
</widget>
