annotate mcabber/contrib/mcwizz.rb @ 1224:fb0460a3cf4b

Fix iqscallback_auth() when authentication fails This patch fixes a bug introduced with changeset 4a7db2870685.
author Mikael Berthe <mikael@lilotux.net>
date Thu, 17 May 2007 11:40:27 +0200
parents e86483cb8c39
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1148
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
1 #!/usr/bin/ruby -w
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
2 #
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
3 # Copyright (C) 2006,2007 Adam Wolk "Mulander" <netprobe@gmail.com>
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
4 # Copyright (C) 2006 Mateusz Karkula "Karql"
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
5 #
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
6 # This script is provided under the terms of the GNU General Public License,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
7 # see the file COPYING in the root mcabber source directory.
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
8 #
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
9 #
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
10
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
11 require 'getoptlong'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
12
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
13 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
14 # strings of colors ;)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
15 module Colors
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
16 @@color = true
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
17
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
18 ESC = 27.chr
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
19
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
20 RED = ESC + '[31m'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
21 GREEN = ESC + '[32m'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
22 YELLOW= ESC + '[33m'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
23 BLUE = ESC + '[34m'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
24 PURPLE= ESC + '[35m'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
25 CYAN = ESC + '[36m'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
26
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
27 BGREEN= ESC + '[42m'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
28
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
29 ENDCOL= ESC + '[0m'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
30
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
31 def color(color)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
32 return '[' + self + ']' unless @@color
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
33 color + self + ENDCOL
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
34 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
35 def red; color(RED); end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
36 def green; color(GREEN); end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
37 def yellow; color(YELLOW); end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
38 def blue; color(BLUE); end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
39 def purple; color(PURPLE); end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
40 def cyan; color(CYAN); end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
41 def bgreen; color(BGREEN); end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
42 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
43
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
44 class String; include Colors; end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
45
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
46 class Option
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
47 attr_accessor :value, :current, :default
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
48 attr_reader :name,:msg
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
49
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
50 def initialize(args)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
51 @name = args[:name]
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
52 @msg = args[:msg]
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
53 @default = args[:default]
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
54 @value = nil
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
55 @current = nil
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
56 @prompt = ''
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
57 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
58
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
59 def set?; !@value.nil?; end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
60 def to_s; "set #@name=#@value"; end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
61 def additional?; false; end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
62
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
63 def ask()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
64 puts @msg
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
65 print @prompt
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
66 $stdin.gets.chomp
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
67 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
68
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
69 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
70
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
71 class YesNo < Option
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
72 def initialize(args)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
73 super(args)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
74 @ifSet = args[:ifSet]
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
75 @prompt = '[Yes/no]: '
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
76 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
77 def ask()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
78 # 1 == yes, 0 == no
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
79 case super
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
80 when /^Y/i
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
81 @value = 1
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
82 return additional()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
83 when /^N/i
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
84 @value = 0
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
85 return []
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
86 else
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
87 puts 'Please answer yes or no'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
88 puts
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
89 ask()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
90 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
91 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
92
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
93 def additional?
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
94 (@value == 1 && !@ifSet.nil?) ? true : false
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
95 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
96
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
97 def additional
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
98 (@ifSet.nil?) ? [] : @ifSet
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
99 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
100 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
101
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
102 class Edit < Option
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
103 def initialize(args)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
104 super(args)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
105 @regex = args[:regex]
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
106 @prompt = '[edit]: '
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
107 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
108 def ask()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
109 answer = super
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
110 if answer.empty? || ( !@regex.nil? && !(answer =~ @regex) )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
111 ask()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
112 else
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
113 @value = answer
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
114 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
115 return []
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
116 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
117 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
118
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
119 class Multi < Option
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
120 attr_reader :choices
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
121 def initialize(args)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
122 super(args)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
123 @choices = args[:choices]
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
124 @max = @choices.length - 1
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
125 @prompt = "[0-#{ @max }] "
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
126 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
127
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
128 def ask()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
129 puts @msg
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
130 @choices.each_with_index do |choice,idx|
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
131 print "#{idx}. #{choice}\n"
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
132 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
133 print @prompt
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
134 answer = $stdin.gets.chomp
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
135
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
136 ask() if answer.empty? # we ask here because ''.to_i == 0
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
137
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
138 case answer.to_i
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
139 when 0 ... @max
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
140 @value = answer
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
141 else
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
142 ask()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
143 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
144 return []
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
145 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
146 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
147
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
148 class Wizzard
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
149 VERSION = 0.04
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
150 attr_accessor :options, :ignore_previous, :ignore_auto, :target
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
151 def initialize()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
152 if File.exists?(ENV['HOME'] + '/.mcabberrc')
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
153 @target = ENV['HOME'] + '/.mcabberrc'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
154 else
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
155 Dir.mkdir(ENV['HOME'] + '/.mcabber') unless File.exists?(ENV['HOME'] + '/.mcabber')
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
156 @target = ENV['HOME'] + '/.mcabber/mcabberrc'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
157 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
158 @ignore_previous = false
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
159 @ignore_auto = false
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
160 @options = Hash.new
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
161 @order = Array.new
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
162 @processed = Array.new
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
163 @old = Array.new # for storing the users file untouched
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
164 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
165
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
166 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
167 # add a group of settings to the order queue
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
168 def enqueue(group)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
169 group = group.to_a if group.class.to_s == 'String'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
170 @order += group
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
171 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
172
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
173
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
174 ## adds options to the settings object
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
175 def add(args)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
176 @options[args[:name]] = args[:type].new(args)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
177 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
178
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
179 ## run the wizzard
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
180 def run()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
181 parse()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
182 display(@order)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
183 save()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
184 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
185
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
186 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
187 # displays the setting and allows the user to modify it
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
188 def display(order)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
189 order.each do |name|
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
190 # this line here is less efficient then on the end of this method
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
191 # but if placed on the end, recursion then breaks the order of settings
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
192 @processed.push(name)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
193 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
194 # I know this is not efficient, but I have no better idea to modify the default port
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
195 @options['port'].default = 5223 if @options['ssl'].value == 1
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
196
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
197 puts
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
198 puts "'#{name}'"
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
199 puts @options[name].msg
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
200 puts 'e'.green + 'dit setting'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
201 puts 'l'.green + 'eave current setting ' + show(@options[name],:current).cyan unless @options[name].current.nil?
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
202 puts 'u'.green + 'se default ' + show(@options[name],:default).cyan unless @options[name].default.nil?
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
203 puts 's'.green + 'kip'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
204 puts 'a'.red + 'bort configuration'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
205 print '[action]: '
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
206 case $stdin.gets.chomp
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
207 when /^s/
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
208 next
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
209 when /^l/
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
210 @options[name].value = @options[name].current
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
211 display(@options[name].additional) if @options[name].additional?
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
212 when /^u/
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
213 @options[name].value = @options[name].default
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
214 display(@options[name].additional) if @options[name].additional?
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
215 when /^e/
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
216 additional = @options[name].ask
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
217 display(additional) if additional.empty?
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
218 when /^a/
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
219 puts 'aborted!!'.red
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
220 exit
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
221 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
222 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
223 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
224
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
225 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
226 # this allows us to print 'yes' 'no' or descriptions of multi option settings
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
227 # insted of just showing an integer
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
228 def show(option,type)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
229 value = ''
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
230 if type == :default
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
231 value = option.default
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
232 else
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
233 value = option.current
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
234 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
235
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
236 case option.class.to_s
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
237 when 'YesNo'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
238 return (value.to_i==1) ? 'yes' : 'no'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
239 when 'Multi'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
240 return option.choices[value.to_i]
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
241 else
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
242 return value.to_s
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
243 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
244 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
245
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
246 ## save
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
247 # save all settings to a file
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
248 def save()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
249 flag,dumped = true,false
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
250 target = File.new(@target,"w")
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
251
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
252 @old.each do |line|
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
253 flag = false if line =~ /^#BEGIN AUTO GENERATED SECTION/
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
254 flag = true if line =~ /^#END AUTO GENERATED SECTION/
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
255 if flag
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
256 target << line
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
257 elsif( !flag && !dumped )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
258 target << "#BEGIN AUTO GENERATED SECTION\n\n"
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
259 @processed.each do |name|
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
260 target << @options[name].to_s + "\n" if @options[name].set?
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
261 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
262 puts
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
263 dumped = true
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
264 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
265 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
266
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
267 unless dumped
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
268 target << "#BEGIN AUTO GENERATED SECTION\n\n"
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
269 @processed.each do |name|
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
270 target << @options[name].to_s + "\n" if @options[name].set?
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
271 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
272 target << "#END AUTO GENERATED SECTION\n\n"
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
273 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
274
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
275 target.close
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
276 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
277 ## parse
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
278 # attempt to load settings from file
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
279 def parse()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
280 return if @ignore_previous
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
281 return unless File.exists?(@target)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
282 keyreg = @options.keys.join('|')
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
283 parse = true
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
284 File.open(@target) do |config|
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
285 config.each do |line|
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
286
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
287 @old << line
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
288 parse = false if @ignore_auto && line =~ /^#BEGIN AUTO GENERATED SECTION/
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
289 parse = true if @ignore_auto && line =~ /^#END AUTO GENERATED SECTION/
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
290
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
291 if parse && line =~ /^set\s+(#{keyreg})\s*=\s*(.+)$/
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
292 @options[$1].current = $2 if @options.has_key?($1)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
293 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
294
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
295 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
296 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
297 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
298
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
299 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
300 # display onscreen help
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
301 def Wizzard.help()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
302 puts %{
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
303 Usage: #{ $0.to_s.blue } #{ 'options'.green }
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
304
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
305 This script generates configuration files for mcabber jabber client
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
306
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
307 #{ "Options:".green }
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
308 #{ "-h".green }, #{ "--help".green } display this help screen
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
309 #{ "-v".green }, #{ "--version".green } display version information
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
310 #{ "-T".green }, #{ "--target".green } configuration file
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
311 #{ "-i".green }, #{ "--ignore".green } ignore previous configuration
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
312 #{ "-I".green }, #{ "--ignore-auto".green } ignore auto generated section
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
313 #{ "-S".green }, #{ "--status".green } ask for status settings
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
314 #{ "-P".green }, #{ "--proxy".green } ask for proxy settings
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
315 #{ "-k".green }, #{ "--keep".green } ping/keepalive connection settings
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
316 #{ "-t".green }, #{ "--tracelog".green } ask for tracelog settings
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
317 #{ "-C".green }, #{ "--nocolor".green } turn of color output
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
318 }
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
319 exit
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
320 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
321
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
322 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
323 # display version information
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
324 def Wizzard.version()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
325 puts "mcwizz v#{VERSION.to_s.purple} coded by #{ 'Karql'.purple } & #{ 'mulander'.purple } <netprobe@gmail.com>"
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
326 exit
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
327 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
328 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
329
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
330 required = %w{ username server resource nickname ssl port pgp logging }
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
331 proxy = %w{ proxy_host proxy_port proxy_user proxy_pass }
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
332 status = %w{ buddy_format roster_width show_status_in_buffer autoaway message message_avail message_free
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
333 message_dnd message_notavail message_away message_autoaway }
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
334 tracelog = %w{ tracelog_level tracelog_file }
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
335
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
336 opts = GetoptLong.new(
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
337 ["--help","-h", GetoptLong::NO_ARGUMENT],
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
338 ["--version","-v", GetoptLong::NO_ARGUMENT],
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
339 ["--target", "-T", GetoptLong::REQUIRED_ARGUMENT],
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
340 ["--ignore","-i", GetoptLong::NO_ARGUMENT],
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
341 ["--ignore-auto","-I",GetoptLong::NO_ARGUMENT],
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
342 ["--proxy","-P", GetoptLong::NO_ARGUMENT],
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
343 ["--keep","-k", GetoptLong::NO_ARGUMENT],
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
344 ["--status","-S", GetoptLong::NO_ARGUMENT],
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
345 ["--tracelog","-t", GetoptLong::NO_ARGUMENT],
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
346 ["--nocolor","-C", GetoptLong::NO_ARGUMENT]
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
347 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
348
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
349 opts.ordering = GetoptLong::REQUIRE_ORDER
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
350
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
351 config = Wizzard.new()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
352 config.enqueue(required)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
353 config.enqueue( %w{ beep_on_message hide_offline_buddies iq_version_hide_os autoaway } )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
354
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
355 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
356 # Description of the add() syntax
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
357 # :name - name of the setting
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
358 # :msg - message displayed to the user
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
359 # :type - type of settings - avaible types are: YesNo, Edit, Multi
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
360 # :default - default setting
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
361 # YesNo type specific flag:
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
362 # :ifSet - an array of other options, that will be asked if the flag holding option is set to true
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
363 # Edit type specific flag:
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
364 # :regex- regular expression to which input will be compared
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
365 # Multi type specific flag:
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
366 # :choices - an array of possible settings
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
367 #
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
368
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
369 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
370 # here we add all the settings that we want to be able to handle
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
371
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
372 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
373 # ungrouped settings
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
374 config.add( :name => 'beep_on_message',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
375 :msg => 'Should mcabber beep when you receive a message?',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
376 :type => YesNo,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
377 :default => 0 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
378
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
379 config.add( :name => 'hide_offline_buddies',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
380 :msg => 'Display only connected buddies in the roster?',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
381 :type => YesNo,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
382 :default => 0 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
383
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
384 config.add( :name => 'pinginterval',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
385 :msg => 'Enter pinginterval in seconds for keepalive settings' \
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
386 ' set this to 0 to disable.',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
387 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
388 :regex => /^\d+$/,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
389 :default => 40)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
390
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
391 config.add( :name => 'iq_version_hide_os',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
392 :msg => 'Hide Your OS information?',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
393 :type => YesNo,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
394 :default => 0 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
395
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
396
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
397 config.add( :name => 'port',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
398 :msg => 'Enter port number',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
399 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
400 :regex => /^\d+$/,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
401 :default => 5222 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
402
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
403 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
404 # server settings
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
405 config.add( :name => 'username',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
406 :msg => 'Your username',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
407 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
408 :regex => /^[^\s\@:<>&\'"]+$/ )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
409
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
410 config.add( :name => 'server',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
411 :msg => 'Your jabber server',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
412 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
413 :regex => /^\S+$/ )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
414
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
415 config.add( :name => 'resource',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
416 :msg => 'Resource (If you don\'t know what a resource is, use the default setting)',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
417 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
418 :regex => /^.{1,1024}$/,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
419 :default => 'mcabber' )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
420
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
421 config.add( :name => 'nickname',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
422 :msg => 'Conference nickname (if you skip this setting your username will be used as' \
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
423 ' nickname in MUC chatrooms)',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
424 :type => Edit )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
425
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
426 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
427 # ssl settings
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
428 config.add( :name => 'ssl',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
429 :msg => 'Enable ssl?',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
430 :type => YesNo,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
431 :ifSet => %w{ ssl_verify ssl_cafile ssl_capath ciphers },
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
432 :default => 0 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
433
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
434
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
435 config.add( :name => 'ssl_verify',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
436 :msg => 'Set to 0 to disable certificate verification, or non-zero to set desired maximum CA' \
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
437 ' verification depth. Use -1 to specify an unlimited depth.',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
438 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
439 :regex => /^(-1)|(\d+)$/,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
440 :default => -1 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
441
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
442 config.add( :name => 'ssl_cafile',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
443 :msg => 'Set to a path to a CA certificate file (may contain multiple CA certificates)',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
444 :type => Edit )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
445
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
446 config.add( :name => 'ssl_capath',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
447 :msg => 'Set to a directory containing CA certificates (use c_rehash to generate hash links)',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
448 :type => Edit )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
449
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
450 config.add( :name => 'ciphers',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
451 :msg => 'Set to a list of desired SSL ciphers (run "openssl ciphers" for a candidate values)',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
452 :type => Edit )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
453
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
454 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
455 # pgp support
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
456 config.add( :name => 'pgp',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
457 :msg => 'Enable OpenPGP support?',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
458 :type => YesNo,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
459 :ifSet => %w{ pgp_private_key },
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
460 :default => 0 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
461
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
462 config.add( :name => 'pgp_private_key',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
463 :msg => 'Enter your private key id. You can get the Key Id with gpg: ' \
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
464 '"gpg --list-keys --keyid-format long"',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
465 :type => Edit )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
466 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
467 # proxy settings
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
468 config.add( :name => 'proxy_host',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
469 :msg => 'Proxy host',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
470 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
471 :regex => /^\S+?\.\S+?$/ )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
472
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
473 config.add( :name => 'proxy_port',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
474 :msg => 'Proxy port',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
475 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
476 :regex => /^\d+$/,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
477 :default => 3128 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
478
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
479 config.add( :name => 'proxy_user',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
480 :msg => 'Proxy user',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
481 :type => Edit )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
482
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
483 config.add( :name => 'proxy_pass',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
484 :msg => 'Proxy pass (will be stored unencrypted an the pass will be echoed during input)',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
485 :type => Edit )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
486 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
487 # trace logs
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
488 config.add( :name => 'tracelog_level',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
489 :msg => 'Specify level of advanced traces',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
490 :type => Multi,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
491 :choices => [ 'lvl0: I don\'t want advanced tracing',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
492 'lvl1: most events of the log window are written to the file',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
493 'lvl2: debug logging (XML etc.)' ],
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
494 :default => 0 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
495
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
496 config.add( :name => 'tracelog_file',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
497 :msg => 'Specify a file to which the logs will be written',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
498 :type => Edit )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
499 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
500 # logging settings
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
501 config.add( :name => 'logging',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
502 :msg => 'Enable logging?',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
503 :type => YesNo,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
504 :ifSet => %w{ log_win_height log_display_sender load_logs logging_dir log_muc_conf},
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
505 :default => 1 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
506
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
507 config.add( :name => 'log_win_height',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
508 :msg => 'Set log window height (minimum 1)',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
509 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
510 :regex => /^[1-9]\d*/,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
511 :default => 5 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
512
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
513 config.add( :name => 'log_display_sender',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
514 :msg => 'Display the message sender\'s jid in the log window?',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
515 :type => YesNo,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
516 :default => 0 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
517
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
518 config.add( :name => 'load_logs',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
519 :msg => 'Enable loading logs?',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
520 :type => YesNo,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
521 :default => 1 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
522
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
523 config.add( :name => 'logging_dir',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
524 :msg => 'Enter logging directory',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
525 :type => Edit )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
526
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
527 config.add( :name => 'log_muc_conf',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
528 :msg => 'Log MUC chats?',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
529 :ifSet => %w{ load_muc_logs },
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
530 :type => YesNo,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
531 :default => 1 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
532
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
533 config.add( :name => 'load_muc_logs',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
534 :msg => 'Load MUC chat logs?',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
535 :type => YesNo,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
536 :default => 0 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
537 ##
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
538 # status settings
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
539 config.add( :name => 'roster_width',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
540 :msg => 'Set buddylist window width (minimum 2)',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
541 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
542 :regex => /^[2-9]\d*$/,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
543 :default => 24 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
544
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
545 config.add( :name => 'buddy_format',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
546 :msg => 'What buddy format (in status window) do you prefer?',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
547 :type => Multi,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
548 :choices => [ '<jid/resource>',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
549 'name <jid/resource> (name is omitted if same as the jid)',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
550 'name/resource (if the name is same as the jid, use <jid/res>',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
551 'name (if the name is the same as the jid, use <jid/res>' ] )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
552
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
553 config.add( :name => 'show_status_in_buffer',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
554 :msg => 'What status changes should be displayed in the buffer?',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
555 :type => Multi,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
556 :choices => [ 'none',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
557 'connect/disconnect',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
558 'all' ],
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
559 :default => 2 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
560
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
561 config.add( :name => 'autoaway',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
562 :msg => 'After how many seconds of inactivity should You become away? (0 for never)',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
563 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
564 :regex => /^\d+$/,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
565 :default => 0 )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
566
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
567 config.add( :name => 'message',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
568 :msg => 'Skip this setting unless you want to override all other status messages',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
569 :type => Edit )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
570
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
571 config.add( :name => 'message_avail',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
572 :message => 'Set avaible status',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
573 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
574 :default => 'I\'m avaible' )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
575
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
576
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
577 config.add( :name => 'message_free',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
578 :message => 'Set free for chat status',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
579 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
580 :default => 'I\'m free for chat' )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
581
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
582 config.add( :name => 'message_dnd',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
583 :message => 'Set do not disturb status',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
584 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
585 :default => 'Please do not disturb' )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
586
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
587 config.add( :name => 'message_notavail',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
588 :message => 'Set not avaible status',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
589 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
590 :default => 'I\'m not avaible' )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
591
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
592 config.add( :name => 'message_away',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
593 :message => 'Set away status',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
594 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
595 :default => 'I\'m away' )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
596
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
597 config.add( :name => 'message_autoaway',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
598 :msg => 'Set auto-away status',
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
599 :type => Edit,
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
600 :default => 'Auto-away' )
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
601
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
602 begin
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
603 opts.each do |opt,arg|
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
604 case opt
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
605 when '--help'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
606 Wizzard.help()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
607 when '--version'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
608 Wizzard.version()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
609 when '--target'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
610 config.target = arg
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
611 when '--ignore'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
612 config.ignore_previous = true
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
613 when '--ignore-auto'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
614 config.ignore_auto = true
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
615 when '--proxy'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
616 config.enqueue(proxy)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
617 when '--keep'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
618 config.enqueue('pinginterval')
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
619 when '--tracelog'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
620 config.enqueue(tracelog)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
621 when '--status'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
622 config.enqueue(status)
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
623 when '--nocolor'
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
624 class String; @@color = false; end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
625 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
626 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
627 rescue GetoptLong::InvalidOption
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
628 Wizzard.help()
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
629 end
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
630
e86483cb8c39 Update mcwizz setup script (Mulander)
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
631 config.run