em-ruby-irc 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/em-ruby-irc/IRC-Connection.rb +5 -1
- data/lib/em-ruby-irc/IRC-Event.rb +3 -2
- data/lib/em-ruby-irc/IRC-User.rb +1 -2
- data/lib/em-ruby-irc/IRC-Utils.rb +5 -11
- data/lib/em-ruby-irc.rb +1 -1
- metadata +3 -3
@@ -2,7 +2,7 @@ require 'logger'
|
|
2
2
|
|
3
3
|
module IRC
|
4
4
|
class Connection < EventMachine::Connection
|
5
|
-
attr_reader :realname, :username, :channels, :users, :name, :command_char
|
5
|
+
attr_reader :realname, :username, :channels, :users, :name, :command_char, :noidprefix
|
6
6
|
attr_accessor :irc_handlers, :channels, :users, :setup, :nickname
|
7
7
|
|
8
8
|
def initialize(args)
|
@@ -13,6 +13,7 @@ module IRC
|
|
13
13
|
@realname = @setup.config["realname"]
|
14
14
|
@username = @setup.config["username"]
|
15
15
|
@command_char = @setup.config["command_char"]
|
16
|
+
@noidprefix = @setup.config["noidprefix"]
|
16
17
|
@channels = Array.new
|
17
18
|
@users = Array.new
|
18
19
|
@irc_handlers = Hash.new()
|
@@ -40,6 +41,9 @@ module IRC
|
|
40
41
|
logger.debug("Firing connection_completed")
|
41
42
|
send_to_server "NICK #{@nickname}"
|
42
43
|
send_to_server "USER #{@username} 8 * :#{@realname}"
|
44
|
+
if noidprefix
|
45
|
+
send_to_server "CAPAB IDENTIFY-MSG"
|
46
|
+
end
|
43
47
|
end
|
44
48
|
|
45
49
|
def receive_data(data)
|
@@ -13,10 +13,11 @@ end
|
|
13
13
|
# This is a lookup class for IRC event name mapping
|
14
14
|
module IRC
|
15
15
|
class Event
|
16
|
-
attr_reader :hostmask, :
|
17
|
-
attr_accessor :connection
|
16
|
+
attr_reader :hostmask, :event_type, :from, :channel, :target, :mode, :stats
|
17
|
+
attr_accessor :connection, :message, :logged_in
|
18
18
|
def initialize(data, connection)
|
19
19
|
@connection = connection
|
20
|
+
@logged_in = false
|
20
21
|
data.chomp!
|
21
22
|
data.sub!(/^:/, '')
|
22
23
|
mess_parts = data.split(':', 2);
|
data/lib/em-ruby-irc/IRC-User.rb
CHANGED
@@ -36,8 +36,11 @@ module IRC
|
|
36
36
|
connection.channels.delete(channel) unless channel.nil?
|
37
37
|
end
|
38
38
|
|
39
|
-
#
|
40
|
-
def self.
|
39
|
+
#Get or Create the user in the channel userlist from an event (IRC::Channel#users) and then returns the user
|
40
|
+
def self.get_channel_user_from_event(event, username=nil, hostmask=nil)
|
41
|
+
connection = event.connection
|
42
|
+
channel_name = event.channel
|
43
|
+
user_name = (username.nil? ? event.from : username)
|
41
44
|
return false if channel_name.nil? or user_name.nil?
|
42
45
|
user_name = sanitize_nickname(user_name)
|
43
46
|
channel_name = channel_name.downcase.chomp
|
@@ -50,15 +53,6 @@ module IRC
|
|
50
53
|
return user
|
51
54
|
end
|
52
55
|
|
53
|
-
#Returns a user from an event.
|
54
|
-
def self.get_channel_user_from_event(event, user=nil)
|
55
|
-
if user.nil?
|
56
|
-
channel_user(event.connection, event.channel, event.from)
|
57
|
-
else
|
58
|
-
channel_user(event.connection, event.channel, user)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
56
|
#Creates the user in the global userlist (IRC::Connection#users) and then returns the user
|
63
57
|
def self.global_user(connection, user_name, hostmask=nil)
|
64
58
|
user_name = sanitize_nickname(user_name)
|
data/lib/em-ruby-irc.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-ruby-irc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Stolz
|