/usr/lib/ruby/1.8/irc/agent.rb is in libnet-irc-ruby 0.14-5.
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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | =begin header
Internet Relay Chat Agent Library
$Author: knu $
$Date: 2001/01/31 10:55:28 $
Copyright (C) 1998-2000 Hiroshi IGARASHI
=end
#require 'irc'
#require 'ircclient'
module IRC
class Agent
=begin
IRC¾å¤ÇÆ°ºî¤¹¤ëagent¤ÎÏÈÁȤߤòÄ󶡤¹¤ë¥¯¥é¥¹¡£
ÇÉÀ¸¤·¡¢¥á¥½¥Ã¥É¤òoverride¤·¤ÆÍøÍѤ¹¤ë
=end
include Constants
#attr_reader(:name)
attr_accessor(:name)
=begin
¥¨¡¼¥¸¥§¥ó¥È̾(¥¹¥¯¥ê¥×¥È̾¤È1ÂÐ1Âбþ):String
=end
attr_reader(:nick)
=begin
¥¨¡¼¥¸¥§¥ó¥È̾:String
=end
attr_reader(:timestamp)
=begin
À¸À®»þ¹ï:Time
=end
attr_accessor(:script_name)
=begin
À¸À®¸µ¥¹¥¯¥ê¥×¥È¥Õ¥¡¥¤¥ë̾:String
=end
def initialize(nick=__id__.to_s)
=begin
À¸À®¤Î¤ß¹Ô¤¦¡Ê¼ÂºÝ¤Î½é´ü²½¤Ïstart¤Ç¹Ô¤¦¡Ë
=end
@nick = nick
@timestamp = Time.now
end
def start(client)
=begin
½é´ü²½¡¦µ¯Æ°
client:Client ¤³¤ÎAgent¤¬ÁȤ߹þ¤Þ¤ì¤ëClient¥ª¥Ö¥¸¥§¥¯¥È
=end
@client = client
putlog("start", "started.")
main
end
def restart(old_agent)
=begin
ºÆµ¯Æ°
old_agent:Agent nil¤Ê¤é¤Ð¸½ºß¤Î¾õÂ֤ΤޤÞÆ°ºî³«»Ï
=end
end
def stop
=begin
Ää»ß
=end
putlog("stop", "stopped.")
#leprintln("#{@nick} stoped.")
end
def putlog(ident, str)
@client.putlog(self, ident, str)
end
def join(channels, keys)
@client.join(channels, keys)
end
def part(channels)
@client.part(channels)
end
def privmsg(message, *channels)
@client.privmsg(message, *channels)
end
def action(message, *channels)
@client.action(message, *channels)
end
=begin
Client¤Îµ¡Ç½¤Î¸Æ½Ð
=end
#
# ¥ª¡¼¥Ð¡¼¥é¥¤¥É¤µ¤ì¤ë¤³¤È¤¬´üÂÔ¤µ¤ì¤ë¥á¥½¥Ã¥É
#
def main
=begin
¥á¥¤¥ó
=end
end
def terminate
=begin
Ää»ß½èÍý
=end
end
end
class ActiveAgent < Agent
attr_reader(:thread)
=begin
¤³¤Î¥¨¡¼¥¸¥§¥ó¥È¤Î¥¹¥ì¥Ã¥É:Thread
=end
attr_reader(:message_queue)
=begin
¥á¥Ã¥»¡¼¥¸¥¥å¡¼:Queue
nil¤Î¤È¤¼õ¤±¼è¤ê¤òµñÈݤ·¤Æ¤¤¤ë¤³¤È¤ò¼¨¤¹
=end
attr_reader(:log_queue)
=begin
¥í¥°¥¥å¡¼:Queue
nil¤Î¤È¤¼õ¤±¼è¤ê¤òµñÈݤ·¤Æ¤¤¤ë¤³¤È¤ò¼¨¤¹
=end
def start(client)
=begin
µ¯Æ°
=end
@client = client
@thread = Thread.current
putlog("start", "started.")
# ǽưŪ¤ÊÆ°ºî
begin
main
rescue Stop
# Ää»ß½èÍý
terminate
end
end
def stop
=begin
Ää»ß
=end
@thread.raise(Stop.new)
super
end
#
def evolve
end
end
class PassiveAgent < Agent
#
# def start(client)
# super
# # ¤½¤Î¾¤Î½é´ü²½½èÍý
# # ¥Ö¥í¥Ã¥¯¤»¤º¤Ëreturn¤·¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
# end
def notifyMessage(msg)
=begin
¥á¥Ã¥»¡¼¥¸ÅþÃåÄÌÃÎ
¡ÊÅöÌÌÁ´¤Æ¤Î¥á¥Ã¥»¡¼¥¸¤¬ÄÌÃΤµ¤ì¤ë¡Ë
=end
end
def notifyLog(log)
=begin
¥í¥°ÅþÃåÄÌÃÎ
¡ÊÅöÌÌÁ´¤Æ¤Î¥í¥°¤¬ÄÌÃΤµ¤ì¤ë¡Ë
=end
end
end
class TemporaryAgent < Agent
def start(client)
super
# °ì»þŪ¤Ê½èÍý
# ¥Ö¥í¥Ã¥¯¤»¤º¤Ëreturn¤·¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
end
end
end
|