mod_spox 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. data/CHANGELOG +31 -1
  2. data/LICENSE +674 -0
  3. data/README.rdoc +73 -0
  4. data/bin/mod_spox +28 -28
  5. data/data/mod_spox/extras/AOLSpeak.rb +2 -3
  6. data/data/mod_spox/extras/AutoKick.rb +10 -23
  7. data/data/mod_spox/extras/AutoMode.rb +12 -23
  8. data/data/mod_spox/extras/Bash.rb +55 -0
  9. data/data/mod_spox/extras/Bouncer.rb +85 -57
  10. data/data/mod_spox/extras/Bullshit.rb +1 -1
  11. data/data/mod_spox/extras/Bytes.rb +1 -2
  12. data/data/mod_spox/extras/Confess.rb +27 -29
  13. data/data/mod_spox/extras/DCC.rb +11 -20
  14. data/data/mod_spox/extras/DevWatch.rb +21 -23
  15. data/data/mod_spox/extras/DownForEveryoneOrJustMe.rb +47 -0
  16. data/data/mod_spox/extras/EightBall.rb +1 -1
  17. data/data/mod_spox/extras/FML.rb +35 -0
  18. data/data/mod_spox/extras/Headers.rb +31 -50
  19. data/data/mod_spox/extras/Karma.rb +81 -29
  20. data/data/mod_spox/extras/Logger.rb +2 -2
  21. data/data/mod_spox/extras/LolSpeak.rb +1 -2
  22. data/data/mod_spox/extras/PhpCli.rb +138 -8
  23. data/data/mod_spox/extras/PhpFuncLookup.rb +20 -23
  24. data/data/mod_spox/extras/Pinger.rb +1 -1
  25. data/data/mod_spox/extras/Quotes.rb +8 -10
  26. data/data/mod_spox/extras/RegexTracker.rb +2 -4
  27. data/data/mod_spox/extras/Roulette.rb +20 -27
  28. data/data/mod_spox/extras/RubyCli.rb +93 -0
  29. data/data/mod_spox/extras/Search.rb +17 -3
  30. data/data/mod_spox/extras/Seen.rb +150 -0
  31. data/data/mod_spox/extras/SlashdotHeadlineGenerator.rb +500 -0
  32. data/data/mod_spox/extras/Talk.rb +2 -4
  33. data/data/mod_spox/extras/Topten.rb +10 -12
  34. data/data/mod_spox/extras/TracTicket.rb +3 -5
  35. data/data/mod_spox/extras/Translate.rb +20 -22
  36. data/data/mod_spox/extras/Twitter.rb +118 -33
  37. data/data/mod_spox/extras/UrbanDictionary.rb +8 -17
  38. data/data/mod_spox/extras/Weather.rb +1 -2
  39. data/data/mod_spox/plugins/Authenticator.rb +93 -98
  40. data/data/mod_spox/plugins/Banner.rb +26 -56
  41. data/data/mod_spox/plugins/Helper.rb +5 -6
  42. data/data/mod_spox/plugins/Initializer.rb +4 -14
  43. data/data/mod_spox/plugins/Joiner.rb +1 -1
  44. data/data/mod_spox/plugins/Nicker.rb +13 -0
  45. data/data/mod_spox/plugins/Parter.rb +2 -2
  46. data/data/mod_spox/plugins/Permissions.rb +60 -0
  47. data/data/mod_spox/plugins/PluginLoader.rb +7 -12
  48. data/data/mod_spox/plugins/Ponger.rb +51 -0
  49. data/data/mod_spox/plugins/Quitter.rb +1 -2
  50. data/data/mod_spox/plugins/Servers.rb +57 -0
  51. data/data/mod_spox/plugins/Status.rb +3 -2
  52. data/data/mod_spox/plugins/Triggers.rb +9 -9
  53. data/lib/mod_spox/Bot.rb +109 -33
  54. data/lib/mod_spox/BotConfig.rb +2 -2
  55. data/lib/mod_spox/ConfigurationWizard.rb +12 -12
  56. data/lib/mod_spox/Database.rb +1 -4
  57. data/lib/mod_spox/Exceptions.rb +26 -0
  58. data/lib/mod_spox/Helpers.rb +29 -68
  59. data/lib/mod_spox/Loader.rb +23 -24
  60. data/lib/mod_spox/Logger.rb +19 -17
  61. data/lib/mod_spox/MessageFactory.rb +50 -24
  62. data/lib/mod_spox/Pipeline.rb +21 -7
  63. data/lib/mod_spox/Plugin.rb +27 -3
  64. data/lib/mod_spox/PluginManager.rb +28 -15
  65. data/lib/mod_spox/PriorityQueue.rb +69 -0
  66. data/lib/mod_spox/Socket.rb +93 -51
  67. data/lib/mod_spox/Sockets.rb +76 -63
  68. data/lib/mod_spox/Timer.rb +21 -141
  69. data/lib/mod_spox/Version.rb +14 -0
  70. data/lib/mod_spox/handlers/BadNick.rb +1 -1
  71. data/lib/mod_spox/handlers/Bounce.rb +5 -5
  72. data/lib/mod_spox/handlers/Created.rb +13 -5
  73. data/lib/mod_spox/handlers/Handler.rb +12 -3
  74. data/lib/mod_spox/handlers/Invite.rb +14 -8
  75. data/lib/mod_spox/handlers/Join.rb +24 -20
  76. data/lib/mod_spox/handlers/Kick.rb +22 -13
  77. data/lib/mod_spox/handlers/Mode.rb +42 -36
  78. data/lib/mod_spox/handlers/Motd.rb +4 -0
  79. data/lib/mod_spox/handlers/Names.rb +66 -39
  80. data/lib/mod_spox/handlers/Nick.rb +20 -14
  81. data/lib/mod_spox/handlers/Part.rb +25 -8
  82. data/lib/mod_spox/handlers/Ping.rb +11 -5
  83. data/lib/mod_spox/handlers/Pong.rb +9 -5
  84. data/lib/mod_spox/handlers/Privmsg.rb +25 -17
  85. data/lib/mod_spox/handlers/Quit.rb +13 -8
  86. data/lib/mod_spox/handlers/Topic.rb +4 -0
  87. data/lib/mod_spox/handlers/Welcome.rb +16 -24
  88. data/lib/mod_spox/handlers/Who.rb +64 -48
  89. data/lib/mod_spox/handlers/Whois.rb +92 -60
  90. data/lib/mod_spox/messages/incoming/Nick.rb +2 -2
  91. data/lib/mod_spox/messages/incoming/Privmsg.rb +1 -1
  92. data/lib/mod_spox/messages/incoming/Whois.rb +1 -0
  93. data/lib/mod_spox/messages/internal/EstablishConnection.rb +1 -1
  94. data/lib/mod_spox/messages/internal/PluginsReady.rb +10 -0
  95. data/lib/mod_spox/messages/internal/QueueSocket.rb +8 -0
  96. data/lib/mod_spox/messages/internal/Reconnect.rb +8 -0
  97. data/lib/mod_spox/messages/internal/UnqueueSocket.rb +8 -0
  98. data/lib/mod_spox/migrations/002_persistent_sigs.rb +14 -0
  99. data/lib/mod_spox/migrations/003_auth_restructure.rb +31 -0
  100. data/lib/mod_spox/migrations/004_mode_index_fix.rb +18 -0
  101. data/lib/mod_spox/migrations/005_nick_mode_nopark.rb +18 -0
  102. data/lib/mod_spox/models/Auth.rb +16 -46
  103. data/lib/mod_spox/models/AuthMask.rb +13 -0
  104. data/lib/mod_spox/models/Channel.rb +46 -27
  105. data/lib/mod_spox/models/Config.rb +10 -19
  106. data/lib/mod_spox/models/Group.rb +20 -8
  107. data/lib/mod_spox/models/Models.rb +1 -1
  108. data/lib/mod_spox/models/Nick.rb +105 -113
  109. data/lib/mod_spox/models/NickMode.rb +23 -9
  110. data/lib/mod_spox/models/Server.rb +12 -1
  111. data/lib/mod_spox/models/Setting.rb +12 -16
  112. data/lib/mod_spox/models/Signature.rb +28 -8
  113. data/tests/BotHolder.rb +24 -0
  114. data/tests/handlers/tc_BadNick.rb +21 -0
  115. data/tests/handlers/tc_Created.rb +24 -0
  116. data/tests/handlers/tc_Invite.rb +50 -0
  117. data/tests/handlers/tc_Join.rb +33 -0
  118. data/tests/handlers/tc_Kick.rb +32 -0
  119. data/tests/handlers/tc_Mode.rb +85 -0
  120. data/tests/handlers/tc_Names.rb +35 -0
  121. data/tests/handlers/tc_Nick.rb +55 -0
  122. data/tests/handlers/tc_Part.rb +44 -0
  123. data/tests/handlers/tc_Ping.rb +40 -0
  124. data/tests/handlers/tc_Pong.rb +28 -0
  125. data/tests/handlers/tc_Privmsg.rb +85 -0
  126. data/tests/handlers/tc_Quit.rb +40 -0
  127. data/tests/handlers/tc_Who.rb +50 -0
  128. data/tests/handlers/tc_Whois.rb +61 -0
  129. data/tests/models/tc_Auth.rb +34 -0
  130. data/tests/models/tc_Channel.rb +52 -0
  131. data/tests/models/tc_Config.rb +19 -0
  132. data/tests/models/tc_Nick.rb +142 -0
  133. data/tests/models/tc_NickMode.rb +40 -0
  134. data/tests/models/tc_Setting.rb +21 -0
  135. data/tests/models/tc_Signature.rb +14 -0
  136. data/tests/run_tests.rb +4 -0
  137. metadata +284 -212
  138. data/README +0 -36
  139. data/lib/mod_spox/Cache.rb +0 -57
  140. data/lib/mod_spox/Monitors.rb +0 -84
  141. data/lib/mod_spox/Pool.rb +0 -164
  142. data/lib/mod_spox/models/AuthGroup.rb +0 -16
  143. data/lib/mod_spox/models/ChannelMode.rb +0 -14
  144. data/lib/mod_spox/models/NickChannel.rb +0 -45
  145. data/lib/mod_spox/models/NickGroup.rb +0 -16
@@ -16,8 +16,8 @@ module ModSpox
16
16
  # new_nick:: this should be the target
17
17
  def initialize(raw, old_nick, new_nick)
18
18
  super(raw)
19
- @original_nick = @source_nick
20
- @new_nick = @target
19
+ @original_nick = old_nick
20
+ @new_nick = new_nick
21
21
  end
22
22
 
23
23
  end
@@ -42,7 +42,7 @@ module ModSpox
42
42
 
43
43
  # Is this is private message
44
44
  def is_private?
45
- return @target.is_a?(Models::Nick) || @target.is_a?(String)
45
+ return !is_public?
46
46
  end
47
47
 
48
48
  # Is this a DCC message
@@ -35,6 +35,7 @@ module ModSpox
35
35
  def lock
36
36
  @locked = true
37
37
  @raw_content = @raw.join("\n")
38
+ @nick.refresh
38
39
  end
39
40
 
40
41
  private
@@ -11,7 +11,7 @@ module ModSpox
11
11
  # server:: Server to connect to
12
12
  # port:: Port to connect to
13
13
  # password:: password to connect
14
- def initialize(server, port, password=nil)
14
+ def initialize(server=nil, port=nil, password=nil)
15
15
  @server = server
16
16
  @port = port
17
17
  @password = password
@@ -0,0 +1,10 @@
1
+ module ModSpox
2
+ module Messages
3
+ module Internal
4
+ # Sends message to reload plugin. If new and stale
5
+ # attributes are set, only that plugin will be reloaded
6
+ class PluginsReady
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ module ModSpox
2
+ module Messages
3
+ module Internal
4
+ class QueueSocket
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module ModSpox
2
+ module Messages
3
+ module Internal
4
+ class Reconnect
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module ModSpox
2
+ module Messages
3
+ module Internal
4
+ class UnqueueSocket
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ module ModSpox
2
+ module Migrations
3
+ class PersistentSigs < Sequel::Migration
4
+
5
+ def up
6
+ Database.db.add_column :signatures, :enabled, :boolean, :null => false, :default => true
7
+ end
8
+
9
+ def down
10
+ Database.db.drop_column :signatures, :enabled
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,31 @@
1
+ module ModSpox
2
+ module Migrations
3
+ class AuthRestructureModeFix < Sequel::Migration
4
+
5
+ def up
6
+ Database.db.drop_column :auths, :mask
7
+ Database.db.create_table(:auth_masks) do
8
+ primary_key :id, :null => false
9
+ varchar :mask, :null => false, :unique => true
10
+ end
11
+ Database.db.create_table(:auth_masks_groups) do
12
+ foreign_key :auth_mask_id, :table => :auth_masks, :null => false
13
+ foreign_key :group_id, :null => false
14
+ primary_key [:auth_mask_id, :group_id]
15
+ end
16
+ Database.db.create_table(:auth_masks_nicks) do
17
+ foreign_key :auth_mask_id, :table => :auth_masks, :null => false
18
+ foreign_key :nick_id, :null => false
19
+ primary_key [:nick_id, :auth_mask_id]
20
+ end
21
+ Database.db.drop_table :nick_groups
22
+ end
23
+
24
+ def down
25
+ Database.db.drop_table(:auth_masks_group)
26
+ Database.db.drop_table(:auth_masks_nicks)
27
+ Database.db.drop_table(:auth_masks)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,18 @@
1
+ module ModSpox
2
+ module Migrations
3
+ class ModeIndexFix < Sequel::Migration
4
+
5
+ def up
6
+ Database.db.drop_index :nick_modes, [:nick_id, :channel_id]
7
+ Database.db.add_index :nick_modes, [:nick_id, :channel_id], :unique => true
8
+ Database.db.drop_column :nick_modes, :mode
9
+ Database.db.add_column :nick_modes, :mode, :varchar, :null => true, :default => ''
10
+ end
11
+
12
+ def down
13
+ Database.db.drop_index :nick_modes, [:nick_id, :channel_id]
14
+ Database.db.add_index :nick_modes, [:nick_id, :channel_id]
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module ModSpox
2
+ module Migrations
3
+ class NickModeNoPark < Sequel::Migration
4
+
5
+ def up
6
+ Database.db.drop_column :channels, :parked
7
+ Database.db.add_column :nicks, :mode, :varchar, :null => true, :default => ''
8
+ Database.db.drop_table :channel_modes
9
+ Database.db.add_column :channels, :mode, :varchar, :null => true, :default => ''
10
+ end
11
+
12
+ def down
13
+ Database.db.drop_column :nicks, :mode
14
+ Database.add_column :nicks, :parked, :bool, :null => false, :default => true
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,7 +1,8 @@
1
1
  require 'digest/sha1'
2
+ require 'mod_spox/models/Group'
3
+ require 'mod_spox/models/Nick'
2
4
  module ModSpox
3
5
  module Models
4
-
5
6
  # Attributes provided by model:
6
7
  # password:: Password to autenticate against
7
8
  # services:: Authentication by nickserv
@@ -9,16 +10,12 @@ module ModSpox
9
10
  # authed:: Nick has authenticated
10
11
  class Auth < Sequel::Model
11
12
 
12
- before_destroy :clear_auth_groups
13
-
13
+ many_to_many :groups, :join_table => :auth_groups, :class => 'ModSpox::Models::Group'
14
+ many_to_one :nick, :class => 'ModSpox::Models::Nick'
15
+
14
16
  # Clear relations before destroying
15
- def clear_auth_groups
16
- AuthGroup.filter(:auth_id => pk).destroy
17
- end
18
-
19
- # Nick associated with this Auth
20
- def nick
21
- Nick[nick_id]
17
+ def before_destroy
18
+ remove_all_groups
22
19
  end
23
20
 
24
21
  # Is nick identified with services
@@ -31,42 +28,20 @@ module ModSpox
31
28
  end
32
29
  end
33
30
 
34
- def authenticated(bool=true)
35
- update_values :authed => bool
36
- end
37
-
38
- # Groups this auth is a member of
39
- def groups
40
- # we grab IDs, then the object. Otherwise we get sync problems
41
- group_id = []
42
- AuthGroup.filter(:auth_id => pk).each do |ag|
43
- group_id << ag.group_id
44
- end
45
- group = []
46
- group_id.each{|id| group << Group[id]}
47
- return group
48
- end
49
-
50
- # Add group to this auth's list
51
- def group=(group)
52
- AuthGroup.find_or_create(:auth_id => pk, :group_id => group.pk)
53
- end
54
-
55
- # Remove given group from auth
56
- def remove_group(group)
57
- AuthGroup.filter(:auth_id => pk, :group_id => group.pk).each{|g|g.destroy}
58
- end
59
-
60
31
  # Set services (nickserv) identification
61
32
  def services_identified=(val)
62
- update_with_params :authed => true if val && services
33
+ if(val && services)
34
+ update(:authed => true)
35
+ else
36
+ update(:authed => false)
37
+ end
63
38
  end
64
39
 
65
40
  # pass:: password to compare
66
41
  # Check and authenticate against password
67
42
  def check_password(pass)
68
43
  if(Digest::SHA1.hexdigest(pass) == password)
69
- update_with_params :authed => true
44
+ update(:authed => true)
70
45
  return true
71
46
  else
72
47
  return false
@@ -74,19 +49,14 @@ module ModSpox
74
49
  end
75
50
 
76
51
  def password=(pass)
77
- unless(pass.nil?)
78
- update_values :password => Digest::SHA1.hexdigest(pass)
79
- else
80
- update_values :password => nil
81
- end
52
+ pass = pass.nil? ? nil : Digest::SHA1.hexdigest(pass)
53
+ super(pass)
82
54
  end
83
55
 
84
56
  # source:: source to apply mask to
85
57
  # Check and authenticate by mask against source
86
58
  def check_mask(source)
87
- if(source =~ /^#{mask}$/)
88
- update_with_params :authed => true
89
- end
59
+ authed = true if source =~ /^#{mask}$/
90
60
  end
91
61
 
92
62
  end
@@ -0,0 +1,13 @@
1
+ require 'mod_spox/models/Nick'
2
+ require 'mod_spox/models/Group'
3
+ module ModSpox
4
+ module Models
5
+
6
+ class AuthMask < Sequel::Model
7
+
8
+ many_to_many :nicks, :join_table => :auth_masks_nicks, :class => 'ModSpox::Models::Nick'
9
+ many_to_many :groups, :join_table => :auth_masks_groups, :class => 'ModSpox::Models::Group'
10
+
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,6 @@
1
+ require 'mod_spox/models/Nick'
2
+ require 'mod_spox/models/NickMode'
3
+
1
4
  module ModSpox
2
5
  module Models
3
6
 
@@ -10,10 +13,24 @@ module ModSpox
10
13
  # parked:: Bot is currently in this channel
11
14
  class Channel < Sequel::Model
12
15
 
13
- set_cache Database.cache, :ttl => 3600 unless Database.cache.nil?
16
+ many_to_many :nicks, :join_table => :nick_channels, :class => 'ModSpox::Models::Nick'
17
+ one_to_many :nick_modes, :class => 'ModSpox::Models::NickMode'
14
18
 
19
+ # chan_name:: string
20
+ # set channel name after downcase
15
21
  def name=(chan_name)
16
- update_values :name => chan_name.downcase
22
+ chan_name.downcase!
23
+ super(chan_name)
24
+ end
25
+
26
+ def Channel.find_or_create(args)
27
+ args[:name].downcase! if args[:name]
28
+ super(args)
29
+ end
30
+
31
+ def Channel.filter(args)
32
+ args[:name].downcase! if args[:name]
33
+ super(args)
17
34
  end
18
35
 
19
36
  def Channel.locate(string, create = true)
@@ -25,43 +42,45 @@ module ModSpox
25
42
  return chan
26
43
  end
27
44
 
28
- # Modes for this channel
29
- def channel_modes
30
- ChannelMode.filter(:channel_id => pk)
45
+ # m:: single character mode
46
+ # returns if mode is currently set for
47
+ # channel
48
+ def set?(m)
49
+ return mode.nil? ? false : !mode.index(m).nil?
31
50
  end
32
51
 
33
- # Nicks residing within this channel
34
- def nicks
35
- all_nicks = []
36
- NickChannel.filter(:channel_id => pk).each do |nc|
37
- all_nicks << nc.nick
38
- end
39
- return all_nicks
52
+ # m:: single character mode
53
+ # set a mode for the channel
54
+ # TODO: add some type checks
55
+ def set_mode(m)
56
+ update(:mode => "#{values[:mode]}#{m}") if values[:mode].nil? || values[:mode].index(m).nil?
40
57
  end
41
58
 
42
- # Adds a nick to this channel
43
- def nick_add(nick)
44
- NickChannel.find_or_create(:channel_id => pk, :nick_id => nick.pk)
59
+ # m:: single character mode
60
+ # unset a mode for the channel
61
+ def unset_mode(m)
62
+ update(:mode => values[:mode].gsub(m, ''))
45
63
  end
46
64
 
47
- # Removes a nick from this channel
48
- def nick_remove(nick)
49
- NickChannel.filter(:channel_id => pk, :nick_id => nick.pk).first.destroy
50
- if(NickChannel.filter(:channel_id => pk).count < 1)
51
- update_values :parked => false
52
- end
65
+ def clear_modes
66
+ update(:mode => '')
53
67
  end
54
68
 
55
69
  # Removes all nicks from this channel
56
70
  def clear_nicks
57
- NickChannel.filter(:channel_id => pk, :nick_id => nick.pk).each{|o| o.destroy}
58
- update_values :parked => false
71
+ remove_all_nicks
59
72
  end
60
73
 
61
- # Purges all channel information
62
- def self.clean
63
- Channel.set(:topic => nil, :parked => false)
64
- ChannelMode.destroy_all
74
+ def add_nick(n)
75
+ unless(nicks_dataset.filter(:nick_id => n.pk).count > 0)
76
+ super(n)
77
+ end
78
+ end
79
+
80
+ def remove_nick(n)
81
+ if(nicks_dataset.filter(:nick_id => n.pk).count > 0)
82
+ super(n)
83
+ end
65
84
  end
66
85
 
67
86
  end
@@ -7,32 +7,23 @@ module ModSpox
7
7
  # It is important to note this model is for storing configuration
8
8
  # values only. It will only store strings, not complex objects. If
9
9
  # you need to store an object, use the Setting model.
10
+ # TODO: find and remove any [] usage
10
11
  class Config < Sequel::Model
11
12
 
12
13
  def name=(config_name)
13
- values[:name] = config_name.downcase
14
- end
15
-
16
- def value=(val)
17
- values[:value] = val
14
+ config_name.downcase!
15
+ super(config_name)
18
16
  end
19
17
 
20
- # key:: name of the config item
21
- # Returns the value of config item named the given key
22
- def self.[](key)
23
- key = key.to_s if key.is_a?(Symbol)
24
- match = Config.filter(:name => key).first
25
- return match ? match.value : nil
18
+ def Config.val(sym)
19
+ s = Config.filter(:name => "#{sym}").first
20
+ return s ? s.value : nil
26
21
  end
27
22
 
28
- # key:: name of the config item
29
- # val:: value of the config item
30
- # Modifies or creates config item and stores the value
31
- def self.[]=(key, val)
32
- key = key.to_s if key.is_a?(Symbol)
33
- model = Config.find_or_create(:name => key)
34
- model.update_with_params(:value => val)
35
- model.save
23
+ def Config.set(sym, value)
24
+ s = Config.find_or_create(:name => "#{sym}")
25
+ s.value = value
26
+ s.save
36
27
  end
37
28
  end
38
29
  end
@@ -1,18 +1,30 @@
1
+ require 'mod_spox/models/Auth'
2
+ require 'mod_spox/models/Signature'
3
+
1
4
  module ModSpox
2
5
  module Models
6
+
3
7
  class Group < Sequel::Model
4
8
 
5
- def name=(group_name)
6
- update_values :name => group_name.downcase
9
+ many_to_many :auth_masks, :join_table => :auth_masks_groups, :class => 'ModSpox::Models::AuthMask'
10
+ many_to_many :auths, :join_table => :auth_groups, :class => 'ModSpox::Models::Auth'
11
+ one_to_many :signature, :class => 'ModSpox::Models::Signature'
12
+
13
+ def Group.filter(args={})
14
+ args[:name].downcase! if args.has_key?(:name)
15
+ super(args)
16
+ end
17
+
18
+ def Group.find_or_create(args={})
19
+ args[:name].downcase! if args.has_key?(:name)
20
+ super(args)
7
21
  end
8
22
 
9
- def auths
10
- auth = []
11
- AuthGroup.filter(:group_id => pk).each do |ag|
12
- auth << ag.auth
13
- end
14
- return auth
23
+ def name=(group_name)
24
+ group_name.downcase!
25
+ super(group_name)
15
26
  end
27
+
16
28
  end
17
29
  end
18
30
  end