X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=Commands%2FMembers.pm;h=44cfe79d68ac3c62863fb2ec0d2c8f7d017af08f;hb=0d6e6e233601ba9b1dd9fe874e804424a10fa09c;hp=dbfa1f416f6b01495dee17db37903bb7893b8b39;hpb=76262702ab0181b0ec9d4f748eb9f1932375a032;p=NDIRC.git diff --git a/Commands/Members.pm b/Commands/Members.pm index dbfa1f4..44cfe79 100644 --- a/Commands/Members.pm +++ b/Commands/Members.pm @@ -107,10 +107,13 @@ sub sms my ($self,$c,$msg) = @_; my ($nick) = $msg =~ /(\S+)/ or die 'ARGS'; my $f = $c->model->prepare(q{ -SELECT username,COALESCE(sms,'nothing added') FROM users WHERE username ILIKE ? +SELECT username,COALESCE(sms,'nothing added'), call_if_needed, timezone, sms_note + ,to_char(NOW() AT TIME ZONE timezone,'HH24:MI') AS time +FROM users WHERE username ILIKE ? }); - if (my ($username,$sms) = $c->model->selectrow_array($f,undef,$nick)){ - $c->reply("$username has sms $sms"); + if (my ($username,$sms, $call, $timezone, $note, $time) = $c->model->selectrow_array($f,undef,$nick)){ + $call = $call ? 'Wake up if needed' : 'Do not wake up'; + $c->reply("$username has sms $sms, $call, $time ($timezone), $note "); }else{ $c->reply("No hit, maybe spelling mistake, or add % as wildcard"); } @@ -123,4 +126,28 @@ sub links $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;