file isExecutable
More MySpace removal.
my %Protocols = ( #Map gaim protocol IDs to Adium ones "jabber"=> "Jabber", # both jabber and gtalk #Add the rest here, or tell me what they are, someone who uses other protocols print "Error: $msg\n\n" if $msg; print "Usage: gaim2adium.pl [--adiumUser <user> | --outDir <output dir>] [--inDir <input dir>] [--yes]\n"; print "Options: (defaults)\n\n"; print "\tinDir:\t\t\tDirectory to import logs from (~/.gaim/logs)\n"; print "\toutDir:\t\t\tDirectory to import logs to (./Logs)\n"; print "\tadiumUser:\t\tAttempt to automatically import logs to the specified Adium user\n"; print "\tforce\t\t\tOverwrite existing logs\n"; print "\tskip\t\t\tSkip existing logs\n"; print "\thelp:\t\t\tDisplay this help.\n"; print "\nOnce the logs have been imported, the contents of outDir can be dragged to your Adium log folder\n\n"; #gaim logs are LOG_BASE/Protocol/Account/Contact/YYYY-MM-DD-TIME.(html|txt) if($File::Find::name =~ m! ^ $inDir # top level dir (?:-(\d{4})\w{3})? # 10 - optional timezone \.(html|txt) # 11 - extension my ($proto,$acct,$contact,$year,$month,$day,$hour,$min,$seconds,$tz,$ext) = ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11); return unless defined ($proto = $Protocols{lc $proto}); if ($proto eq 'Jabber' and $acct =~ /gmail\.com/) { $foundLogs = 1; #Set the logs found flag my $outFN = defined($tz) ? "$contact ($year-$month-${day}T$hour.$min.$seconds-$tz)." : "$contact ($year|$month|$day)."; $outFN .= ((lc $ext) eq "html") ? "html" : "adiumLog"; unless (-d "$outDir/$proto.$acct/$contact") { unless (-d "$outDir/$proto.$acct") { mkdir("$outDir/$proto.$acct") or die "Can't mkdir $outDir/$proto.$acct: $!"; mkdir("$outDir/$proto.$acct/$contact") or die "Can't mkdir $outDir/$proto.$acct/$contact: $!"; my $file = "$outDir/$proto.$acct/$contact/$outFN"; return if(-e $file && $skip); #print(($adiumUser?"$adiumUser already has":"There already exists"), #" a log from $proto.$acct to $contact on $day/$month/$year.\n"); copy($_,$file) or die "Failed to copy $_ to $file: $!"; `touch -t $year$month$day$hour$min.$seconds '$file'`; #Sort a list of log files by time return sort logcmp @files; $t1 = $& if $a =~ /\d{6}/; $t2 = $& if $b =~ /\d{6}/; return 0 unless defined($t1) && defined($t2); GetOptions( "adiumUser=s" => \$adiumUser, usage("You must supply at most one of adiumUser and outDir") if defined($outDir) && defined($adiumUser); $outDir ||= "$ENV{HOME}/Library/Application Support/Adium 2.0/Users/$adiumUser/Logs" if defined $adiumUser; $outDir ||= "$ENV{PWD}/Logs"; $outDir = "$ENV{PWD}/$outDir" unless $outDir =~ m!^/!; $inDir ||= "$ENV{HOME}/.gaim/logs"; print "NOTE: Output directory exists, existing logs will be appended to.\n" if(-d $outDir); mkdir($outDir) unless -e $outDir; usage("Output dir must be a directory") unless -d $outDir; usage("Output dir must be writeable") unless -w $outDir; usage("Input directory '$inDir' does not exist") unless -d $inDir; usage("Input directory '$inDir' is not readable") unless -r $inDir; find({wanted => \&process_log, preprocess => \&sort_logs}, $inDir); #Warn if we didn't find any logs print "Warning: No recognized logs found.\n"; print "Note:\tThis script only supports logs generated by gaim 0.73 and above.\n"; print "\tYou may be able to update older gaim logs to the new format using the script from\n"; print "\thttp://sourceforge.net/forum/message.php?msg_id=2392758\n";