#!/usr/bin/perl

##########################################################################
#                                                                        #
#  aim_webhandler - Perl helper application to handle the aim: protocol  #
#                                                                        #
#  Copyright (c) 2003 by Jason Keirstead <jason@keirstead.org>           #
#                                                                        #
#  Kopete    (c) 2002 by the Kopete developers  <kopete-devel@kde.org>   #
#                                                                        #
##########################################################################
#                                                                        #
#  This program is free software; you can redistribute it and/or modify  #
#  it under the terms of the GNU General Public License as published by  #
#  the Free Software Foundation; either version 2 of the License, or     #
#  (at your option) any later version.                                   #
#                                                                        #
##########################################################################

# Get rid of any whitespace
chomp($ARGV[0]);

# Check if we are mesaging someone
if ( $ARGV[0] =~ /aim:goim\?screenname=(.*)&message=(.*)/ )
{
	$buddy = $1;
	$message = $2;
	$message =~ s/\+/ /g;

	`dcop kopete KopeteIface addContact "Oscar" "$buddy" "$buddy"`;

	#TODO MESSAGE THE USER
	
# Check if we are adding someone
} elsif ( $ARGV[0] =~ /aim:addbuddy\?screenname=(.*)/ ) {
	$buddy = $1;

	`dcop kopete KopeteIface addContact "Oscar" "$buddy" "$buddy"`;
}
