April 23rd, 2002

trickster

getinterests mode

So, why isn't there a mode to get the interests for a user.
I figure that it should be that difficult to put the following into cgi-bin/ljprotocol.pl:
# Note - this is untested code - but the code is trivial
#
sub getinterests
{
my ($dbs, $req, $err, $flags) = @_;
return undef unless authenticate($dbs, $req, $err, $flags);

my $res = [];
my $dbr = $dbs->{'reader'};

my $sth = $dbr->prepare("SELECT i.interest, i.intcount, i.intid " .
"FROM interests i, userinterests ui " .
"WHERE i.intid=ui.intid AND ui.userid=$u->{'userid'}"
);
$sth->execute;
my %interests = ();
while ($_ = $sth->fetchrow_hashref) {
push @$res, { interest => $_->{'interest'},
};
}
$sth->finish;
return $res;
}

As I said, this code is untested but would be trivial to check. If this is something that would be desired, I can make sure this works and update protocol.dat once someone tells me how.
Frederik, real life, "Reserved", reserved, the real me?
  • freso

Search patch

I've been thinking about how wonderful it'd be if I could search for Y! nicks and M$N addresses for while, like one can search for ICQ and AIM users... so... I just wrote a small patch to do it...
Test it here: http://lj.teencity.org/
Patch here: http://www.teencity.org/search.patch
(thanks to supersat for hosting it :))
If someone has any arguments against having it committed (or can think of a better wording than 'Y! Nick' ('Yahoo! SN'?), 'MSN Address', and 'Jabber Address') please let me know... I'll send it to Brad if there's no complains or bugs... :P

Oh, yeah... and I added Jabber while I was at it... :)

Update: It's now 'Yahoo! ID', 'MSN Username', and 'Jabber', to comply/stay consistent with what is asked for/shown at the userinfo-page.
  • Current Music
    Mikal the Ram - Gather Ye Pipers