[OTR-dev] user has stopped OTR message

Ian Goldberg ian at cypherpunks.ca
Sun Jan 30 11:16:13 EST 2005


On Sun, Jan 30, 2005 at 11:03:00AM -0500, Ian Goldberg wrote:
> Also, for Evan: you mentioned that gaim should be able to produce
> sensible yes/no/don't-know answers to the is_logged_in question.  Can
> you supply some code for that?
> 
>     /* Report whether you think the given user is online.  Return 1 if
>      * you think he is, 0 if you think he isn't, -1 if you're not sure.
>      *
>      * If you return 1, messages such as heartbeats or other
>      * notifications may be sent to the user, which could result in "not
>      * logged in" errors if you're wrong. */
>     int (*is_logged_in)(void *opdata, const char *accountname,
>             const char *protocol, const char *recipient);

Ah, never mind.  I think this should do it:

static int is_logged_in_cb(void *opdata, const char *accountname,
        const char *protocol, const char *recipient)
{
    GaimAccount *account;
    GaimBuddy *buddy;

    account = gaim_accounts_find(accountname, protocol);
    if (!account) return -1;

    buddy = gaim_find_buddy(account, recipient);
    if (!buddy) return -1;

    return (buddy->present == GAIM_BUDDY_ONLINE);
}

   - Ian



More information about the OTR-dev mailing list