em-ruby-irc 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,6 +10,6 @@ require File.dirname(__FILE__) + '/em-ruby-irc/IRC-Utils.rb'
10
10
  require File.dirname(__FILE__) + '/em-ruby-irc/default-handlers.rb'
11
11
 
12
12
  module EMIRC
13
- VERSION = '0.0.5'
13
+ VERSION = '0.0.6'
14
14
  end
15
15
 
@@ -13,7 +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
+ @noidprefix = @setup.config["noidprefix"] || false
17
17
  @channels = Array.new
18
18
  @users = Array.new
19
19
  @irc_handlers = Hash.new()
@@ -36,11 +36,8 @@ module IRC
36
36
  connection.channels.delete(channel) unless channel.nil?
37
37
  end
38
38
 
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)
39
+ #Creates the user in the channel userlist (IRC::Channel#users) and then returns the user
40
+ def self.channel_user(connection, channel_name, user_name, hostmask=nil)
44
41
  return false if channel_name.nil? or user_name.nil?
45
42
  user_name = sanitize_nickname(user_name)
46
43
  channel_name = channel_name.downcase.chomp
@@ -53,6 +50,15 @@ module IRC
53
50
  return user
54
51
  end
55
52
 
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
+
56
62
  #Creates the user in the global userlist (IRC::Connection#users) and then returns the user
57
63
  def self.global_user(connection, user_name, hostmask=nil)
58
64
  user_name = sanitize_nickname(user_name)
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: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Stolz