From 93154333a0ae32871b865d5ab2ffe3c6b8f49313 Mon Sep 17 00:00:00 2001
From: b
Date: Tue, 29 Dec 2015 22:07:15 +0000
Subject: [PATCH] interface shows everything button only when needed small bot
improvement
git-svn-id: svn://botcastle1b/yplom/facebug1@12 7dec801f-c475-4e67-ba99-809552d69c55
---
bot.1.pl | 58 ++++++-
configure.pl | 3 +-
interface.1.pl | 461 +++++++++++++++++++++++++++++++++----------------
3 files changed, 364 insertions(+), 158 deletions(-)
diff --git a/bot.1.pl b/bot.1.pl
index 4cbab6b..9ed0d73 100644
--- a/bot.1.pl
+++ b/bot.1.pl
@@ -477,7 +477,7 @@ sub processfile {
# updated if timenumber2 allows it
# Don't overwrite newer information with older.
- if ((($pagetype eq 'thread')and($thread2{'timenumber'} ne '')and($thread2{'timenumber'}>$thread{'timenumber'}))or(($pagetype ne 'thread')and($thread2{'timenumber2'} ne '')and($thread2{'timenumber2'}>$thread{'timenumber2'}))) {
+ if ((($pagetype eq 'thread')and($thread2{'timenumber'} ne '')and($thread2{'timenumber'}>=$thread{'timenumber'}))or(($pagetype ne 'thread')and($thread2{'timenumber2'} ne '')and($thread2{'timenumber2'}>=$thread{'timenumber2'}))) {
print ("Newer version already saved.\n\n");
}
else {
@@ -645,7 +645,7 @@ sub processfile {
}
}
# a link for "more..." outside the
s = past incomplete!
- elsif(($tag{'<'} eq 'a') and ($tag{'href'}=~/^\/groups\/$$settings{'id'}\/?\?(.*&)?id=([^&]+)(&.*)?$/)) {
+ elsif(($tag{'<'} eq 'a') and ($tag{'href'}=~/^\/groups\/$$settings{'id'}\/?\?(.*&)?id=([^&]+)(&.*)?$/) and ($pagetype ne 'thread')) {
unless($incomplete) {
$thread{'postcontent'}.='
Post not completely archived.
';
}
@@ -804,7 +804,7 @@ sub processfile {
print "Can't mkdir $postpath.\n";
}
}
- if(($pagemode eq 'post')and !$firstpost){
+ if(($pagetype eq 'post')and !$firstpost){
$postpath.='postreply/';
}
else {
@@ -821,7 +821,7 @@ sub processfile {
print "Can't mkdir $postpath.\n";
}
}
- if(($pagemode eq 'post')and !$firstpost){
+ if(($pagetype eq 'post')and !$firstpost){
$postpath.=$post{'postid'}.'/';
unless (-d $postpath) {
unless (mkdir $postpath) {
@@ -837,7 +837,7 @@ sub processfile {
%post2 = readdatafile($postfile);
# Don't overwrite newer information with older.
- if (($post2{'timenumber'} ne '')and($post2{'timenumber'}>$post{'timenumber'})) {
+ if (($post2{'timenumber'} ne '')and($post2{'timenumber'}>=$post{'timenumber'})) {
print ("Newer version already saved.\n\n");
}
else {
@@ -889,6 +889,12 @@ sub processfile {
$post{'img-'.$attnumber}='a_'.$2;
$mode = 'post-img';
}
+ # there is a link attached
+ elsif ($tag{'href'} =~ /^https?:\/\/([a-z0-9\.\-]+)?facebook\.com\/l\.php\?(.*&)?u=([^&]+)(&.*)?$/) {
+ ++$attnumber;
+ $post{'link-'.$attnumber}=urldecode($3);
+ $mode = 'post-link';
+ }
# the number of replies may be found in one of these links.
elsif ($tag{'href'} =~ /^\/comment\/replies\/?\?/) {
$mode = 'post-replies';
@@ -913,6 +919,40 @@ sub processfile {
}
}
+ #an attached link
+ elsif ($mode eq 'post-link') {
+ #"title" is found in
'.entityencode($thread{'name'}).(($thread{'timetext'} ne '')?(' • '.$thread{'timetext'}):'').(($thread{'replies'} ne '')?(' • replies: '.$thread{'replies'}):'').'
'.entityencode($$post{'name'}).(($$post{'timetext'} ne '')?(' • '.$$post{'timetext'}):'').(($$post{'replies'} ne '')?(' • replies: '.$$post{'replies'}):'').'
'."\n";
+ print '
'.$$postcontent.'
'."\n";
$first=1;
for(my $ind=1;;++$ind) {
- if($thread{'link-'.$ind} ne ''){
+ if($$post{'link-'.$ind} ne ''){
if($first){
print '