Module: Ponder::IRC
- Included in:
- Thaum
- Defined in:
- lib/ponder/irc.rb
Instance Method Summary collapse
-
#action(recipient, message) ⇒ Object
perform an action.
-
#away(message = nil) ⇒ Object
set an away status.
-
#back ⇒ Object
cancel an away status.
-
#ban(channel, address) ⇒ Object
ban an user.
-
#invite(nick, channel) ⇒ Object
invite an user to a channel.
-
#join(channel, password = nil) ⇒ Object
joining a channel.
-
#kick(channel, user, reason = nil) ⇒ Object
kick a user.
-
#message(recipient, message) ⇒ Object
send a message.
-
#mode(recipient, option) ⇒ Object
set a mode.
-
#notice(recipient, message) ⇒ Object
send a notice.
-
#part(channel, message = nil) ⇒ Object
parting a channel.
-
#quit(message = nil) ⇒ Object
quitting.
-
#raw(message) ⇒ Object
raw IRC messages.
-
#register ⇒ Object
register when connected.
-
#rename(nick) ⇒ Object
rename.
-
#topic(channel, topic) ⇒ Object
set a topic.
Instance Method Details
#action(recipient, message) ⇒ Object
perform an action
42 43 44 |
# File 'lib/ponder/irc.rb', line 42 def action(recipient, ) raw "PRIVMSG #{recipient} :\001ACTION #{}\001" end |
#away(message = nil) ⇒ Object
set an away status
86 87 88 89 90 91 92 |
# File 'lib/ponder/irc.rb', line 86 def away( = nil) if raw "AWAY :#{}" else raw "AWAY" end end |
#back ⇒ Object
cancel an away status
95 96 97 |
# File 'lib/ponder/irc.rb', line 95 def back away end |
#ban(channel, address) ⇒ Object
ban an user
105 106 107 |
# File 'lib/ponder/irc.rb', line 105 def ban(channel, address) mode channel, "+b #{address}" end |
#invite(nick, channel) ⇒ Object
invite an user to a channel
100 101 102 |
# File 'lib/ponder/irc.rb', line 100 def invite(nick, channel) raw "INVITE #{nick} #{channel}" end |
#join(channel, password = nil) ⇒ Object
joining a channel
52 53 54 55 56 57 58 |
# File 'lib/ponder/irc.rb', line 52 def join(channel, password = nil) if password raw "JOIN #{channel} #{password}" else raw "JOIN #{channel}" end end |
#kick(channel, user, reason = nil) ⇒ Object
kick a user
33 34 35 36 37 38 39 |
# File 'lib/ponder/irc.rb', line 33 def kick(channel, user, reason = nil) if reason raw "KICK #{channel} #{user} :#{reason}" else raw "KICK #{channel} #{user}" end end |
#message(recipient, message) ⇒ Object
send a message
11 12 13 |
# File 'lib/ponder/irc.rb', line 11 def (recipient, ) raw "PRIVMSG #{recipient} :#{}" end |
#mode(recipient, option) ⇒ Object
set a mode
28 29 30 |
# File 'lib/ponder/irc.rb', line 28 def mode(recipient, option) raw "MODE #{recipient} #{option}" end |
#notice(recipient, message) ⇒ Object
send a notice
23 24 25 |
# File 'lib/ponder/irc.rb', line 23 def notice(recipient, ) raw "NOTICE #{recipient} :#{}" end |
#part(channel, message = nil) ⇒ Object
parting a channel
61 62 63 64 65 66 67 |
# File 'lib/ponder/irc.rb', line 61 def part(channel, = nil) if raw "PART #{channel} :#{}" else raw "PART #{channel}" end end |
#quit(message = nil) ⇒ Object
quitting
70 71 72 73 74 75 76 77 78 |
# File 'lib/ponder/irc.rb', line 70 def quit( = nil) if raw "QUIT :#{}" else raw 'QUIT' end @config.reconnect = false # so Ponder does not reconnect after the socket has been closed end |
#raw(message) ⇒ Object
raw IRC messages
4 5 6 7 8 |
# File 'lib/ponder/irc.rb', line 4 def raw() @connection.send_data "#{}\r\n" @traffic_logger.info ">> #{}" @console_logger.info ">> #{}" end |
#register ⇒ Object
register when connected
16 17 18 19 20 |
# File 'lib/ponder/irc.rb', line 16 def register raw "NICK #{@config.nick}" raw "USER #{@config.username} * * :#{@config.real_name}" raw "PASS #{@config.password}" if @config.password end |
#rename(nick) ⇒ Object
rename
81 82 83 |
# File 'lib/ponder/irc.rb', line 81 def rename(nick) raw "NICK :#{nick}" end |
#topic(channel, topic) ⇒ Object
set a topic
47 48 49 |
# File 'lib/ponder/irc.rb', line 47 def topic(channel, topic) raw "TOPIC #{channel} :#{topic}" end |