annotate licq2gaim.pl @ 10311:b7566fc34c6c

[gaim-migrate @ 11505] Hitting the enter key when you're cursor is in the alias field of the Add Chat dialog now activates the dialogs default action. Closes bug 1075200 and patch 1078079. Thanks to Andrew Hart for taking a stab at this and wounding, but not killing. Killing is wrong! committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 03 Dec 2004 04:02:10 +0000
parents e967c0d93930
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2803
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 #!/usr/bin/perl -w
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 # licq2gaim.pl
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 #
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 # Arturo Cisneros, Jr <acjr@hal-pc.org>
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 # GPL'd
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 use strict;
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 my $DIR = "$ENV{HOME}/.licq";
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 my $GAIM = "$ENV{HOME}/.gaim";
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 my (@UINS, %USERS) = ();
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 my $OWNER = "";
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 get_uins();
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 foreach my $uin (@UINS) {
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 $USERS{$uin} = get_alias($uin);
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 }
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21 get_owner();
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22 write_list();
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25 sub get_uins {
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 opendir(DIR, "$DIR/users") or die "Couldn't open dir $DIR/users/: $!";
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28 @UINS = grep !/^\./, readdir DIR;
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29 closedir(DIR);
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30 }
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 sub get_owner {
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34 my @foo = ();
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 open(FILE, "<$DIR/owner.uin") or die "Couldn't open file $DIR/owner.uin $!";
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37 while(<FILE>) {
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 next unless /^Uin/;
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39 @foo = split;
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 last;
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41 }
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42 close(FILE);
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44 $OWNER = $foo[2];
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45 }
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47 sub get_alias {
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49 my @foo = ();
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51 open(FILE, "<$DIR/users/$_[0]") or die "Couldn't open $DIR/users/$_[0]: $!";
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 while(<FILE>) {
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53 next unless /^Alias/;
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54 @foo = split / /, $_, 3;
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55 last;
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56 }
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57 close(FILE);
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59 return $foo[2];
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 }
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
62 sub write_list {
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64 # Backup Original
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
65 if( -e "$GAIM/$OWNER.3.blist") {
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66 rename("$GAIM/$OWNER.3.blist","$GAIM/$OWNER.3.bak");
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67 }
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
69 # Write new file
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70 open(FILE, ">$GAIM/$OWNER.3.blist") or die "Couldn't open file for writing: $!";
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71 print FILE "m 1\n";
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72 print FILE "g ICQBuddies\n";
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73 while(my($key, $value) = each %USERS) {
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74 $key =~ s/\.uin$//;
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75 print FILE "b $key:$value";
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76 }
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
77 close(FILE);
e967c0d93930 [gaim-migrate @ 2816]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78 }