Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add `--part-on-away` to leave channels when away.

  • Loading branch information...
commit 024756636e7469d857e7356b8b4d0274e1b23263 1 parent 31d2c89
@eatnumber1 eatnumber1 authored
View
5 bin/camper_van
@@ -46,6 +46,8 @@ Options:
opt :pid, 'Path of the PID file', :type => :string,
:default => '/var/run/camper_van.pid'
+
+ opt :part_on_away, 'Part from channels when going away'
end
opts = Trollop.with_standard_exception_handling parser do
@@ -80,7 +82,8 @@ else
:ssl_cert => opts[:ssl_cert],
:ssl_verify_peer => opts[:ssl_verify_peer],
:daemon => opts[:daemon],
- :pid => opts[:pid]
+ :pid => opts[:pid],
+ :part_on_away => opts[:part_on_away]
)
end
View
7 lib/camper_van/ircd.rb
@@ -26,6 +26,9 @@ class IRCD
# Set to false when shutting down so extra commands are ignored.
attr_reader :active
+ # Additional options
+ attr_reader :options
+
MOTD = <<-motd
Welcome to CamperVan.
To see what campfire rooms are available to the
@@ -41,12 +44,13 @@ class IRCD
# Public: initialize an IRC server connection
#
# client - the EM connection representing the IRC client
- def initialize(client)
+ def initialize(client, options = {})
@client = client
@active = true
@channels = {}
@away = false
@saved_channels = nil
+ @options = options
end
# The campfire client
@@ -245,6 +249,7 @@ def shutdown
end
handle :away do |args|
+ next unless options[:part_on_away]
if @away
user_reply 305, "You are no longer marked as being away"
@saved_channels.each do |channel|
View
2  lib/camper_van/server.rb
@@ -109,7 +109,7 @@ def post_init(*args)
@lt2_delimiter = "\r\n"
# start up the IRCD for this connection
- @ircd = IRCD.new(self)
+ @ircd = IRCD.new(self, options)
if options[:ssl]
logger.info "starting TLS for #{remote_ip}"
Please sign in to comment.
Something went wrong with that request. Please try again.