== pidgin2adium * http://rubyforge.org/projects/pidgin2adium/ == DESCRIPTION: Pidgin2Adium is a fast, easy way to convert Pidgin (formerly gaim) logs to the Adium format. Note that it assumes a Mac OS X environment with Adium installed. == FEATURES/PROBLEMS: * No problems (well, hopefully). == SYNOPSIS: There are two ways you can use this gem: as a script or as a library. Both require you to provide aliases, which may require a bit of explanation. Adium and Pidgin allow you to set aliases for buddies as well as for yourself, so that you show up in chats as (for example) "Me" instead of as "best_screen_name_ever_018845". However, Pidgin then uses aliases in the log file instead of the actual screen name, which complicates things. To parse properly, this gem needs to know which aliases belong to you so it can map them to the correct screen name. If it encounters an alias that you did not list, it assumes that it belongs to the person to whom you are chatting. Note that aliases are lower-cased and space is removed, so providing "Gabe B-W, GBW" is the same as providing "gabeb-w,gbw". You do not need to provide your screenname in the alias list. ===Example (using script) Assuming that: * your Pidgin log files are in the "pidgin-logs" folder * your various aliases in your chats are "Gabe", "Gabe B-W", and "gbw" Then run (at the command line): $ pidgin2adium -i pidgin-logs -a "Gabe, Gabe B-W, gbw" Or: $ pidgin2adium -i pidgin-logs -a gabe,gabeb-w,gbw ===Example (using library) The library style allows you to parse a log file and get back a LogFile instance for easy reading, manipulation, etc. You can also create log files yourself using Pidgin2Adium.parse_and_generate. require 'pidgin2adium' logfile = Pidgin2Adium.parse("/path/to/log/file.html", "gabe,gbw,gabeb-w") if logfile == false puts "Oh no! Could not parse!" else logfile.each do |message| # Every message has these properties puts "Sender's screen name: #{message.sender}" puts "Time message was sent: #{message.time}" puts "Sender's alias: #{message.buddy_alias}" if [Pidgin2Adium::XMLMessage, Pidgin2Adium::AutoReplyMessage, Pidgin2Adium::Event].include?(message.class) # All of these have a body puts "Message body: #{message.body}" if message.class == Pidgin2Adium::Event puts "Event type: #{message.event_type}" end elsif message.class == Pidgin2Adium::StatusMessage # Only StatusMessage has status puts "Status: #{message.status}" end # Prints out the message in Adium log format puts message.to_s end end ===Example 2 (using library) If you want to output the logfile to an output dir instead of just parsing it, use Pidgin2Adium.parse_and_generate: require 'pidgin2adium' opts = {:overwrite => true, :output_dir => "/my/output/dir"} path_to_converted_log = Pidgin2Adium.parse_and_generate("/path/to/log/file.html", "gabe,gbw,gabeb-w", opts) == REQUIREMENTS: * None == INSTALL: * sudo gem install pidgin2adium == THANKS With thanks to Li Ma, whose blog post at http://li-ma.blogspot.com/2008/10/pidgin-log-file-to-adium-log-converter.html helped tremendously. == LICENSE: (The MIT License) Copyright (c) 2009 Gabriel Berke-Williams Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.