Support Requests item #1150005, was opened at 2005-02-23 13:18 Message generated for change (Comment added) made by lschiere You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=200235&aid=1150005&group_id=235 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Pending Priority: 5 Private: No Submitted By: cheezeflap (cheezeflap) Assigned to: Etan Reisner (deryni9) Summary: plugin autoresponder Initial Comment: I am writing a plugin for an autoresponder that needs to respond with a message if it recieves a message containing a specif text. The following script works well for me if I have a window (session?) open allready for the person sending the text. In other words it does not work the first time they send me the key text but will work everytime after that until I close the window. Here is what I have: use Gaim; %PLUGIN_INFO = ( perl_api_version => 2, name => "reponder", version => "2.0", summary => "Does things.", description => "Really does things", author => "Jon", url => "http://www.removed.com/", load => "plugin_load" ); sub plugin_init { return %PLUGIN_INFO; } sub plugin_load { my $plugin = shift; my $data = ""; Gaim::signal_connect(Gaim::Conversations::handle, "received-im-msg", $plugin, \&echo_reply, $data); } sub echo_reply { my $account = $_[0]; my $sender = $_[1]; my $msgtext = $_[2]; my $flags = $_[3]; $msgtext = filter($msgtext); if ($msgtext =~ /^GET THIS KEYWORD$/) { $ReplyMsg = "SEND THIS REPONCE"; Gaim::Conversation::IM::send(getConversation($sender),$ReplyMsg); } sub getConversation { my $sender = $_[0]; my $i; my @im_array = Gaim::ims(); #get the array of IM's for ($i = 0; $i <= $#im_array; $i++) { if ( Gaim::Conversation::get_name( Gaim::Conversation::IM::get_conversation ( $im_array[$i] ) ) eq $sender ) { return $im_array[$i]; #return the correct IM } } return null; } sub filter($;$$) { #remove html tags my ($text, $tags, $alltags) = @_; if($alltags != 1) { if(!scalar(@${tags})) { #@{$tags} = (qw|<a> <br> <i> <b> <h1> <h2> <h3> <h4>|); @{$tags} = (qw||); } } # remove optional < > around valid tags foreach my $tag (@{$tags}) { $tag =~ s/^<?(.+?)>?$/$1/e; } $text =~ s/(<\s*\/?([^\s=>]*).*?>) # match exactly html tag / grep(m|^\Q$2\E$|i, @{$tags}) # if the first non-whitespace token in the tag # can be found in @tags, keep it ? $1 : "" /isegx; # otherwise, remove tag return $text; } ---------------------------------------------------------------------- Comment By: Luke Schierer (lschiere) Date: 2006-12-15 00:28 Message: Logged In: YES user_id=28833 Originator: NO This bug is fixed in the most recent version of Gaim. If you are not using the lastest version, please upgrade. If you are using the latest version, please indicate so and reopen this bug. ---------------------------------------------------------------------- Comment By: Jeffery To (coderjeff) Date: 2005-02-23 17:38 Message: Logged In: YES user_id=1089354 See bug 1112450: https://sourceforge.net/tracker/?group_id=235&atid=100235&func=detail&aid=1112450 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=200235&aid=1150005&group_id=235 ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Gaim-support mailing list Gaim-support@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/gaim-support