Created
August 19, 2011 06:42
-
-
Save dnpp73/1156210 to your computer and use it in GitHub Desktop.
TIG2YF.ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rexml/document' | |
Me = 'DNPP' | |
TIG_xml_path = '/Users/dnpp/Dropbox/TIGConfig/DNPP/Groups.xml' | |
tig_xml = String.new | |
open(TIG_xml_path,'r'){|fl| tig_xml = REXML::Document.new(fl) } | |
groups = Array.new | |
tig_xml.elements['/ArrayOfGroup'].each do |gr| | |
channel_name = gr.elements['Name'].text | |
members = Array.new | |
if gr.elements['Members/*'] | |
gr.elements['Members'].each do |mb| | |
members << mb.text.to_s | |
end | |
end | |
topic = String.new | |
if gr.elements['Topic'] | |
topic = gr.elements['Topic'].text.to_s | |
end | |
members << Me | |
gr.elements['ChannelModes/ChannelMode/Mode'].each do |cm| | |
if cm == 'Private' | |
members.delete(Me) | |
end | |
end | |
groups << [channel_name,members,topic] | |
end | |
groups.each do |a| | |
puts a[0] | |
puts a[1].join(',') | |
puts a[2] | |
puts '---' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment