X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=Commands%2FMembers.pm;h=34ef7d605028efa790c8935fdf336a976019b3dc;hb=a94fe8052ba36e7ffbf608aa6b69b4a895126e38;hp=a2f54eeb061e3990fdce93eb577609e608ff83b0;hpb=66ce902aff4400269e2c2de3b9dbeee61448e3d5;p=NDIRC.git diff --git a/Commands/Members.pm b/Commands/Members.pm index a2f54ee..34ef7d6 100644 --- a/Commands/Members.pm +++ b/Commands/Members.pm @@ -116,4 +116,35 @@ SELECT username,COALESCE(sms,'nothing added') FROM users WHERE username ILIKE ? } } +sub links + : Help(Shows link to webbie and maybe more links later) +{ + my ($self,$c,$msg) = @_; + $c->reply("https://nd.ruin.nu/"); +} + +sub forum + : Help(syntax: .forum [nick] | not everyone have access to check for others.) +{ + my ($self,$c,$msg) = @_; + my $dbh = $c->model; + + my $user; + if ($msg =~ /(\S+)/ && $c->check_user_roles('irc_forum_others')){ + $user = $dbh->selectrow_hashref(q{ +SELECT uid,username FROM users WHERE username ILIKE ? + }, undef, $1); + }else{ + $user = $dbh->selectrow_hashref(q{ +SELECT uid,username FROM users WHERE hostmask ILIKE ? + }, undef, $c->host); + } + if ($user){ + my $unread = $dbh->selectrow_hashref(q{SELECT * FROM unread_posts($1)},undef,$user->{uid}); + if ($unread){ + $c->reply("$user->{username} has $unread->{new} posts since your last forum visit ($unread->{unread} unread posts in total) https://nd.ruin.nu/forum/allUnread"); + } + } +} + 1;