~ubuntu-branches/ubuntu/jaunty/quassel/jaunty

« back to all changes in this revision

Viewing changes to scripts/convert_mirc_servers_ini.pl

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2009-01-14 01:28:49 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090114012849-38celzez3y3wpai9
Tags: 0.4.0~git090113-0ubuntu1
* New upstream git snapshot
  - Use networks.ini to provide default network/channel
  - Provide presets for common IRC networks
* Add kubuntu_01_default_network_channel.patch to set Freenode, port
  8001, and #kubuntu as defaults
* Add build-dep on quilt

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
# Take mIRC's servers.ini and create a networks.ini suitable for Quassel.
 
4
 
 
5
use strict;
 
6
 
 
7
my $serverlist = {};
 
8
 
 
9
open SERVERS_INI, "<servers.ini" or die "Could not open servers.ini";
 
10
while(<SERVERS_INI>) {
 
11
  my ($host, $portrange, $net) = /SERVER:(.+):(.+)GROUP:(.+)\r\n/;
 
12
  if($host) {
 
13
    foreach(split /,/, $portrange) {
 
14
      s/(\d+)-\d+/$1/;
 
15
      push @{$serverlist->{$net}}, { Host => $host, Port => $_};
 
16
    }
 
17
  }
 
18
}
 
19
close SERVERS_INI;
 
20
 
 
21
open NETWORKS_INI, ">networks.ini" or die "Could not open networks.ini for writing";
 
22
foreach(sort keys %$serverlist) {
 
23
  print NETWORKS_INI "[$_]\n";
 
24
  my @servers;
 
25
  foreach(@{$serverlist->{$_}}) {
 
26
    push @servers, "$_->{Host}:$_->{Port}";
 
27
  }
 
28
  print NETWORKS_INI "Servers=", join ',', @servers;
 
29
  print NETWORKS_INI "\n\n";
 
30
}
 
31
close NETWORKS_INI;
 
32
 
 
33
print "Done.\n";