This file is indexed.

/usr/share/nadoka/plugins/autoawaybot.nb is in nadoka 0.7.6-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# -*-ruby-*-
#
# Copyright (c) 2004-2005 SASADA Koichi <ko1 at atdot.net>
#
# This program is free software with ABSOLUTELY NO WARRANTY.
# You can re-distribute and/or modify this program under
# the same terms of the Ruby's license.
#
#
# This bot is created by
#   akira yamada <akira at arika.org>
#
# $Id$
#

=begin

== Abstract

Auto away if no action

== Configuration

BotConfig = [
{
  :name      => :AutoAwayBot,
  :threshold => 15*60,        # sec
  :message   => 'Away',
}
]

=end

class AutoAwayBot < Nadoka::NDK_Bot
  def bot_initialize
    @threshold = @bot_config.fetch(:threshold, 15*60).to_i
    @message   = @bot_config.fetch(:message, 'Away')
    @lastseen  = Time.now
    @in_away   = false
  end

  def on_client_privmsg client, ch, msg
    if @threshold > 0
      @lastseen = Time.now
    end
    if @in_away
      @manager.send_to_server Nadoka::Cmd.away()
    end
  end

  def on_timer time
    if @threshold > 0 && Time.now - @lastseen > @threshold && !@in_away
      @manager.send_to_server Nadoka::Cmd.away(@message)
    end
  end

  def on_rpl_unaway *arg
    @in_away = false
  end

  def on_rpl_nowaway *arg
    @in_away = true
  end
end