1 # Blosxom Plugin: ping_weblogs_com
2 # Author(s): Rael Dornfest <rael@oreilly.com>
4 # Documentation: See the bottom of this file or type: perldoc ping_weblogs_com
6 package ping_weblogs_com;
8 # --- Configurable variables -----
10 # What URL should this plugin ping?
11 my $ping_url = "http://newhome.weblogs.com/pingSiteForm?name=" . encode($blosxom::blog_title) . "&url=" . encode($blosxom::url);
13 # What external program should this plugin use to ping Weblogs.com?
15 # 'wget --quiet -U "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" -O -';
19 # --------------------------------
24 # Keep track of the newest story's mtime
29 print STDERR "here\n";
34 my($pkg, $files_ref) = @_;
36 $newest = $files_ref->{( sort { $files_ref->{$b} <=> $files_ref->{$a} } keys %$files_ref )[0]};
42 # If no timestamped touch-file or newest is newer than the touch-file...
43 if ( !-e "$blosxom::plugin_state_dir/.ping_weblogs_com.output" or $newest > stat("$blosxom::plugin_state_dir/.ping_weblogs_com.output")->mtime ) {
47 my $fh = new FileHandle;
48 $fh->open(qq{$get_app "$ping_url" |});
51 $_ =~ /Thanks for the ping/ and $ping_success++, last;
55 $ping_success or return 0;
57 # Touch the touchfile (creates if doesn't already exist)
58 open TOUCH, "> $blosxom::plugin_state_dir/.ping_weblogs_com.output";
59 print TOUCH $response;
73 $encodings{chr($_)} = sprintf("%%%02X", $_);
76 $string =~ s/([^A-Za-z0-9\-_.!~*'()])/$encodings{$1}/g;
86 Blosxom Plug-in: ping_weblogs_com
90 Purpose: Notifies weblogs.com [http://www.weblogs.com] that your weblog
91 has been updated upon encountering any new story.
93 Maintains a touch-file ($blosxom::plugin_state_dir/.ping_weblogs_com.output)
94 to which to compare the newest story's creation date. Fills the
95 touch-file with the HTML results of the latest ping.
101 Version number coincides with the version of Blosxom with which the
102 current version was first bundled.
106 Rael Dornfest <rael@oreilly.com>, http://www.raelity.org/
110 Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/
112 Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml
116 Address bug reports and comments to the Blosxom mailing list
117 [http://www.yahoogroups.com/group/blosxom].
121 Blosxom and this Blosxom Plug-in
122 Copyright 2003, Rael Dornfest
124 Permission is hereby granted, free of charge, to any person obtaining a
125 copy of this software and associated documentation files (the "Software"),
126 to deal in the Software without restriction, including without limitation
127 the rights to use, copy, modify, merge, publish, distribute, sublicense,
128 and/or sell copies of the Software, and to permit persons to whom the
129 Software is furnished to do so, subject to the following conditions:
131 The above copyright notice and this permission notice shall be included
132 in all copies or substantial portions of the Software.
134 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
135 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
136 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
137 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
138 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
139 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
140 OTHER DEALINGS IN THE SOFTWARE.