Compare commits

..

No commits in common. "fbd6543aa20b611d953fd79f7c2b6a05c5f24ec7" and "1799500b0fe590d3386e45a3b556c22bb8b726d1" have entirely different histories.

88 changed files with 1056 additions and 3249 deletions

View File

@ -12,12 +12,6 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="module" value="true"/>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar"/>
<classpathentry kind="lib" path="lib/commons-cli-1.4.jar"/>
@ -35,11 +29,15 @@
<classpathentry kind="lib" path="lib/twitter4j-core-4.0.4.jar" sourcepath="lib/twitter4j-core-4.0.4-src.zip"/>
<classpathentry kind="lib" path="lib/twitter4j-media-support-4.0.4.jar" sourcepath="lib/twitter4j-media-support-4.0.4-src.zip"/>
<classpathentry kind="lib" path="lib/twitter4j-stream-4.0.4.jar" sourcepath="lib/twitter4j-stream-4.0.4-src.zip"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.25.jar" sourcepath="lib/Logs/slf4j-api-1.7.25-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.25.jar" sourcepath="lib/Logs/slf4j-log4j12-1.7.25-sources.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.12.jar" sourcepath="lib/UnitTesting/junit-4.12-sources.jar"/>
<classpathentry kind="lib" path="lib/devinsy-strings-0.8.2.jar" sourcepath="lib/devinsy-strings-0.8.2-sources.zip"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.8.jar" sourcepath="lib/commons-lang3-3.8-sources.jar"/>
<classpathentry kind="lib" path="lib/json-simple-1.1.1.jar" sourcepath="lib/json-simple-1.1.1-source.zip"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

1
.gitignore vendored
View File

@ -4,4 +4,3 @@
/bin/
/dist/
/build/
*~

View File

@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@ -33,7 +33,6 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
@ -77,7 +76,6 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=igno
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
@ -110,10 +108,8 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
@ -121,20 +117,17 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
@ -220,12 +213,11 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@ -256,8 +248,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@ -282,17 +272,13 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@ -340,8 +326,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do no
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@ -378,12 +362,9 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@ -409,11 +390,7 @@ org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter

View File

@ -13,38 +13,28 @@ cleanup.always_use_this_for_non_static_field_access=true
cleanup.always_use_this_for_non_static_method_access=false
cleanup.convert_functional_interfaces=false
cleanup.convert_to_enhanced_for_loop=false
cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false
cleanup.correct_indentation=false
cleanup.format_source_code=true
cleanup.format_source_code_changes_only=false
cleanup.insert_inferred_type_arguments=false
cleanup.lazy_logical_operator=false
cleanup.make_local_variable_final=false
cleanup.make_parameters_final=true
cleanup.make_private_fields_final=false
cleanup.make_type_abstract_if_missing_method=false
cleanup.make_variable_declarations_final=true
cleanup.merge_conditional_blocks=false
cleanup.never_use_blocks=false
cleanup.never_use_parentheses_in_expressions=true
cleanup.number_suffix=false
cleanup.objects_equals=false
cleanup.organize_imports=false
cleanup.precompile_regex=false
cleanup.push_down_negation=false
cleanup.qualify_static_field_accesses_with_declaring_class=false
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
cleanup.qualify_static_member_accesses_with_declaring_class=true
cleanup.qualify_static_method_accesses_with_declaring_class=false
cleanup.remove_private_constructors=true
cleanup.remove_redundant_modifiers=false
cleanup.remove_redundant_semicolons=false
cleanup.remove_redundant_type_arguments=false
cleanup.remove_redundant_type_arguments=true
cleanup.remove_trailing_whitespaces=true
cleanup.remove_trailing_whitespaces_all=true
cleanup.remove_trailing_whitespaces_ignore_empty=false
cleanup.remove_unnecessary_array_creation=false
cleanup.remove_unnecessary_casts=true
cleanup.remove_unnecessary_nls_tags=true
cleanup.remove_unused_imports=true
@ -53,14 +43,11 @@ cleanup.remove_unused_private_fields=true
cleanup.remove_unused_private_members=false
cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true
cleanup.simplify_lambda_expression_and_method_ref=false
cleanup.sort_members=true
cleanup.sort_members_all=false
cleanup.use_anonymous_class_creation=false
cleanup.use_autoboxing=false
cleanup.use_blocks=true
cleanup.use_blocks_only_for_return_and_throw=false
cleanup.use_directly_map_method=false
cleanup.use_lambda=true
cleanup.use_parentheses_in_expressions=false
cleanup.use_this_for_non_static_field_access=true
@ -68,8 +55,6 @@ cleanup.use_this_for_non_static_field_access_only_if_necessary=false
cleanup.use_this_for_non_static_method_access=false
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup.use_type_arguments=false
cleanup.use_unboxing=false
cleanup.use_var=false
cleanup_profile=_Hebdobot
cleanup_settings_version=2
eclipse.preferences.version=1
@ -77,7 +62,6 @@ editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Hebdobot
formatter_settings_version=12
jautodoc.cleanup.add_header=false
jautodoc.cleanup.javadoc=false
jautodoc.cleanup.replace_header=false
org.eclipse.jdt.ui.exception.name=exception
org.eclipse.jdt.ui.gettersetter.use.is=true

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="11"/>
<installed facet="java" version="1.8"/>
</faceted-project>

View File

@ -1,6 +1,6 @@
* Changed license from GNU GPL v3 to GNU AGPL v3+.
* Changed license from GNU GPL v3 to GNU AGPL v3.
Le 08/01/2018 à 01:07, aeris a écrit :
> From: aeris <aeris@imirhil.fr>

View File

@ -1,52 +0,0 @@
# Hebdobot
Hebdobot est le bot de gestion de la revue hebdomadaire de l'April.
Présentation de la revue hebdomadaire : https://www.april.org/revues-hebdomadaires-april
La revue hebdo dispose d'un bot IRC qui gère les logs et la synthèse de la revue hebdo : Hebdobot.
Hebdobot est un logiciel libre sous licence GNU AGPLv3+ édité par l'April dont le projet est géré ici : https://agir.april.org/projects/hebdobot.
Résultat de la commande !aide :
```
15:26 <Hebdobot> Bienvenue cpm_screen
15:26 <Hebdobot> Je suis Hebdobot-dev, le robot de gestion des revues hebdomadaires de l'APRIL.
15:26 <Hebdobot> Voici les commandes que je comprends :
15:26 <Hebdobot>
15:26 <Hebdobot> !aide,!help : afficher cette aide
15:26 <Hebdobot> !début : commencer une nouvelle revue
15:26 <Hebdobot> # titre : démarrer un sujet individuel
15:26 <Hebdobot> ## titre : démarrer un sujet collectif
15:26 <Hebdobot> % message : traiter comme un commentaire
15:26 <Hebdobot> !courant : afficher le sujet en cours
15:26 <Hebdobot> !manquants : afficher qui n'a pas participé sur le dernier sujet
15:26 <Hebdobot> !fin : terminer la revue en cours
15:26 <Hebdobot> !stop : abandonner la revue en cours
15:26 <Hebdobot> !licence : afficher la licence du logiciel Hebdobot et le lien vers ses sources
15:26 <Hebdobot> !record : affiche le record de participation à la revue
15:26 <Hebdobot> !stats : statistiques sur les précédentes revues
15:26 <Hebdobot> !version : afficher la version d'Hebdobot
15:26 <Hebdobot>
15:26 <Hebdobot> Autres commandes de dialogue : !bonjour, !date, !hello, !merci, !salut
```
À la fin de la revue, une synthèse est accessible via un site de pastes et des statistiques de la revue sont affichées.
## License
Hebdobot is a free software released on GNU AGPLv3+
## History
TODO
## Logo
The currently cute logo is "Kids ABC Letter H" by "X posid" released on CC0 Public Domain license.
Location: hebdobot/resources/logo/
Source: https://www.publicdomainpictures.net/en/view-image.php?image=154863&picture=kids-abc-letter-h

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Sat May 08 05:36:16 CEST 2021
build.number=6
#Fri May 03 17:33:54 CEST 2019
build.number=20

View File

@ -1,3 +1,3 @@
product.name=hebdobot
product.revision.major=2
product.revision.minor=11
product.revision.minor=0

View File

@ -41,11 +41,11 @@ function build_snapshot
# Java version check.
javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 11 version requirement..... OK"
if [[ "$javaVersionCheck" =~ ^.*\ 1.8 ]]; then
echo "Java 8 version requirement..... OK"
let "okCount+=1"
else
echo "Java 11 version requirement..... MISSING"
echo "Java 8 version requirement..... MISSING"
fi
if [ "$okCount" == 3 ]; then
@ -83,11 +83,11 @@ function build_local
# Java version check.
javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 11 version requirement..... OK"
if [[ "$javaVersionCheck" =~ ^.*\ 1.8 ]]; then
echo "Java 8 version requirement..... OK"
let "okCount+=1"
else
echo "Java 11 version requirement..... MISSING"
echo "Java 8 version requirement..... MISSING"
fi
if [ "$okCount" == 3 ]; then
@ -125,11 +125,11 @@ function build_tagandpush
# Java version check.
javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 11 version requirement..... OK"
if [[ "$javaVersionCheck" =~ ^.*\ 1.8 ]]; then
echo "Java 8 version requirement..... OK"
let "okCount+=1"
else
echo "Java 11 version requirement..... MISSING"
echo "Java 8 version requirement..... MISSING"
fi
# Git check.

Binary file not shown.

Binary file not shown.

View File

@ -15,8 +15,8 @@ irc.channel=#april-test
irc.identify.nick=
irc.identify.password=
# Privatebin settings.
#privatebin.url=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Pastebin settings.
#pastebin.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Twitter settings.
#twitter.consumerKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 KiB

View File

@ -1 +0,0 @@
Travaux réalisés par Antoine Bardelli en avril 2020.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 490 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 497 KiB

View File

@ -1,6 +0,0 @@
Toutes les photos présentes ici sont sous licence libre.
Les métadonnées des images contiennent les informations utiles.
Pour ajouter des métadonnées à de nouvelles photos :
exiftool -use MWG -P -m -overwrite_original_in_place -Copyright="$copyright" nouvellephoto.jpg
exiftool -use MWG -P -m -overwrite_original_in_place -Creator="$artist" nouvellephoto.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 641 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 666 KiB

View File

@ -1,7 +0,0 @@
Source:
https://www.publicdomainpictures.net/en/view-image.php?image=154863&picture=kids-abc-letter-h
License:
License: CC0 Public Domain
X posid has released this “Kids ABC Letter H” image under Public Domain license. It means that you can use and modify it for your personal and commercial projects. If you intend to use an image you find here for commercial use, please be aware that some photos do require a model or a property release. Pictures featuring products should be used with care.

View File

@ -14,11 +14,11 @@ fi
# Java version check.
javaVersionCheck=`java -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 11 version requirement..... OK"
if [[ "$javaVersionCheck" =~ ^.*\ 1.8 ]]; then
echo "Java 8 version requirement..... OK"
let "okCount+=1"
else
echo "Java 11 version requirement..... MISSING"
echo "Java 8 version requirement..... MISSING"
fi
if [ "$okCount" == 2 ]; then

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013,2017 Nicolas Vinot <aeris@imirhil.fr>
*
* This file is part of (April) Hebdobot.
@ -22,15 +22,11 @@ package org.april.hebdobot.bot;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.time.LocalDate;
import java.time.LocalTime;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.hooks.AnnivHook;
import org.april.hebdobot.bot.hooks.BadCommandHook;
import org.april.hebdobot.bot.hooks.CancelPreviousInputHook;
import org.april.hebdobot.bot.hooks.ChronoHook;
import org.april.hebdobot.bot.hooks.CollectiveSubjectHook;
import org.april.hebdobot.bot.hooks.CommentHook;
import org.april.hebdobot.bot.hooks.CurrentHook;
@ -39,11 +35,10 @@ import org.april.hebdobot.bot.hooks.DefaultHook;
import org.april.hebdobot.bot.hooks.FinishReviewHook;
import org.april.hebdobot.bot.hooks.HelloHook;
import org.april.hebdobot.bot.hooks.HelpHook;
import org.april.hebdobot.bot.hooks.Hooker;
import org.april.hebdobot.bot.hooks.HookManager;
import org.april.hebdobot.bot.hooks.IndividualSubjectHook;
import org.april.hebdobot.bot.hooks.InputReviewHook;
import org.april.hebdobot.bot.hooks.LicenseHook;
import org.april.hebdobot.bot.hooks.ListenAlexandrieHook;
import org.april.hebdobot.bot.hooks.MissingHook;
import org.april.hebdobot.bot.hooks.RecordHook;
import org.april.hebdobot.bot.hooks.StartReviewHook;
@ -57,10 +52,9 @@ import org.april.hebdobot.bot.review.Review;
import org.april.hebdobot.cron.CronManager;
import org.april.hebdobot.cron.CronSettings;
import org.april.hebdobot.identica.IdenticaSettings;
import org.april.hebdobot.privatebin.PrivatebinSettings;
import org.april.hebdobot.pastebin.PastebinSettings;
import org.april.hebdobot.twitter.TwitterClient;
import org.april.hebdobot.twitter.TwitterSettings;
import org.april.hebdobot.util.Chrono;
import org.jibble.pircbot.IrcException;
import org.jibble.pircbot.NickAlreadyInUseException;
import org.jibble.pircbot.PircBot;
@ -68,7 +62,6 @@ import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import twitter4j.TwitterException;
/**
@ -88,14 +81,13 @@ public class Hebdobot extends PircBot
private String reviewFileSuffix;
private LocalTime reviewWaitTime;
private Review review;
private Chrono chrono;
private IdenticaSettings identicaSettings;
private PrivatebinSettings privatebinSettings;
private PastebinSettings pastebinSettings;
private TwitterSettings twitterSettings;
private CronSettings cronSettings;
private UserAliases aliases;
private CronManager cronManager;
private Hooker hooker;
private HookManager hooker;
/**
* Instantiates a new hebdobot.
@ -131,10 +123,9 @@ public class Hebdobot extends PircBot
this.reviewFileSuffix = null;
this.reviewWaitTime = null;
this.review = null;
this.chrono = new Chrono();
this.identicaSettings = new IdenticaSettings();
this.privatebinSettings = new PrivatebinSettings();
this.pastebinSettings = new PastebinSettings();
this.twitterSettings = new TwitterSettings();
this.cronSettings = new CronSettings();
this.aliases = new UserAliases();
@ -142,11 +133,8 @@ public class Hebdobot extends PircBot
this.cronManager = null;
//
this.hooker = new Hooker();
this.hooker = new HookManager();
this.hooker.add(new ListenAlexandrieHook());
this.hooker.add(new CancelPreviousInputHook());
this.hooker.add(new ChronoHook());
this.hooker.add(new CollectiveSubjectHook());
this.hooker.add(new CommentHook());
this.hooker.add(new CurrentHook());
@ -160,7 +148,6 @@ public class Hebdobot extends PircBot
this.hooker.add(new StatsHook());
this.hooker.add(new StatusHook());
this.hooker.add(new AnnivHook());
this.hooker.add(new DateHook());
this.hooker.add(new HelloHook());
this.hooker.add(new LicenseHook());
@ -172,27 +159,6 @@ public class Hebdobot extends PircBot
this.hooker.add(new DefaultHook());
}
/**
* Check anniversary.
*/
public void checkReviewAnniversary()
{
LocalDate now = LocalDate.now();
LocalDate creation = LocalDate.of(2010, 04, 30);
LocalDate anniv = LocalDate.of(now.getYear(), creation.getMonth(), creation.getDayOfMonth());
logger.debug("now ={}", now.toString());
logger.debug("creation={}", creation.toString());
logger.debug("anniv ={}", anniv.toString());
if ((!now.isBefore(anniv)) && (now.isBefore(anniv.plusDays(7))))
{
logger.info("Review anniversary detected.");
int year = anniv.getYear() - creation.getYear();
sendMessage("% \\o/ Joyeux " + year + "e anniversaire la revue hebdo \\o/");
}
}
/**
* Close.
*/
@ -202,15 +168,6 @@ public class Hebdobot extends PircBot
this.dispose();
}
/**
* End review.
*/
public void endReview()
{
this.review.endReview();
this.chrono.reset();
}
/**
* Gets the aliases.
*
@ -221,11 +178,6 @@ public class Hebdobot extends PircBot
return this.aliases;
}
public Chrono getChrono()
{
return this.chrono;
}
public CronManager getCronManager()
{
return this.cronManager;
@ -241,32 +193,6 @@ public class Hebdobot extends PircBot
return this.cronSettings;
}
/**
* Gets the help.
*
* @param source
* the source
* @return the help
* @throws HebdobotException
* the hebdobot exception
*/
public StringList getHelp(final String source) throws HebdobotException
{
StringList result;
if (source == null)
{
result = null;
}
else
{
result = this.hooker.attemptHelp(source);
}
//
return result;
}
/**
* Gets the home directory.
*
@ -288,13 +214,13 @@ public class Hebdobot extends PircBot
}
/**
* Gets the privatebin settings.
* Gets the pastebin settings.
*
* @return the privatebin settings
* @return the pastebin settings
*/
public PrivatebinSettings getPrivatebinSettings()
public PastebinSettings getPastebinSettings()
{
return this.privatebinSettings;
return this.pastebinSettings;
}
public Review getReview()
@ -393,7 +319,7 @@ public class Hebdobot extends PircBot
this.review.addRaw(new Message(sender, text));
}
text = text.replaceAll("^" + getName().replace("[", "\\[").replaceAll("]", "\\]") + "[,:]\\s*", "!");
text = message.replaceAll("^" + getName().replace("[", "\\[").replaceAll("]", "\\]") + "[,:]\\s*", "!");
try
{
@ -417,12 +343,36 @@ public class Hebdobot extends PircBot
String text = message.trim();
if (text.startsWith("!"))
if (StringUtils.equalsIgnoreCase(text, "!vaten"))
{
logger.info("!die caught.");
// Die.
if (this.review == null)
{
try
{
sendMessage(sender + ", ok bye.");
sendMessage(sender, "ok bye.");
Thread.sleep(1000);
System.exit(0);
}
catch (InterruptedException exception)
{
logger.warn("Pause abort: " + exception.getMessage());
}
}
else
{
sendMessage("% Une revue est en cours, abandon impossible.");
}
}
else if (text.startsWith("!"))
{
logger.info("!??? caught.");
// Command unknown.
sendMessage(sender, "vos commandes dans le salon public");
sendMessage(sender + ", command unknown: " + text);
}
else
{
@ -438,7 +388,6 @@ public class Hebdobot extends PircBot
*/
public void run() throws HebdobotException
{
//
try
{
logger.info("Cron initializing.");
@ -447,81 +396,45 @@ public class Hebdobot extends PircBot
this.cronManager.start();
}
logger.info("Cron initialized.");
logger.info("Bot connection.");
this.connect(this.host, this.port);
logger.info("Bot connected.");
if (this.identifyPassword == null)
{
logger.info("Skipped identify.");
}
else
{
logger.info("Apply identify.");
sendMessage("NickServ", "identify " + this.identifyNick + " " + this.identifyPassword);
logger.info("Applied identify.");
}
logger.info("Bot joining channel ({}).", this.channel);
this.joinChannel(this.channel);
logger.info("Bot ready.");
}
catch (SchedulerException | ParseException exception)
catch (NickAlreadyInUseException exception)
{
throw new HebdobotException(exception);
}
catch (IOException exception)
{
throw new HebdobotException(exception);
}
catch (IrcException exception)
{
throw new HebdobotException(exception);
}
catch (SchedulerException exception)
{
throw new HebdobotException("Error in cron settings.", exception);
}
// Manage "Caused by: java.net.UnknownHostException: irc.freenode.org".
boolean ended = false;
while (!ended)
catch (ParseException exception)
{
try
{
logger.info("Bot connection.");
this.connect(this.host, this.port);
logger.info("Bot connected.");
ended = true;
}
catch (NickAlreadyInUseException exception)
{
throw new HebdobotException(exception);
}
catch (IOException exception)
{
logger.error("IOException during connection ", exception);
try
{
Thread.sleep(200000);
}
catch (InterruptedException subException)
{
logger.error("Exception during sleep ", subException);
}
}
catch (IrcException exception)
{
throw new HebdobotException(exception);
}
}
//
if (this.identifyPassword == null)
{
logger.info("Skipped identify.");
}
else
{
logger.info("Apply identify.");
sendMessage("NickServ", "identify " + this.identifyNick + " " + this.identifyPassword);
logger.info("Applied identify.");
}
logger.info("Bot joining channel ({}).", this.channel);
this.joinChannel(this.channel);
logger.info("Bot ready.");
}
/**
* Send chrono message.
*/
public void sendChronoMessage()
{
if (this.review == null)
{
sendMessage("% durée du point : pas de revue en cours.");
}
else if (this.review.isEmpty())
{
sendMessage("% durée du point : pas de point en cours.");
}
else
{
String topicTitle = this.review.getCurrentTopic().getTitle();
String chronoValue = this.chrono.toString();
sendMessage(String.format("%% durée du point %s : %s", topicTitle, chronoValue));
throw new HebdobotException(exception);
}
}
@ -571,13 +484,4 @@ public class Hebdobot extends PircBot
{
this.reviewWaitTime = reviewWaitTime;
}
/**
* Stop review.
*/
public void stopReview()
{
setReview(null);
this.chrono.reset();
}
}

View File

@ -1,103 +0,0 @@
/**
* Copyright (C) 2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import java.time.LocalDate;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class AnnivHook.
*/
public class AnnivHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(AnnivHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "anniv"))
{
result = new StringList("!anniv : afficher des anniversaires");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsAnyIgnoreCase(message, "!anniv"))
{
logger.info("!anniv caught.");
LocalDate now = LocalDate.now();
LocalDate revueBirthdate = LocalDate.of(2010, 04, 30);
String birthdate = revueBirthdate.format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
int years = Period.between(revueBirthdate, now).getYears();
bot.sendMessage(String.format("La revue hebdomadaire est née le %s et a %d ans", birthdate, years));
LocalDate hebdobotBirthdate = LocalDate.of(2011, 9, 9);
years = Period.between(hebdobotBirthdate, now).getYears();
birthdate = hebdobotBirthdate.format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
bot.sendMessage(String.format("Hebdobot a géré sa première revue le %s et a %d ans", birthdate, years));
LocalDate aprilBirthdate = LocalDate.of(1996, 11, 20);
birthdate = aprilBirthdate.format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
years = Period.between(aprilBirthdate, now).getYears();
bot.sendMessage(String.format("L'April a été déclarée en préférecture le %s et a %d ans", birthdate, years));
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -18,13 +18,10 @@
*/
package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/**
* The Class DefaultHook.
*/
@ -32,15 +29,6 @@ public class BadCommandHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(BadCommandHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(org.april.hebdobot.bot.Hebdobot, java.lang.String)
*/
@Override
public StringList attemptHelp(final String message) throws HebdobotException
{
return null;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/

View File

@ -1,107 +0,0 @@
/**
* Copyright (C) 2019-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.Topic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class CancelPreviousInputHook.
*/
public class CancelPreviousInputHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(CancelPreviousInputHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(org.april.hebdobot.bot.Hebdobot, java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "cancelprevious", "oops", "oups"))
{
result = new StringList("!oups, !oops, !cancelprevious : annuler la dernière entrée dans un point de revue");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringsUtils.equalsAnyIgnoreCase(message, "!cancelprevious", "!oops", "!oups"))
{
logger.info("!cancelprevious/!oops caught.");
// Missing.
if (bot.getReview() == null)
{
bot.sendMessage(sender + ", pas de revue en cours.");
}
else
{
Topic topic = bot.getReview().getCurrentTopic();
if (topic == null)
{
bot.sendMessage("Pas de sujet en cours.");
}
else
{
String previousMessage = topic.cancelPreviousMessage(sender);
if (previousMessage == null)
{
bot.sendMessage(sender + ", vous n'avez pas d'entrée en cours.");
}
else
{
bot.sendMessage(sender + ", suppression de votre précédente entrée : " + previousMessage);
}
}
}
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -1,83 +0,0 @@
/**
* Copyright (C) 2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class ChronoHook.
*/
public class ChronoHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(ChronoHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "chrono"))
{
result = new StringList("!chrono : afficher la durée du point de revue en cours");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsAnyIgnoreCase(message, "!chrono"))
{
logger.info("!chrono caught.");
// bot.sendChronoMessage();
bot.sendMessage(bot.getChrono().format());
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -19,15 +19,11 @@
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.CollectiveTopic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class CollectiveSubjectHook.
*/
@ -35,27 +31,6 @@ public class CollectiveSubjectHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(CollectiveSubjectHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "##"))
{
result = new StringList("## titre : démarrer un sujet collectif");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@ -77,8 +52,6 @@ public class CollectiveSubjectHook extends Hook
CollectiveTopic topic = new CollectiveTopic(message.replaceFirst("##", "").trim());
if (!bot.getReview().isEmpty())
{
bot.sendChronoMessage();
String participants = StringUtils.join(bot.getReview().getParticipants(), " ");
bot.sendMessage(String.format("%% %s, on va passer à la suite : %s", participants, topic.getTitle()));
}
@ -87,7 +60,6 @@ public class CollectiveSubjectHook extends Hook
bot.sendMessage("% 1 minute max");
bot.sendMessage("% si rien à signaler vous pouvez écrire % ras");
bot.sendMessage("% quand vous avez fini vous le dites par % fini");
bot.getChrono().start();
}
else
{

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -18,14 +18,10 @@
*/
package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class CommentHook.
*/
@ -33,27 +29,6 @@ public class CommentHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(CommentHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "%"))
{
result = new StringList("% message : traiter le message comme un commentaire (ignoré dans la synthèse de la revue)");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018-2019 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -19,7 +19,6 @@
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.CollectiveTopic;
import org.april.hebdobot.bot.review.IndividualTopic;
@ -27,9 +26,6 @@ import org.april.hebdobot.bot.review.Topic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class CurrentHook.
*/
@ -37,27 +33,6 @@ public class CurrentHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(CurrentHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "courant"))
{
result = new StringList("!courant : afficher le sujet en cours");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -23,14 +23,10 @@ import java.time.format.DateTimeFormatter;
import java.util.Locale;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class DateHook.
*/
@ -38,27 +34,6 @@ public class DateHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(DateHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "date", "time", "now"))
{
result = new StringList("!date, !time, !now : afficher la date et l'heure");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -18,13 +18,10 @@
*/
package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/**
* The Class DefaultHook.
*/
@ -32,20 +29,6 @@ public class DefaultHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(DefaultHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
result = null;
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018-2019 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -27,20 +27,17 @@ import java.time.format.DateTimeFormatter;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.ReviewReporter;
import org.april.hebdobot.bot.stats.ReviewData;
import org.april.hebdobot.bot.stats.ReviewDatas;
import org.april.hebdobot.bot.stats.ReviewDatasFile;
import org.april.hebdobot.bot.stats.ReviewStatsReporter;
import org.april.hebdobot.privatebin.PrivatebinClient;
import org.april.hebdobot.pastebin.PastebinClient;
import org.april.hebdobot.pastebin.Private;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class FinishReviewHook.
*/
@ -50,27 +47,6 @@ public class FinishReviewHook extends Hook
public static String DEFAULT_SUFFIX = "-log-irc-revue-hebdomadaire.txt";
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "fin"))
{
result = new StringList("!fin : terminer la revue en cours");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@ -105,8 +81,7 @@ public class FinishReviewHook extends Hook
else
{
// End the review.
bot.sendChronoMessage();
bot.endReview();
bot.getReview().endReview();
// Load and update review statistics.
ReviewDatas datas;
@ -138,14 +113,14 @@ public class FinishReviewHook extends Hook
// Pastebin the review text.
String pastebinUrl;
if (bot.getPrivatebinSettings().isValid())
if (bot.getPastebinSettings().isValid())
{
logger.info("Pastebin the review.");
try
{
PrivatebinClient pastebinClient = new PrivatebinClient(bot.getPrivatebinSettings());
PastebinClient pastebinClient = new PastebinClient(bot.getPastebinSettings().getApiKey());
pastebinUrl = pastebinClient.paste(reviewText);
pastebinUrl = pastebinClient.paste(reviewText, "Revue APRIL " + date, Private.UNLISTED);
}
catch (final Exception exception)
{
@ -183,13 +158,12 @@ public class FinishReviewHook extends Hook
}
// Send conclusion message in channel.
bot.checkReviewAnniversary();
bot.sendMessage("% " + ReviewStatsReporter.reportCurrentReviewCount(datas));
bot.sendMessage("% " + ReviewStatsReporter.reportReviewCount(datas));
bot.sendMessage("% Compte-rendu de la revue : " + pastebinUrl);
bot.sendMessage("% Durée de la revue : " + bot.getReview().getDurationInMinutes() + " minutes");
bot.sendMessage("% Nombre de personnes participantes : " + bot.getReview().getParticipants().size());
bot.sendMessage("% " + ReviewStatsReporter.reportCheckUserCountRecord(datas));
bot.sendMessage("% " + ReviewStatsReporter.reportNewUserCountRecord(datas));
bot.sendMessage(bot.getReview().getOwner(), ReviewStatsReporter.reportUserCount(datas, bot.getReview().getParticipants().size()));
bot.sendMessage(bot.getReview().getOwner(), ReviewStatsReporter.reportDuration(datas, bot.getReview().getDurationInMinutes()));

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -19,12 +19,10 @@
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
@ -34,27 +32,6 @@ public class HelloHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(HelloHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "salut", "bonjour", "hello"))
{
result = new StringList("!salut, !bonjour, !hello : dire bonjour");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/

View File

@ -0,0 +1,110 @@
/**
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class HelpByCommandHook.
*/
public class HelpByCommandHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(HelpByCommandHook.class);
private static final Pattern PATTERN = Pattern.compile("^!help\\s+(\\S+)$");
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
Matcher matcher = PATTERN.matcher(message);
if (matcher.find())
{
String command = matcher.group(1);
if (StringUtils.equals(command, "help"))
{
bot.sendMessage(sender + ": help display help commands");
bot.sendMessage(sender + ": help command display help on specific command");
}
else if (StringUtils.equals(command, "ignore"))
{
bot.sendMessage(sender + ": ignore host:service ignore a specific probe");
bot.sendMessage(sender + ": ignore list ignore probes");
}
else if (StringUtils.equals(command, "unignore"))
{
bot.sendMessage(sender + ": unignore host:service ignore a specific probe");
}
else if (StringUtils.equals(command, "ack"))
{
bot.sendMessage(sender + ": ack unack an alert");
}
else if (StringUtils.equals(command, "unack"))
{
bot.sendMessage(sender + ": unack unack an alert");
}
else if (StringUtils.equalsAnyIgnoreCase(command, "!mute", "!tagueule", "!ta gueule", "!chut", "!sieste"))
{
bot.sendMessage(sender + ": mute|tagueule|chut|sieste mute alert display");
}
else if (StringUtils.equalsAnyIgnoreCase(command, "!unmute"))
{
bot.sendMessage(sender + ": unmute mute alert display");
}
else if (StringUtils.equals(command, "list"))
{
bot.sendMessage(sender + ": list display current alerts");
}
else if (StringUtils.equals(command, "refresh"))
{
bot.sendMessage(sender + ": refresh update alert list");
}
else if (StringUtils.equals(command, "recheck"))
{
bot.sendMessage(sender + ": recheck reschedule current alerts");
}
else
{
bot.sendMessage(sender + ": no help available for this command");
}
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -18,141 +18,60 @@
*/
package org.april.hebdobot.bot.hooks;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class HelpHook.
*/
public class HelpHook extends Hook
{
private static final Pattern COMMAND_HELP_PATTERN = Pattern.compile("^!(aide|help)\\s+(?<token>\\S+)$");
private static final Logger logger = LoggerFactory.getLogger(HelpHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "aide", "help"))
{
result = new StringList();
result.append("!aide, !help, !aide hebdobot, !help hebdobot : afficher l'aide générale");
result.append("!aide commande, !help commande : afficher l'aide de la commande !commande");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message) throws HebdobotException
final String message)
{
boolean result;
if (StringUtils.equalsAnyIgnoreCase(message, "!aide", "!help", "!aide hebdobot", "!help hebdobot"))
if (StringUtils.equalsAnyIgnoreCase(message, "!aide", "!help"))
{
logger.info("!help caught.");
// Help.
bot.sendMessage(sender,
String.format("Bienvenue %s. Je suis %s, le robot de gestion des revues hebdomadaires de l'April.", sender, bot.getName()));
bot.sendMessage(sender, "Bienvenue " + sender);
bot.sendMessage(sender, "Je suis " + bot.getName() + ", le robot de gestion des revues hebdomadaires de l'APRIL.");
bot.sendMessage(sender, "Voici les commandes que je comprends :");
bot.sendMessage(sender, " ");
bot.sendMessage(sender, " !aide,!help : afficher cette aide");
bot.sendMessage(sender, " !aide commande : afficher l'aide de la commande !commande");
bot.sendMessage(sender, " !début : commencer une nouvelle revue");
bot.sendMessage(sender, " % message  : traiter comme un commentaire");
bot.sendMessage(sender, " # titre  : démarrer un sujet individuel");
bot.sendMessage(sender, " ## titre  : démarrer un sujet collectif");
bot.sendMessage(sender, " !oups   : annuler la dernière entrée dans un point de revue");
bot.sendMessage(sender, " !courant : afficher le sujet en cours");
bot.sendMessage(sender, " !fin : terminer la revue en cours");
bot.sendMessage(sender, " !stop  : abandonner la revue en cours");
bot.sendMessage(sender, " !aide,!help : afficher cette aide");
bot.sendMessage(sender, " !début : commencer une nouvelle revue");
bot.sendMessage(sender, " # titre  : démarrer un sujet individuel");
bot.sendMessage(sender, " ## titre  : démarrer un sujet collectif");
bot.sendMessage(sender, " % message  : traiter comme un commentaire");
bot.sendMessage(sender, " !courant : afficher le sujet en cours");
bot.sendMessage(sender, " !manquants : afficher qui n'a pas participé sur le dernier sujet");
bot.sendMessage(sender, " !fin : terminer la revue en cours");
bot.sendMessage(sender, " !stop  : abandonner la revue en cours");
bot.sendMessage(sender, " !licence   : afficher la licence du logiciel Hebdobot et le lien vers ses sources");
bot.sendMessage(sender, " !record : affiche le record de participation à la revue");
bot.sendMessage(sender, " !stats : statistiques sur les précédentes revues");
bot.sendMessage(sender, " !version   : afficher la version d'Hebdobot");
bot.sendMessage(sender, " ");
bot.sendMessage(sender,
"Autres commandes : !anniv, !bonjour, !chrono, !date, !hello, !licence, !manquants, !merci, !record, !salut, !stats, !status, !version");
bot.sendMessage(sender, "Autres commandes de dialogue : !bonjour, !date, !hello, !merci, !salut");
result = true;
}
else
{
String token = extractTargetHelp(message);
if (token == null)
{
result = false;
}
else
{
StringList help = bot.getHelp(token);
if (help == null)
{
bot.sendMessage("aide indisponible pour la commande " + token);
}
else
{
for (String line : help)
{
bot.sendMessage(line);
}
}
result = true;
}
result = false;
}
//
return result;
}
/**
* Extract target help.
*
* @return the string
*/
private String extractTargetHelp(final String message)
{
String result;
Matcher matcher = COMMAND_HELP_PATTERN.matcher(message);
if (matcher.find())
{
result = matcher.group("token");
if (StringUtils.startsWith(result, "!"))
{
result = result.substring(1);
}
}
else
{
result = null;
}
//
return result;
}
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -21,23 +21,11 @@ package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import fr.devinsy.strings.StringList;
/**
* The Class Hook.
*/
public abstract class Hook
{
/**
* Attempt help.
*
* @param string
* the string
* @return the string list
* @throws HebdobotException
* the hebdobot exception
*/
public abstract StringList attemptHelp(final String string) throws HebdobotException;
/**
* Attempt process.

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018-2019 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -29,18 +29,18 @@ import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/**
* The class Hooker, a hook manager.
* The Interface MessageHook.
*/
public class Hooker
public class HookManager
{
private static final Logger logger = LoggerFactory.getLogger(Hooker.class);
private static final Logger logger = LoggerFactory.getLogger(HookManager.class);
private ArrayList<Hook> hooks;
/**
* Instantiates a new hook manager.
*/
public Hooker()
public HookManager()
{
this.hooks = new ArrayList<>(30);
}
@ -59,46 +59,6 @@ public class Hooker
}
}
/**
* Attempt help.
*
* @param message
* the message
* @return the string list
* @throws HebdobotException
* the hebdobot exception
*/
public StringList attemptHelp(final String message) throws HebdobotException
{
StringList result;
boolean ended = false;
Iterator<Hook> iterator = this.hooks.iterator();
result = null;
while (!ended)
{
if (iterator.hasNext())
{
Hook hook = iterator.next();
StringList help = hook.attemptHelp(message);
if (help != null)
{
ended = true;
result = help;
}
}
else
{
ended = true;
result = null;
}
}
//
return result;
}
/**
* Attempt process.
*

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -19,15 +19,11 @@
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.IndividualTopic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class IndividualSubjectHook.
*/
@ -35,27 +31,6 @@ public class IndividualSubjectHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(IndividualSubjectHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "#"))
{
result = new StringList("# titre : démarrer un sujet individuel");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@ -77,8 +52,6 @@ public class IndividualSubjectHook extends Hook
IndividualTopic topic = new IndividualTopic(message.replaceFirst("#", "").trim());
if (!bot.getReview().isEmpty())
{
bot.sendChronoMessage();
String participants = StringUtils.join(bot.getReview().getParticipants(), " ");
bot.sendMessage(String.format("%% %s, on va passer à la suite : %s", participants, topic.getTitle()));
}
@ -86,7 +59,6 @@ public class IndividualSubjectHook extends Hook
bot.sendMessage("Sujet individuel : " + topic.getTitle());
bot.sendMessage("% si rien à signaler vous pouvez écrire % ras");
bot.sendMessage("% quand vous avez fini vous le dites par % fini");
bot.getChrono().start();
}
else
{

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -18,14 +18,11 @@
*/
package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.Message;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/**
* The Class DefaultHook.
*/
@ -33,20 +30,6 @@ public class InputReviewHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(InputReviewHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
result = null;
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -18,12 +18,10 @@
*/
package org.april.hebdobot.bot.hooks;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
@ -33,27 +31,6 @@ public class LicenseHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(LicenseHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "licence", "license"))
{
result = new StringList("!licence, !license : afficher la licence du logiciel Hebdobot et le lien vers ses sources");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@ -67,8 +44,8 @@ public class LicenseHook extends Hook
{
logger.info("!licence caught.");
bot.sendMessage(
"Hebdobot est un logiciel libre de l'April sous licence GNU AGPLv3+, sources : https://forge.april.org/adminsys/hebdobot");
bot.sendMessage(sender
+ ", Hebdobot est un logiciel libre de l'April sous licence GNU AGPL (sources : https://agir.april.org/projects/hebdobot/repository).");
result = true;
}

View File

@ -1,74 +0,0 @@
/**
* Copyright (C) 2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/**
* The Class ListenAlexandrieHook.
*
* This hook is listening Alexandrie messages and do not answer.
*
*/
public class ListenAlexandrieHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(ListenAlexandrieHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
result = null;
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
final String message)
{
boolean result;
if (StringUtils.equalsIgnoreCase(sender, "alexandrie"))
{
result = true;
}
else
{
result = false;
}
//
return result;
}
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018-2019 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -22,15 +22,12 @@ import java.util.Collection;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.Topic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringSet;
import fr.devinsy.strings.StringsUtils;
/**
* The Class MissingHook.
@ -39,27 +36,6 @@ public class MissingHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(MissingHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "manquants"))
{
result = new StringList("!manquants : afficher les pseudos n'ayant pas participé au point en cours");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@ -83,7 +59,7 @@ public class MissingHook extends Hook
Topic topic = bot.getReview().getCurrentTopic();
if (topic == null)
{
bot.sendMessage("Pas de sujet en cours.");
bot.sendMessage("Pas sujet en cours.");
}
else
{

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -20,8 +20,6 @@ package org.april.hebdobot.bot.hooks;
import java.io.File;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.stats.ReviewDatas;
import org.april.hebdobot.bot.stats.ReviewDatasFile;
@ -29,9 +27,6 @@ import org.april.hebdobot.bot.stats.ReviewStatsReporter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class RecordHook.
*/
@ -39,27 +34,6 @@ public class RecordHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(RecordHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "record"))
{
result = new StringList("!record : afficher le record de participation à la revue");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@ -69,7 +43,7 @@ public class RecordHook extends Hook
{
boolean result;
if (StringUtils.equalsIgnoreCase(message, "!record"))
if (message.equals("!record"))
{
logger.info("!record caught.");
@ -81,7 +55,7 @@ public class RecordHook extends Hook
{
ReviewDatas datas = ReviewDatasFile.load(reviewDataFile);
datas.clean();
bot.sendMessage(ReviewStatsReporter.reportUserCountRecord(datas));
bot.sendMessage("% " + ReviewStatsReporter.reportUserCountRecord(datas));
}
else
{

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -21,16 +21,12 @@ package org.april.hebdobot.bot.hooks;
import java.time.LocalTime;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.review.Review;
import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class StartReviewHook.
*/
@ -38,27 +34,6 @@ public class StartReviewHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(StartReviewHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "début", "debut", "start"))
{
result = new StringList("!début, !debut, !start : commencer une nouvelle revue");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@ -99,7 +74,6 @@ public class StartReviewHook extends Hook
bot.setReview(new Review(sender, bot.getAliases()));
bot.sendMessage(sender, "Bonjour " + sender + ", vous êtes le conducteur de réunion.");
bot.sendMessage(sender, "Pour terminer la réunion, tapez \"!fin\"");
bot.checkReviewAnniversary();
bot.sendMessage("% Début de la réunion hebdomadaire");
bot.sendMessage(
"% rappel : toute ligne commençant par % sera considérée comme un commentaire et non prise en compte dans la synthèse");

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -20,8 +20,6 @@ package org.april.hebdobot.bot.hooks;
import java.io.File;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.bot.stats.ReviewDatas;
import org.april.hebdobot.bot.stats.ReviewDatasFile;
@ -29,9 +27,6 @@ import org.april.hebdobot.bot.stats.ReviewStatsReporter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class StatsHook.
*/
@ -39,27 +34,6 @@ public class StatsHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(StatsHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "stats"))
{
result = new StringList("!stats : statistiques sur les précédentes revues");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@ -69,7 +43,7 @@ public class StatsHook extends Hook
{
boolean result;
if (StringUtils.equalsIgnoreCase(message, "!stats"))
if (message.equals("!stats"))
{
logger.info("!stats caught.");
@ -82,9 +56,6 @@ public class StatsHook extends Hook
{
ReviewDatas datas = ReviewDatasFile.load(reviewDataFile);
datas.clean();
bot.sendMessage("% " + ReviewStatsReporter.reportReviewCount(datas));
bot.sendMessage("% " + ReviewStatsReporter.reportReviewUserCount(datas));
bot.sendMessage("% " + ReviewStatsReporter.reportReviewDuration(datas));
bot.sendMessage("% " + ReviewStatsReporter.reportUserCountBoard(datas));
bot.sendMessage("% " + ReviewStatsReporter.reportDurationBoard(datas));
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -19,14 +19,10 @@
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class StatusHook.
*/
@ -34,27 +30,6 @@ public class StatusHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(StatusHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "status", "statut"))
{
result = new StringList("!status, !statut : état et paramétrage d'Hebdobot");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@ -78,12 +53,12 @@ public class StatusHook extends Hook
{
bot.sendMessage(sender, " animateur revue : " + bot.getReview().getOwner());
}
bot.sendMessage(sender, " Alias settings : " + (bot.getAliases().size()));
bot.sendMessage(sender, " Identica settings : " + (bot.getIdenticaSettings().isValid()));
bot.sendMessage(sender, " Privatebin settings : " + bot.getPrivatebinSettings().toString());
bot.sendMessage(sender, " Twitter settings : " + (bot.getTwitterSettings().isValid()));
bot.sendMessage(sender, " Cron settings : " + (bot.getCronSettings().size()));
bot.sendMessage(sender, " Review Wait Time : " + (bot.getReviewWaitTime()));
bot.sendMessage(sender, " Alias settings : " + (bot.getAliases().size()));
bot.sendMessage(sender, " Identica settings : " + (bot.getIdenticaSettings().isValid()));
bot.sendMessage(sender, " Pastebin settings : " + (bot.getPastebinSettings().isValid()));
bot.sendMessage(sender, " Twitter settings : " + (bot.getTwitterSettings().isValid()));
bot.sendMessage(sender, " Cron settings : " + (bot.getCronSettings().size()));
bot.sendMessage(sender, " Review Wait Time : " + (bot.getReviewWaitTime()));
result = true;
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018-2019 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -19,14 +19,10 @@
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class StopReviewHook.
*/
@ -34,27 +30,6 @@ public class StopReviewHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(StopReviewHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "stop"))
{
result = new StringList("!stop : abandonner la revue en cours");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@ -80,7 +55,7 @@ public class StopReviewHook extends Hook
else
{
bot.sendMessage("Abandon de la revue en cours.");
bot.stopReview();
bot.setReview(null);
}
result = true;

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -19,12 +19,10 @@
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
@ -34,27 +32,6 @@ public class ThanksHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(ThanksHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "merci"))
{
result = new StringList("!merci : dire que ça fait plaisir");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -18,16 +18,11 @@
*/
package org.april.hebdobot.bot.hooks;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.HebdobotException;
import org.april.hebdobot.bot.Hebdobot;
import org.april.hebdobot.util.BuildInformation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class VersionHook.
*/
@ -35,27 +30,6 @@ public class VersionHook extends Hook
{
private static final Logger logger = LoggerFactory.getLogger(VersionHook.class);
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptHelp(java.lang.String)
*/
@Override
public StringList attemptHelp(final String token) throws HebdobotException
{
StringList result;
if (StringsUtils.equalsAnyIgnoreCase(token, "version"))
{
result = new StringList("!version : afficher la version d'Hebdobot");
}
else
{
result = null;
}
//
return result;
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@ -65,7 +39,7 @@ public class VersionHook extends Hook
{
boolean result;
if (StringUtils.equalsIgnoreCase(message, "!version"))
if (message.equals("!version"))
{
logger.info("!version caught.");
bot.sendMessage(new BuildInformation().toString());

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
*
* This file is part of (April) Hebdobot.
@ -52,31 +52,6 @@ public class CollectiveTopic extends Topic
this.messages.add(message);
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.review.Topic#cancelPrevious(java.lang.String)
*/
@Override
public String cancelPreviousMessage(final String author)
{
String result;
Messages authorMessages = this.messages.getByAuthor(author);
if (authorMessages.isEmpty())
{
result = null;
}
else
{
Message previousMessage = authorMessages.getLast();
this.messages.remove(previousMessage);
result = previousMessage.getContent();
}
//
return result;
}
/**
* Gets the messages.
*
@ -102,23 +77,4 @@ public class CollectiveTopic extends Topic
//
return result;
}
/**
* Checks for message.
*
* @param author
* the author
* @return true, if successful
*/
@Override
public boolean hasMessage(final String author)
{
boolean result;
Messages authorMessage = this.messages.getByAuthor(author);
result = authorMessage.isEmpty();
//
return result;
}
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
*
* This file is part of (April) Hebdobot.
@ -19,6 +19,9 @@
*/
package org.april.hebdobot.bot.review;
import java.util.HashMap;
import java.util.Map;
import fr.devinsy.strings.StringSet;
/**
@ -26,7 +29,7 @@ import fr.devinsy.strings.StringSet;
*/
public class IndividualTopic extends Topic
{
private final MessageMap messages;
private final Map<String, Messages> messages;
/**
* Instantiates a new individual topic.
@ -38,7 +41,7 @@ public class IndividualTopic extends Topic
{
super(title);
this.messages = new MessageMap();
this.messages = new HashMap<>();
}
/* (non-Javadoc)
@ -55,29 +58,6 @@ public class IndividualTopic extends Topic
this.messages.get(author).add(message);
}
/* (non-Javadoc)
* @see org.april.hebdobot.bot.review.Topic#cancelPrevious(java.lang.String)
*/
@Override
public String cancelPreviousMessage(final String participant)
{
String result;
Messages authorMessages = this.messages.get(participant);
if ((authorMessages == null) || (authorMessages.isEmpty()))
{
result = null;
}
else
{
Message removed = authorMessages.removeLast();
result = removed.getContent();
}
//
return result;
}
/**
* Gets the messages.
*
@ -109,33 +89,6 @@ public class IndividualTopic extends Topic
return result;
}
/**
* Checks for message.
*
* @param participant
* the participant
* @return true, if successful
*/
@Override
public boolean hasMessage(final String participant)
{
boolean result;
Messages messages = this.messages.get(participant);
if ((messages == null) || (messages.isEmpty()))
{
result = false;
}
else
{
result = true;
}
//
return result;
}
/**
* Checks for participant.
*

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -20,8 +20,6 @@ package org.april.hebdobot.bot.review;
import java.util.LinkedList;
import org.apache.commons.lang3.StringUtils;
/**
* The Class MessageLinkedList.
*/
@ -36,29 +34,4 @@ public class Messages extends LinkedList<Message>
{
super();
}
/**
* Gets the by author.
*
* @param author
* the author
* @return the by author
*/
public Messages getByAuthor(final String author)
{
Messages result;
result = new Messages();
for (Message message : this)
{
if (StringUtils.equals(message.getAuthor(), author))
{
result.add(message);
}
}
//
return result;
}
}

View File

@ -282,7 +282,7 @@ public class ReviewReporter
//
addLine(buffer, '=');
addEmpty(buffer);
addCenter(buffer, "Personnes participantes", '-');
addCenter(buffer, "Participants", '-');
for (final String participant : review.getParticipants())
{
addChunk(buffer, "* " + review.getAliases().getRealName(participant));
@ -343,12 +343,12 @@ public class ReviewReporter
addEmpty(buffer);
addCenter(buffer, "Statistiques");
addEmpty(buffer);
addChunk(buffer, ReviewStatsReporter.reportCurrentReviewCount(datas));
addChunk(buffer, ReviewStatsReporter.reportReviewCount(datas));
addChunk(buffer, "Horaire de début de la revue : " + review.getFormattedStartTime());
addChunk(buffer, "Horaire de fin de la revue : " + review.getFormattedEndTime());
addChunk(buffer, "Durée de la revue : " + review.getDurationInMinutes() + " minutes");
addChunk(buffer, "Nombre de personnes participantes : " + review.getParticipants().size());
addChunk(buffer, ReviewStatsReporter.reportCheckUserCountRecord(datas));
addChunk(buffer, ReviewStatsReporter.reportNewUserCountRecord(datas));
addChunk(buffer, ReviewStatsReporter.reportUserCount(datas, review.getParticipants().size()));
addChunk(buffer, ReviewStatsReporter.reportDuration(datas, review.getDurationInMinutes()));

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
*
* This file is part of (April) Hebdobot.
@ -47,14 +47,6 @@ public abstract class Topic
*/
public abstract void add(Message message);
/**
* Cancel previous.
*
* @param participant
* the participant
*/
public abstract String cancelPreviousMessage(final String participant);
/**
* Gets the participants.
*
@ -71,13 +63,4 @@ public abstract class Topic
{
return this.title;
}
/**
* Checks for message from.
*
* @param author
* the author
* @return true, if successful
*/
public abstract boolean hasMessage(String author);
}

View File

@ -106,70 +106,6 @@ public class ReviewDatas extends ArrayList<ReviewData>
return result;
}
/**
* Gets the averatge duration.
*
* @return the averatge duration
*/
public double getAveratgeDuration()
{
double result;
if (isEmpty())
{
result = 0;
}
else
{
result = 0;
int count = 0;
for (ReviewData data : this)
{
if (data.getDuration() != null)
{
count += 1;
result += data.getDuration();
}
}
if (count != 0)
{
result = result / count;
}
}
//
return result;
}
/**
* Gets the averatge user count.
*
* @return the averatge user count
*/
public double getAveratgeUserCount()
{
double result;
if (isEmpty())
{
result = 0;
}
else
{
result = 0;
for (ReviewData data : this)
{
result += data.getUserCount();
}
result = result / size();
}
//
return result;
}
/**
* Gets the by year.
*
@ -247,35 +183,6 @@ public class ReviewDatas extends ArrayList<ReviewData>
return result;
}
/**
* Gets the max duration.
*
* @return the max duration
*/
public long getMaxDuration()
{
long result;
if (isEmpty())
{
result = 0;
}
else
{
result = Long.MIN_VALUE;
for (ReviewData data : this)
{
if ((data.getDuration() != null) && (data.getUserCount() > result))
{
result = data.getDuration();
}
}
}
//
return result;
}
/**
* Gets the max user count.
*
@ -305,35 +212,6 @@ public class ReviewDatas extends ArrayList<ReviewData>
return result;
}
/**
* Gets the min duration.
*
* @return the min duration
*/
public long getMinDuration()
{
long result;
if (isEmpty())
{
result = 0;
}
else
{
result = Long.MAX_VALUE;
for (ReviewData data : this)
{
if ((data.getDuration() != null) && (data.getDuration() < result))
{
result = data.getDuration();
}
}
}
//
return result;
}
/**
* Gets the min user count.
*
@ -420,60 +298,32 @@ public class ReviewDatas extends ArrayList<ReviewData>
/**
* Reverse.
*/
public ReviewDatas reverse()
public void reverse()
{
ReviewDatas result;
Collections.reverse(this);
result = this;
//
return result;
}
/**
* Sort by date.
*/
public ReviewDatas sortByDate()
public void sortByDate()
{
ReviewDatas result;
Collections.sort(this, new ReviewDataComparator(Sorting.DATE));
result = this;
//
return result;
}
/**
* Sort by duration.
*/
public ReviewDatas sortByDuration()
public void sortByDuration()
{
ReviewDatas result;
Collections.sort(this, new ReviewDataComparator(Sorting.DURATION));
result = this;
//
return result;
}
/**
* Sort by user count.
*/
public ReviewDatas sortByUserCount()
public void sortByUserCount()
{
ReviewDatas result;
Collections.sort(this, new ReviewDataComparator(Sorting.USERCOUNT));
result = this;
//
return result;
}
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -102,83 +102,7 @@ public class ReviewStatsReporter
{
double result;
result = percent(Double.valueOf(a).doubleValue(), Double.valueOf(b).doubleValue());
//
return result;
}
/**
* Report new max. The current user count is found in last review by date.
*
* @param datas
* the datas
* @return the string
*/
public static String reportCheckUserCountRecord(final ReviewDatas datas)
{
String result;
if ((datas == null) || (datas.isEmpty()) || (datas.size() == 1))
{
result = "Absence de statistique sur la participation.";
}
else
{
ReviewDatas reviews = new ReviewDatas(datas);
reviews.sortByDate();
ReviewData lastReview = datas.getLastByIndex();
reviews.removeLast();
reviews.sortByUserCount();
ReviewData recordReview = reviews.getLastByIndex();
if (lastReview.getUserCount() < recordReview.getUserCount())
{
double averageUserCount = reviews.getAveratgeUserCount();
result = String.format("La participation moyenne aux revues est de %02.1f personnes.", averageUserCount);
}
else if (lastReview.getUserCount() == recordReview.getUserCount())
{
String lastRecordDate = recordReview.getDate().format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
result = String.format("\\o/ Record de participation égalé \\o/ Le précédent record de %d personnes était le %s.",
recordReview.getUserCount(), lastRecordDate);
}
else
{
String lastRecordDate = recordReview.getDate().format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
result = String.format(
"*\\o/* Nouveau record de participation : %d personnes ! *\\o/* Le précédent record était de %d personnes le %s.",
lastReview.getUserCount(), recordReview.getUserCount(), lastRecordDate);
}
}
//
return result;
}
/**
* Report review count.
*
* @param datas
* the datas
* @return the string
*/
public static String reportCurrentReviewCount(final ReviewDatas datas)
{
String result;
if ((datas == null) || (datas.isEmpty()))
{
result = "Pas de statistique sur le nombre de revues.";
}
else
{
long currentYear = LocalDateTime.now().getYear();
long reviewYearCount = datas.countByYear(currentYear);
result = String.format("C'était la %d%s revue hebdomadaire de l'April, la %d%s de l'année %d.", datas.size(), numberSuffix(datas.size()),
reviewYearCount, numberSuffix(reviewYearCount), currentYear);
}
result = percent(new Double(a).doubleValue(), new Double(b).doubleValue());
//
return result;
@ -245,6 +169,55 @@ public class ReviewStatsReporter
return result;
}
/**
* Report new max. The current user count is found in last review by date.
*
* @param datas
* the datas
* @return the string
*/
public static String reportNewUserCountRecord(final ReviewDatas datas)
{
String result;
if ((datas == null) || (datas.isEmpty()) || (datas.size() == 1))
{
result = "Absence de statistique sur la participation.";
}
else
{
ReviewDatas reviews = new ReviewDatas(datas);
reviews.sortByDate();
ReviewData lastReview = datas.getLastByIndex();
reviews.removeLast();
reviews.sortByUserCount();
ReviewData recordReview = reviews.getLastByIndex();
if (lastReview.getUserCount() < recordReview.getUserCount())
{
String lastRecordDate = recordReview.getDate().format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
result = String.format("Le dernier record de participation est de %d personnes le %s.", recordReview.getUserCount(), lastRecordDate);
}
else if (lastReview.getUserCount() == recordReview.getUserCount())
{
result = "Record de participation égalé.";
String lastRecordDate = recordReview.getDate().format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
result = String.format("\\o/ Record de participation égalé \\o/ Le précédent record était de %d personnes le %s.",
recordReview.getUserCount(), lastRecordDate);
}
else
{
String lastRecordDate = recordReview.getDate().format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
result = String.format(
"*\\o/* Nouveau record de participation : %d personnes ! *\\o/* Le précédent record était de %d personnes le %s.",
lastReview.getUserCount(), recordReview.getUserCount(), lastRecordDate);
}
}
//
return result;
}
/**
* Report review count.
*
@ -262,61 +235,11 @@ public class ReviewStatsReporter
}
else
{
ReviewData firstReview = datas.sortByDate().get(0);
long reviewCount = datas.size();
String firstDate = firstReview.getDate().format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy", Locale.FRENCH));
long currentYear = LocalDateTime.now().getYear();
long reviewYearCount = datas.countByYear(currentYear);
result = String.format("Il y a eu %d revues. La première date du %s.", reviewCount, firstDate);
}
//
return result;
}
/**
* Report review duration.
*
* @param datas
* the datas
* @return the string
*/
public static String reportReviewDuration(final ReviewDatas datas)
{
String result;
if ((datas == null) || (datas.isEmpty()))
{
result = "Pas de statistique sur la durée des revues.";
}
else
{
result = String.format("Durée des revues : min.=%d min, moy.=%.1f min, max=%d min", datas.getMinDuration(), datas.getAveratgeDuration(),
datas.getMaxDuration());
}
//
return result;
}
/**
* Report review user count.
*
* @param datas
* the datas
* @return the string
*/
public static String reportReviewUserCount(final ReviewDatas datas)
{
String result;
if ((datas == null) || (datas.isEmpty()))
{
result = "Absence de statistique sur les participations.";
}
else
{
result = String.format("Participation aux revues : min.=%d, moy.=%.1f, max=%d", datas.getMinUserCount(), datas.getAveratgeUserCount(),
datas.getMaxUserCount());
result = String.format("C'était la %d%s revue hebdomadaire de l'April, la %d%s de l'année %d.", datas.size(), numberSuffix(datas.size()),
reviewYearCount, numberSuffix(reviewYearCount), currentYear);
}
//

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
*
* This file is part of (April) Hebdobot.
@ -50,7 +50,7 @@ public class HebdobotCLI
private static final String DEFAULT_ALIAS_FILE = "users.conf";
/**
* Instantiates a new hebdobot CLI.
* Instantiates a new hebdobot launcher.
*/
private HebdobotCLI()
{
@ -209,7 +209,7 @@ public class HebdobotCLI
//
logger.info("Bot configuring…");
bot.getPrivatebinSettings().setServerUrl(config.getPrivatebinUrl());
bot.getPastebinSettings().setApiKey(config.getPastebinApiKey());
bot.getIdenticaSettings().setApiKey(config.getIdenticaApiKey());
bot.getIdenticaSettings().setApiSecret(config.getIdenticaApiSecret());
bot.getTwitterSettings().setConsumerKey(config.getTwitterConsumerKey());

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -21,8 +21,6 @@ package org.april.hebdobot.cli;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.Properties;
@ -334,23 +332,15 @@ public class HebdobotConfigFile extends Properties
}
/**
* Gets the private bin url.
* Gets the pastebin api key.
*
* @return the private bin url
* @return the pastebin api key
*/
public URL getPrivatebinUrl()
public String getPastebinApiKey()
{
URL result;
String result;
try
{
String value = getProperty("privatebin.url");
result = new URL(value);
}
catch (MalformedURLException exception)
{
result = null;
}
result = getProperty("pastebin.apiKey");
//
return result;

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2017,2019 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2017 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
@ -37,8 +37,6 @@ public class CronValue
*
* @param name
* the name
* @param description
* the description
* @param cron
* the cron
* @param ircMessage

View File

@ -0,0 +1,52 @@
/**
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.pastebin;
public class APIException extends Exception
{
private static final long serialVersionUID = 1852384776503676687L;
/**
* Instantiates a new API exception.
*
* @param message
* the message
*/
private APIException(final String message)
{
super(message);
}
/**
* Throw if error.
*
* @param content
* the content
* @throws APIException
* the API exception
*/
public static void throwIfError(final String content) throws APIException
{
if (content.contains(PastebinClient.API_ERROR))
{
throw new APIException(content.replaceFirst(PastebinClient.API_ERROR, ""));
}
}
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
*
* This file is part of (April) Hebdobot.
@ -17,21 +17,18 @@
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.privatebin;
package org.april.hebdobot.pastebin;
/**
* The Enum Expiration.
*/
public enum Expiration
{
MINUTE_5("5min"),
MINUTE_10("10min"),
HOUR_1("1hour"),
DAY_1("1day"),
WEEK_1("1week"),
MONTH_1("1month"),
YEAR_1("1year"),
NEVER("never");
NEVER(null),
MINUTE_10("10M"),
HOUR_1("1H"),
DAY_1("1D"),
MONTH_1("1M");
private final String value;
@ -47,18 +44,12 @@ public enum Expiration
}
/**
* To string.
* Gets the value.
*
* @return the string
* @return the value
*/
@Override
public String toString()
public String getValue()
{
String result;
result = this.value;
//
return result;
return this.value;
}
}

View File

@ -1,5 +1,6 @@
/**
* Copyright (C) 2019-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
*
* This file is part of (April) Hebdobot.
*
@ -16,16 +17,18 @@
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.privatebin;
package org.april.hebdobot.pastebin;
/**
* The Enum Formatter.
* The Enum Format.
*/
public enum Formatter
public enum Format
{
PLAINTEXT("plaintext"),
SYNTAXHIGHLIGHTING("syntaxhighlighting"),
MARKDOWN("markdown");
NONE(null),
C("c"),
CPP("cpp"),
JAVA("java"),
JAVA_5("java5");
private final String value;
@ -35,24 +38,18 @@ public enum Formatter
* @param value
* the value
*/
private Formatter(final String value)
private Format(final String value)
{
this.value = value;
}
/**
* To string.
* Gets the value.
*
* @return the string
* @return the value
*/
@Override
public String toString()
public String getValue()
{
String result;
result = this.value;
//
return result;
return this.value;
}
}

View File

@ -1,5 +1,6 @@
/**
* Copyright (C) 2019-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
*
* This file is part of (April) Hebdobot.
*
@ -16,15 +17,14 @@
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.privatebin;
package org.april.hebdobot.pastebin;
/**
* The Enum Option.
*/
public enum OpenDiscussion
public enum Option
{
ON("1"),
OFF("0");
PASTE("paste");
private final String value;
@ -34,24 +34,18 @@ public enum OpenDiscussion
* @param value
* the value
*/
private OpenDiscussion(final String value)
private Option(final String value)
{
this.value = value;
}
/**
* To string.
* Gets the value.
*
* @return the string
* @return the value
*/
@Override
public String toString()
public String getValue()
{
String result;
result = this.value;
//
return result;
return this.value;
}
}

View File

@ -0,0 +1,493 @@
/**
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.pastebin;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.LinkedList;
import java.util.List;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.april.hebdobot.HebdobotException;
/**
* The Class PastebinClient.
*/
public class PastebinClient
{
private static final String API_LOGIN_URL = "https://pastebin.com/api/api_login.php";
private static final String API_POST_URL = "https://pastebin.com/api/api_post.php";
private static final String API_DEV_KEY = "api_dev_key";
private static final String API_USER_KEY = "api_user_key";
private static final String API_USER_NAME = "api_user_name";
private static final String API_USER_PASSWORD = "api_user_password";
private static final String API_OPTION = "api_option";
private static final String API_PASTE_PRIVATE = "api_paste_private";
private static final String API_PASTE_NAME = "api_paste_name";
private static final String API_PASTE_EXPIRATION = "api_paste_expire_date";
private static final String API_PASTE_FORMAT = "api_paste_format";
private static final String API_PASTE_CODE = "api_paste_code";
public static final String API_ERROR = "Bad API request,";
private String apiKey;
private String apiUserKey;
private HttpClient httpClient;
/**
* Instantiates a new pastebin client.
*
* @param apiKey
* the api key
*/
public PastebinClient(final String apiKey)
{
this.apiKey = apiKey;
this.httpClient = new DefaultHttpClient();
}
/**
* Login.
*
* @param name
* the name
* @param password
* the password
* @throws HebdobotException
* the hebdobot exception
*/
public void login(final String name, final String password) throws HebdobotException
{
try
{
final List<NameValuePair> params = new LinkedList<>();
setParameter(params, API_DEV_KEY, this.apiKey);
setParameter(params, API_USER_NAME, name);
setParameter(params, API_USER_PASSWORD, password);
final HttpPost request = new HttpPost(API_LOGIN_URL);
request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
final HttpResponse response = this.httpClient.execute(request);
final String content = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
APIException.throwIfError(content);
this.apiUserKey = content;
}
catch (UnsupportedEncodingException exception)
{
throw new HebdobotException(exception);
}
catch (ClientProtocolException exception)
{
throw new HebdobotException(exception);
}
catch (IOException exception)
{
throw new HebdobotException(exception);
}
catch (APIException exception)
{
throw new HebdobotException(exception);
}
}
/**
* Paste.
*
* @param code
* the code
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code) throws HebdobotException
{
String result;
result = this.paste(code, null, Format.NONE, Private.PUBLIC, Expiration.DAY_1);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param expiration
* the expiration
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final Expiration expiration) throws HebdobotException
{
String result;
result = this.paste(code, null, Format.NONE, Private.PUBLIC, expiration);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param format
* the format
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final Format format) throws HebdobotException
{
String result;
result = this.paste(code, null, format, Private.PUBLIC, Expiration.DAY_1);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param format
* the format
* @param expiration
* the expiration
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final Format format, final Expiration expiration) throws HebdobotException
{
String result;
result = this.paste(code, null, format, Private.PUBLIC, expiration);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param format
* the format
* @param privat
* the privat
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final Format format, final Private privat) throws HebdobotException
{
String result;
result = this.paste(code, null, format, privat, Expiration.DAY_1);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param format
* the format
* @param privat
* the privat
* @param expiration
* the expiration
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final Format format, final Private privat, final Expiration expiration) throws HebdobotException
{
String result;
result = this.paste(code, null, format, privat, expiration);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param privat
* the privat
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final Private privat) throws HebdobotException
{
String result;
result = this.paste(code, null, Format.NONE, privat, Expiration.DAY_1);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param privat
* the privat
* @param expiration
* the expiration
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final Private privat, final Expiration expiration) throws HebdobotException
{
String result;
result = this.paste(code, null, Format.NONE, privat, expiration);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param name
* the name
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final String name) throws HebdobotException
{
String result;
result = this.paste(code, name, Format.NONE, Private.PUBLIC, Expiration.DAY_1);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param name
* the name
* @param format
* the format
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final String name, final Format format) throws HebdobotException
{
String result;
result = this.paste(code, name, format, Private.PUBLIC, Expiration.DAY_1);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param name
* the name
* @param format
* the format
* @param expiration
* the expiration
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final String name, final Format format, final Expiration expiration) throws HebdobotException
{
String result;
result = this.paste(code, name, format, Private.PUBLIC, expiration);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param name
* the name
* @param format
* the format
* @param privat
* the privat
* @return the string
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final String name, final Format format, final Private privat) throws HebdobotException
{
String result;
result = this.paste(code, name, format, privat, Expiration.DAY_1);
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param name
* the name
* @param format
* the format
* @param privat
* the privat
* @param expiration
* the expiration
* @return the pastebin URL
* @throws HebdobotException
* the exception
*/
public String paste(final String code, final String name, final Format format, final Private privat, final Expiration expiration)
throws HebdobotException
{
String result;
try
{
List<NameValuePair> params = new LinkedList<>();
setParameter(params, API_DEV_KEY, this.apiKey);
setParameter(params, API_USER_KEY, this.apiUserKey);
setParameter(params, API_OPTION, Option.PASTE.getValue());
setParameter(params, API_PASTE_PRIVATE, privat.getValue());
setParameter(params, API_PASTE_NAME, name);
setParameter(params, API_PASTE_EXPIRATION, expiration.getValue());
setParameter(params, API_PASTE_FORMAT, format.getValue());
setParameter(params, API_PASTE_CODE, code);
final HttpPost request = new HttpPost(API_POST_URL);
request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
final HttpResponse response = this.httpClient.execute(request);
result = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
APIException.throwIfError(result);
}
catch (UnsupportedEncodingException exception)
{
throw new HebdobotException(exception);
}
catch (ClientProtocolException exception)
{
throw new HebdobotException(exception);
}
catch (IOException exception)
{
throw new HebdobotException(exception);
}
catch (APIException exception)
{
throw new HebdobotException(exception);
}
//
return result;
}
/**
* Paste.
*
* @param code
* the code
* @param name
* the name
* @param privat
* the privat
* @return the pastebin URL
* @throws HebdobotException
* the hebdobot exception
*/
public String paste(final String code, final String name, final Private privat) throws HebdobotException
{
String result;
result = this.paste(code, name, Format.NONE, privat, Expiration.DAY_1);
//
return result;
}
/**
* Sets the parameter.
*
* @param params
* the params
* @param name
* the name
* @param value
* the value
*/
private static void setParameter(final List<NameValuePair> params, final String name, final String value)
{
if (value != null)
{
params.add(new BasicNameValuePair(name, value));
}
}
}

View File

@ -0,0 +1,80 @@
/**
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.pastebin;
import org.apache.commons.lang3.StringUtils;
/**
* The Class PatebinSettings.
*/
public class PastebinSettings
{
private String apiKey;
/**
* Instantiates a new pastebin settings.
*/
public PastebinSettings()
{
this.apiKey = null;
}
/**
* Instantiates a new pastebin settings.
*
* @param apiKey
* the api key
*/
public PastebinSettings(final String apiKey)
{
this.apiKey = apiKey;
}
public String getApiKey()
{
return this.apiKey;
}
/**
* Checks if is valid.
*
* @return true, if is valid
*/
public boolean isValid()
{
boolean result;
if ((StringUtils.isBlank(this.apiKey)) || (StringUtils.containsOnly(this.apiKey, 'X')))
{
result = false;
}
else
{
result = true;
}
//
return result;
}
public void setApiKey(final String apiKey)
{
this.apiKey = apiKey;
}
}

View File

@ -1,5 +1,6 @@
/**
* Copyright (C) 2019-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
*
* This file is part of (April) Hebdobot.
*
@ -16,42 +17,37 @@
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.privatebin;
package org.april.hebdobot.pastebin;
/**
* The Enum Option.
* The Enum Private.
*/
public enum BurnAfterReading
public enum Private
{
ON("1"),
OFF("0");
PUBLIC("0"),
UNLISTED("1"),
PRIVATE("2");
private final String value;
private String value;
/**
* Instantiates a new option.
* Instantiates a new private.
*
* @param value
* the value
*/
private BurnAfterReading(final String value)
private Private(final String value)
{
this.value = value;
}
/**
* To string.
* Gets the value.
*
* @return the string
* @return the value
*/
@Override
public String toString()
String getValue()
{
String result;
result = this.value;
//
return result;
return this.value;
}
}

View File

@ -1,208 +0,0 @@
/*
* Copyright 2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright 2020 Dr Ian Preston ianopolous
* Copyright 2018 Andreas Schildbach
* Copyright 2011 Google Inc.
*
* From:
* https://github.com/multiformats/java-multibase/blob/master/src/main/java/io/ipfs/multibase/Base58.java
* https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/org/bitcoinj/core/Base58.java
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.april.hebdobot.privatebin;
import java.math.BigInteger;
import java.util.Arrays;
/**
* Base58 is a way to encode Bitcoin addresses (or arbitrary data) as
* alphanumeric strings.
* <p>
* Note that this is not the same base58 as used by Flickr, which you may find
* referenced around the Internet.
* <p>
* Satoshi explains: why base-58 instead of standard base-64 encoding?
* <ul>
* <li>Don't want 0OIl characters that look the same in some fonts and could be
* used to create visually identical looking account numbers.</li>
* <li>A string with non-alphanumeric characters is not as easily accepted as an
* account number.</li>
* <li>E-mail usually won't line-break if there's no punctuation to break
* at.</li>
* <li>Doubleclicking selects the whole number as one word if it's all
* alphanumeric.</li>
* </ul>
* <p>
* However, note that the encoding/decoding runs in O(n&sup2;) time, so it is
* not useful for large data.
* <p>
* The basic idea of the encoding is to treat the data bytes as a large number
* represented using base-256 digits, convert the number to be represented using
* base-58 digits, preserve the exact number of leading zeros (which are
* otherwise lost during the mathematical operations on the numbers), and
* finally represent the resulting base-58 digits as alphanumeric ASCII
* characters.
*/
public class Base58
{
public static final char[] ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".toCharArray();
private static final char ENCODED_ZERO = ALPHABET[0];
private static final int[] INDEXES = new int[128];
static
{
Arrays.fill(INDEXES, -1);
for (int i = 0; i < ALPHABET.length; i++)
{
INDEXES[ALPHABET[i]] = i;
}
}
/**
* Decodes the given base58 string into the original data bytes.
*
* @param input
* the base58-encoded string to decode
* @return the decoded data bytes
*/
public static byte[] decode(final String input)
{
if (input.length() == 0)
{
return new byte[0];
}
// Convert the base58-encoded ASCII chars to a base58 byte sequence
// (base58 digits).
byte[] input58 = new byte[input.length()];
for (int i = 0; i < input.length(); ++i)
{
char c = input.charAt(i);
int digit = c < 128 ? INDEXES[c] : -1;
if (digit < 0)
{
throw new IllegalStateException("InvalidCharacter in base 58");
}
input58[i] = (byte) digit;
}
// Count leading zeros.
int zeros = 0;
while (zeros < input58.length && input58[zeros] == 0)
{
++zeros;
}
// Convert base-58 digits to base-256 digits.
byte[] decoded = new byte[input.length()];
int outputStart = decoded.length;
for (int inputStart = zeros; inputStart < input58.length;)
{
decoded[--outputStart] = divmod(input58, inputStart, 58, 256);
if (input58[inputStart] == 0)
{
++inputStart; // optimization - skip leading zeros
}
}
// Ignore extra leading zeroes that were added during the calculation.
while (outputStart < decoded.length && decoded[outputStart] == 0)
{
++outputStart;
}
// Return decoded data (including original number of leading zeros).
return Arrays.copyOfRange(decoded, outputStart - zeros, decoded.length);
}
public static BigInteger decodeToBigInteger(final String input)
{
return new BigInteger(1, decode(input));
}
/**
* Divides a number, represented as an array of bytes each containing a
* single digit in the specified base, by the given divisor. The given
* number is modified in-place to contain the quotient, and the return value
* is the remainder.
*
* @param number
* the number to divide
* @param firstDigit
* the index within the array of the first non-zero digit (this
* is used for optimization by skipping the leading zeros)
* @param base
* the base in which the number's digits are represented (up to
* 256)
* @param divisor
* the number to divide by (up to 256)
* @return the remainder of the division operation
*/
private static byte divmod(final byte[] number, final int firstDigit, final int base, final int divisor)
{
// this is just long division which accounts for the base of the input
// digits
int remainder = 0;
for (int i = firstDigit; i < number.length; i++)
{
int digit = number[i] & 0xFF;
int temp = remainder * base + digit;
number[i] = (byte) (temp / divisor);
remainder = temp % divisor;
}
return (byte) remainder;
}
/**
* Encodes the given bytes as a base58 string (no checksum is appended).
*
* @param input
* the bytes to encode
* @return the base58-encoded string
*/
public static String encode(byte[] input)
{
if (input.length == 0)
{
return "";
}
// Count leading zeros.
int zeros = 0;
while (zeros < input.length && input[zeros] == 0)
{
++zeros;
}
// Convert base-256 digits to base-58 digits (plus conversion to ASCII
// characters)
input = Arrays.copyOf(input, input.length); // since we modify it
// in-place
char[] encoded = new char[input.length * 2]; // upper bound
int outputStart = encoded.length;
for (int inputStart = zeros; inputStart < input.length;)
{
encoded[--outputStart] = ALPHABET[divmod(input, inputStart, 256, 58)];
if (input[inputStart] == 0)
{
++inputStart; // optimization - skip leading zeros
}
}
// Preserve exactly as many leading encoded zeros in output as there
// were leading zeros in input.
while (outputStart < encoded.length && encoded[outputStart] == ENCODED_ZERO)
{
++outputStart;
}
while (--zeros >= 0)
{
encoded[--outputStart] = ENCODED_ZERO;
}
// Return encoded string (including encoded leading zeros).
return new String(encoded, outputStart, encoded.length - outputStart);
}
}

View File

@ -1,57 +0,0 @@
/**
* Copyright (C) 2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.privatebin;
/**
* The Enum Compression.
*/
public enum Compression
{
NONE("none"),
ZLIB("zlib");
private final String value;
/**
* Instantiates a new option.
*
* @param value
* the value
*/
private Compression(final String value)
{
this.value = value;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString()
{
String result;
result = this.value;
//
return result;
}
}

View File

@ -1,253 +0,0 @@
/**
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.privatebin;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import java.util.Arrays;
import java.util.Base64;
import java.util.Random;
import java.util.zip.Deflater;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
import javax.net.ssl.HttpsURLConnection;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.ClientProtocolException;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
/**
* The Class PastebinClient.
*/
public class PrivatebinClient extends PrivatebinSettings
{
private static final Logger logger = LoggerFactory.getLogger(PrivatebinClient.class);
/**
* Instantiates a new privatebin client.
*
* @param settings
* the settings
*/
public PrivatebinClient(final PrivatebinSettings settings)
{
super(settings);
}
/**
* Instantiates a new privatebin client.
*
* @param url
* the url
*/
public PrivatebinClient(final URL url)
{
super();
setServerUrl(url);
}
/**
* Paste.
*
* @param text
* the text
* @return the string
* @throws PrivatebinException
* the privatebin exception
*/
public String paste(final String text) throws PrivatebinException
{
String result;
result = null;
try
{
// Note: the following code is based on:
// https://github.com/PrivateBin/PrivateBin/wiki/API
// https://github.com/kkingsley-BF/PrivateBin-Groovy/blob/master/Paste.groovy
// Build message to encrypt.
JSONObject pasteDataJson = new JSONObject();
pasteDataJson.put("paste", text);
String pasteData = pasteDataJson.toJSONString();
// logger.debug("pasteData={}", pasteData);
// Compression.
byte[] pasteDataBytes;
if (this.compression == Compression.ZLIB)
{
Deflater zipDeflater = new Deflater();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
zipDeflater.setInput(pasteData.getBytes());
zipDeflater.finish();
byte[] buffer = new byte[1024];
while (!zipDeflater.finished())
{
int count = zipDeflater.deflate(buffer);
stream.write(buffer, 0, count);
}
byte[] output;
output = stream.toByteArray();
stream.close();
zipDeflater.end();
// Need to remove the header
pasteDataBytes = Arrays.copyOfRange(output, 2, output.length - 4);
}
else
{
pasteDataBytes = pasteData.getBytes();
}
// Generate password.
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(192);
String randomPassword = Base64.getEncoder().encodeToString(keyGen.generateKey().getEncoded());
String customPassword = randomPassword + this.password;
// Generate IV.
byte[] cipherIVBytes = new byte[16];
new Random().nextBytes(cipherIVBytes);
String cipherIVEncoded = Base64.getEncoder().encodeToString(cipherIVBytes);
// Generate salt.
byte[] kdfSaltBytes = new byte[8];
new Random().nextBytes(kdfSaltBytes);
String kdfSaltEncoded = Base64.getEncoder().encodeToString(kdfSaltBytes);
// Generate secret key for cipher.
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
KeySpec passwordBasedEncryptionKeySpec = new PBEKeySpec(customPassword.toCharArray(), kdfSaltBytes, 100000, 256);
SecretKey secret = new SecretKeySpec(factory.generateSecret(passwordBasedEncryptionKeySpec).getEncoded(), "AES");
// Cipher AAD.
StringList gcmTagString = new StringList();
gcmTagString.append("[");
gcmTagString.append("[");
gcmTagString.append("\"").append(cipherIVEncoded).append("\"").append(",");
gcmTagString.append("\"").append(kdfSaltEncoded).append("\"").append(",");
gcmTagString.append("100000,256,128,");
gcmTagString.append("\"").append("aes").append("\"").append(",");
gcmTagString.append("\"").append("gcm").append("\"").append(",");
gcmTagString.append("\"").append(this.compression.toString()).append("\"");
gcmTagString.append("]");
gcmTagString.append(",");
gcmTagString.append("\"").append(this.formatter.toString()).append("\"").append(",");
gcmTagString.append(this.openDiscussion.toString()).append(",");
gcmTagString.append(this.burnAfterReading.toString());
gcmTagString.append("]");
byte[] gcmBytes = gcmTagString.toString().getBytes();
// Generate cipher text.
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
GCMParameterSpec spec = new GCMParameterSpec(128, cipherIVBytes);
cipher.init(Cipher.ENCRYPT_MODE, secret, spec);
cipher.updateAAD(gcmBytes);
byte[] cipherTextBytes = cipher.doFinal(pasteDataBytes);
String cipherText = Base64.getEncoder().encodeToString(cipherTextBytes);
// logger.debug("cipherText={}", cipherText);
// Create POST payload.
StringList payload = new StringList();
payload.append("{");
payload.append("\"v\":2,");
payload.append("\"adata\":").append(gcmTagString.toString()).append(",");
payload.append("\"ct\":\"").append(cipherText).append("\",");
payload.append("\"meta\":{\"expire\":\"").append(this.expiration).append("\"}");
payload.append("}");
// logger.debug("PAYLOAD={}", payload.toString());
// POST Request.
HttpsURLConnection pasteRequest = (HttpsURLConnection) this.serverUrl.openConnection();
pasteRequest.setRequestMethod("POST");
pasteRequest.setDoOutput(true);
pasteRequest.setRequestProperty("X-Requested-With", "JSONHttpRequest");
pasteRequest.getOutputStream().write(payload.toString().getBytes());
// Server response.
int responseCode = pasteRequest.getResponseCode();
logger.debug("Server response: {}", responseCode);
if (responseCode == 200)
{
String out = IOUtils.toString(pasteRequest.getInputStream(), "UTF-8");
logger.info("===> {}", out);
JSONObject parser = (JSONObject) new JSONParser().parse(out);
String status = parser.get("status").toString();
if (StringUtils.equals(status, "0"))
{
String id = parser.get("id").toString();
String pasteURL = parser.get("url").toString();
String deleteToken = parser.get("deletetoken").toString();
String finalURL = this.serverUrl + pasteURL + "#" + Base58.encode(randomPassword.getBytes());
String deleteURL = this.serverUrl + pasteURL + "&deletetoken=" + deleteToken;
logger.info("Pastebin SUCCESS");
logger.debug("Paste URL: {}", finalURL);
logger.debug("Delete URL: {}", deleteURL);
result = finalURL;
}
else
{
String output = parser.get("message").toString();
logger.warn("message={}", output);
throw new PrivatebinException(out);
}
}
}
catch (BadPaddingException | IllegalBlockSizeException | InvalidAlgorithmParameterException | InvalidKeyException | InvalidKeySpecException
| NoSuchAlgorithmException | NoSuchPaddingException | ParseException | UnsupportedEncodingException |
ClientProtocolException exception)
{
exception.printStackTrace();
throw new PrivatebinException(exception);
}
catch (IOException exception)
{
exception.printStackTrace();
throw new PrivatebinException(exception);
}
//
return result;
}
}

View File

@ -1,70 +0,0 @@
/**
* Copyright (C) 2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.privatebin;
/**
* The Class PrivateBinException.
*/
public class PrivatebinException extends Exception
{
private static final long serialVersionUID = -1113543017171098521L;
/**
* Instantiates a new private bin exception.
*/
public PrivatebinException()
{
super();
}
/**
* Instantiates a new private bin exception.
*
* @param message
* the message
*/
public PrivatebinException(final String message)
{
super(message);
}
/**
* Instantiates a new private bin exception.
*
* @param message
* the message
* @param cause
* the cause
*/
public PrivatebinException(final String message, final Throwable cause)
{
super(message, cause);
}
/**
* Instantiates a new private bin exception.
*
* @param cause
* the cause
*/
public PrivatebinException(final Throwable cause)
{
super(cause);
}
}

View File

@ -1,203 +0,0 @@
/**
* Copyright (C) 2019-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.privatebin;
import java.net.URL;
/**
* The Class PrivatebinSettings
*/
public class PrivatebinSettings
{
protected URL serverUrl;
protected Compression compression;
protected Expiration expiration;
protected BurnAfterReading burnAfterReading;
protected OpenDiscussion openDiscussion;
protected Formatter formatter;
protected String password;
/**
* Instantiates a new Privatebin settings.
*/
public PrivatebinSettings()
{
this.serverUrl = null;
this.compression = Compression.ZLIB;
this.expiration = Expiration.DAY_1;
this.burnAfterReading = BurnAfterReading.OFF;
this.openDiscussion = OpenDiscussion.OFF;
this.formatter = Formatter.PLAINTEXT;
this.password = "";
}
/**
* Instantiates a new privatebin settings.
*
* @param settings
* the settings
*/
public PrivatebinSettings(final PrivatebinSettings settings)
{
this.serverUrl = settings.serverUrl;
this.compression = settings.compression;
this.expiration = settings.expiration;
this.burnAfterReading = settings.burnAfterReading;
this.openDiscussion = settings.openDiscussion;
this.formatter = settings.formatter;
this.password = settings.password;
}
public BurnAfterReading getBurnAfterReading()
{
return this.burnAfterReading;
}
public Compression getCompression()
{
return this.compression;
}
public Expiration getExpiration()
{
return this.expiration;
}
public Formatter getFormatter()
{
return this.formatter;
}
public OpenDiscussion getOpenDiscussion()
{
return this.openDiscussion;
}
public String getPassword()
{
return this.password;
}
public URL getServerUrl()
{
return this.serverUrl;
}
/**
* Checks if is valid.
*
* @return true, if is valid
*/
public boolean isValid()
{
boolean result;
if (this.serverUrl == null)
{
result = false;
}
else if ((this.burnAfterReading == BurnAfterReading.ON) && (this.openDiscussion == OpenDiscussion.ON))
{
// Burn after reading cannot be active if opendiscussion is.
result = false;
}
else
{
result = true;
}
//
return result;
}
public void setBurnAfterReading(final BurnAfterReading burnAfterReading)
{
if (burnAfterReading != null)
{
this.burnAfterReading = burnAfterReading;
}
}
public void setCompression(final Compression compression)
{
if (compression != null)
{
this.compression = compression;
}
}
public void setExpiration(final Expiration expiration)
{
if (expiration != null)
{
this.expiration = expiration;
}
}
public void setFormatter(final Formatter formatter)
{
if (formatter != null)
{
this.formatter = formatter;
}
}
public void setOpenDiscussion(final OpenDiscussion openDiscussion)
{
if (openDiscussion != null)
{
this.openDiscussion = openDiscussion;
}
}
public void setPassword(final String password)
{
if (password == null)
{
this.password = "";
}
else
{
this.password = password;
}
}
public void setServerUrl(final URL serverUrl)
{
this.serverUrl = serverUrl;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString()
{
String result;
result = String.format("valid=%b, url=%s, formatter=%s, compression=%s, expiration=%s, burnafterreading=%s, opendiscussion=%s, password=%s",
isValid(), this.serverUrl, this.formatter, this.compression, this.expiration, this.burnAfterReading, this.openDiscussion,
this.password);
//
return result;
}
}

View File

@ -1,95 +0,0 @@
/**
* Copyright (C) 2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.util;
import java.time.Duration;
import java.time.LocalDateTime;
/**
* The Class Chrono.
*/
public class Chrono
{
private LocalDateTime start;
/**
* Instantiates a new time keeper.
*/
public Chrono()
{
reset();
}
/**
* Format.
*
* @return the string
*/
public String format()
{
String result;
if (this.start == null)
{
result = "n/a";
}
else
{
LocalDateTime end = LocalDateTime.now();
Duration duration = Duration.between(this.start, end);
result = String.format("%1d:%02d", duration.getSeconds() / 60, duration.getSeconds() % 60);
}
//
return result;
}
/**
* Reset.
*/
public void reset()
{
this.start = null;
}
/**
* Start.
*/
public void start()
{
this.start = LocalDateTime.now();
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString()
{
String result;
result = format();
//
return result;
}
}

View File

@ -12,8 +12,8 @@ irc.port=6667
irc.name=Hebdobot
irc.channel=#april-test
# Privatebin settings.
privatebin.url=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Pastebin settings.
pastebin.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Ident.ca settings.
identica.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

View File

@ -72,7 +72,7 @@ public class ReviewStatsReporterTest
logger.debug("File loaded.");
ReviewData currentReview = new ReviewData(LocalDateTime.now(), 12, 17L);
datas.add(currentReview);
String report = ReviewStatsReporter.reportCheckUserCountRecord(datas);
String report = ReviewStatsReporter.reportNewUserCountRecord(datas);
logger.debug("Report=" + report);
Assert.assertTrue(StringUtils.startsWith(report, "Le dernier record de"));
}
@ -92,7 +92,7 @@ public class ReviewStatsReporterTest
logger.debug("File loaded.");
ReviewData currentReview = new ReviewData(LocalDateTime.now(), 42000, 17L);
datas.add(currentReview);
String report = ReviewStatsReporter.reportCheckUserCountRecord(datas);
String report = ReviewStatsReporter.reportNewUserCountRecord(datas);
logger.debug("Report=" + report);
Assert.assertTrue(StringUtils.startsWith(report, "*\\o/* Nouveau record de participation"));
}

View File

@ -1,5 +1,6 @@
/**
* Copyright (C) 2021 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
*
* This file is part of (April) Hebdobot.
*
@ -16,22 +17,26 @@
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.review;
package org.april.hebdobot.pastebin;
import java.util.HashMap;
import org.junit.Test;
/**
* The Class MessageMap.
* The Class PastebinClientTest.
*/
public class MessageMap extends HashMap<String, Messages>
public class PastebinClientTest
{
private static final long serialVersionUID = 2324236890989710448L;
private final PastebinClient client = new PastebinClient("b95ea42d539ec9dca02a7da1f5b229c7");
/**
* Instantiates a new message map.
* Test paste.
*
* @throws Exception
* the exception
*/
public MessageMap()
@Test
public void testPaste() throws Exception
{
super();
System.out.println(this.client.paste("ééé", Expiration.MINUTE_10));
}
}

View File

@ -1,416 +0,0 @@
================================================================================
Revue de la semaine en cours
Vendredi 02 avril 2021
================================================================================
================================================================================
--------------------------------- Participants ---------------------------------
* IIIIIIIII IIII (cccccccccc)
* aaaa (aaaa)
* Cccccccccc P. Mmmmmm (cccc_cccccc)
* Pppppp (Pppppp)
================================================================================
------------------------- IIIIIIIII IIII (cccccccccc) --------------------------
=== 1/ Actions passées ou en cours ===
* dépilage courriels suite au congé
* ca@ : suivi divers
* participation à point d'équipe/dossiers
* suivi courriels sur secretaire@
* suivi nouvelles adhésions
* suivi relances personnes morales en retard de cotisation
* relectures diverses
* réu sensibilisation hebdo : orga, annonces, animation
* rdv « tâches importantes » : orga, annonces, présence
* intervention à la 100e de Libre à vous !
* divers fournisseurs
* divers en vente libre
* divers formulaire de contact
* divers régie lav !
* test imprimante
* divers pour rediffusion d'une émission mardi 06/04
* suivi tâches admins me concernant
* maj diverses pad d'orga LAV !
* ventilation temps par catégories LAV !
* divers membres en bounce
=== 2/ Actions à venir ===
* divers lef 2021 : remerciements, bilan, maj diverses
* divers refonte graphique libre en fête
* divers projets sensi
* divers lav !
* suite dépilage courriels
* suivi dossiers administratifs divers
* divers en vente libre
* recherche personnes intervenantes pour sujet longchronique à venir lav !
* rdv « tâches importantes » : orga, annonces, présence
* revue hebdomadaire : génération de la synthèse
* divers en fonction du temps
================================================================================
--------------------------------- aaaa (aaaa) ----------------------------------
=== 2/ Actions à venir ===
* Participation à reunion chatons
* Participation à réunion chapril
* Modération et animation chapril xmpp
* Mise en place de mon serveur physique \o/
================================================================================
----------------------- Cccccccccc P. Mmmmmm (cccc_cccccc) ------------------------
=== 1/ Actions passées ou en cours ===
* CA : courant
* Gdt:adminsys : supervision SI
* Gdt:adminsys : tâches sprint
* Gdt:adminsys : réunion de sprint mensuel adminsys
* Gdt:adminsys : Mettre à jour Gitea/forge.chapril.org en 1.13.6 (#5290)
* Gdt:chapril : supervision SI
* Gdt:chapril : upgrades
* Gdt:chapril : reboot SI
* Gdt:chapril : suivi CHATONS
* Gdt:chapril : jardinage tickets
* Gdt:chapril : réunion CHATONS ChatonsInfos
* Gdt:chapril : dev ChaprilInfos
* Gdt:chapril : dev gestion logs
* Gdt:chapril : permanence du samedi matin
* Gdt:chapril : Mettre à jour Gitea/forge.chapril.org en 1.13.6 (#5291)
* Gdt:chapril : modération pouet.chapril.org
* Gdt:chapril : réponse demande de stage
* Libreàvous! : écoute de l'émission
* Libreàvous! : participation avec une capsule pour la 100e
* Décryptualité : écoute de l'émission
* Transcription : relecture émission n°94
* Virus : suivi, grrrr…
* Divers
* Sensibilisation : participation réunion Boussole du Libre
=== 2/ Actions à venir ===
* CA : courant
* Gdt:adminsys : supervision SI
* Gdt:adminsys : tâches de sprint
* Gdt:chapril : supervision SI
* Gdt:chapril : gestion gdt Chapril
* Gdt:chapril : préparation réunion animateurs (annonce, pad, stats…)
* Gdt:chapril : animation de réunion mensuelle de sprint
* Gdt:chapril : tâches post réunion mensuelle Chapril (tickets, pad…)
* Gdt:chapril : CHATONS, suivi forum
* Gdt:chapril : dev ChatonsInfos
* Gdt:chapril : dév ChaprilInfos
* Gdt:chapril : réunion ChatonsInfos
* Gdt:chapril : point modération Mastodon
* Libreàvous! : écoute de l'émission
* Décryptualité : écoute de l'émission
* Galerie photos : fin traitement photos AGO
================================================================================
-------------------------------- Pppppp (Pppppp) ---------------------------------
=== 1/ Actions passées ou en cours ===
* ca: suivi divres
* tresorerie: suivi divers
* adminsys: suivi divers, maj du cluster + redémarrage, nettoyage de icinga
* siteweb: activation de l'index fulltext pour des mots de 3 lettres
* mails: passage au karsher des domaines en erreur
* adminsys: réunion de sprint fructueuse
* adminsys: maj de matomo et piwik
=== 2/ Actions à venir ===
* rapport d'activité format pdf
================================================================================
3/ Points de blocage / points en retard corrigés cette semaine
================================================================================
* aaaa : Écouter LAV 100 🤣😅
================================================================================
4/ Points de blocage existants / points en retard à traiter
================================================================================
* Pppppp : rapport d'activité version pdf :)
* cccccccccc : mise en vente t-shirt
* cccccccccc : divers comm' et sensi
================================================================================
5/ Points forts de la semaine
================================================================================
* cccc_cccccc : La centième de Libre à vous ! \o/
* cccccccccc : lav ! a fêté 100 émissions \o/
* cccc_cccccc : Réunion adminsys
* aaaa : Je vois le bout du tunnel ovh
* cccccccccc : visite surprise de booky à la fin de la réu sensi
* cccccccccc : veste légère pour sortir :)
* cccc_cccccc : réunion sensibilisation en visio
================================================================================
6/ Points de vigilance de la semaine
================================================================================
* Pppppp : la covid nous prive de notre DG
* aaaa : Trop
* cccc_cccccc : garder le rythme et continuer à faire attention
* cccccccccc : l'avalanche de courriels qu'on peut retrouver dans sa bal en
rentrant de congé :)
================================================================================
7/ Points forts de la réunion
================================================================================
* aaaa : On est là avec Pppppp
* cccc_cccccc : Polux avec nous \O/
* cccccccccc : elle a lieu, en petit comité, mais elle a lieu :)
* cccc_cccccc : continuité assurée
* cccccccccc : plein d'actions
================================================================================
8/ Points de vigilance de la réunion
================================================================================
* cccc_cccccc : Pensée pour les covidés
* cccccccccc : +1
* cccccccccc : abus de postage de notes de la part de l'animatrice
* aaaa : Connexion internet pourrie
Log IRC brut
* Hebdobot : % Début de la réunion hebdomadaire
* Hebdobot : % rappel : toute ligne commençant par % sera considérée comme un
commentaire et non prise en compte dans la synthèse
* Hebdobot : % pour connaître le point courant, taper !courant
* cccccccccc : # 1/ Actions passées ou en cours
* Hebdobot : Sujet individuel : 1/ Actions passées ou en cours
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
* Hebdobot : % quand vous avez fini vous le dites par % fini
* Pppppp : ca: suivi divres
* cccc_cccccc : CA : courant
* cccc_cccccc : Gdt:adminsys : supervision SI
* cccccccccc : dépilage courriels suite au congé
* Pppppp : tresorerie: suivi divers
* cccc_cccccc : Gdt:adminsys : tâches sprint
* cccc_cccccc : Gdt:adminsys : réunion de sprint mensuel adminsys
* cccccccccc : ca@ : suivi divers
* cccc_cccccc : Gdt:adminsys : Mettre à jour Gitea/forge.chapril.org en 1.13.6
(#5290)
* cccc_cccccc : Gdt:chapril : supervision SI
* cccc_cccccc : Gdt:chapril : upgrades
* cccc_cccccc : Gdt:chapril : reboot SI
* cccccccccc : participation à point d'équipe/dossiers
* cccc_cccccc : Gdt:chapril : suivi CHATONS
* Pppppp : adminsys: suivi divers, maj du cluster + redémarrage, nettoyage de
icinga
* cccc_cccccc : Gdt:chapril : jardinage tickets
* cccc_cccccc : Gdt:chapril : réunion CHATONS ChatonsInfos
* cccc_cccccc : Gdt:chapril : dev ChaprilInfos
* cccc_cccccc : Gdt:chapril : dev gestion logs
* cccccccccc : suivi courriels sur secretaire@
* cccc_cccccc : Gdt:chapril : permanence du samedi matin
* cccc_cccccc : Gdt:chapril : Mettre à jour Gitea/forge.chapril.org en 1.13.6
(#5291)
* cccc_cccccc : Gdt:chapril : modération pouet.chapril.org
* cccccccccc : suivi nouvelles adhésions
* cccc_cccccc : Gdt:chapril : réponse demande de stage
* cccc_cccccc : Libreàvous! : écoute de l'émission
* cccccccccc : suivi relances personnes morales en retard de cotisation
* cccc_cccccc : Libreàvous! : participation avec une capsule pour la 100e
* Pppppp : siteweb: activation de l'index fulltext pour des mots de 3 lettres
* cccc_cccccc : Décryptualité : écoute de l'émission
* cccccccccc : relectures diverses
* cccccccccc : réu sensibilisation hebdo : orga, annonces, animation
* cccccccccc : rdv « tâches importantes » : orga, annonces, présence
* cccc_cccccc : Transcription : relecture émission n°94
* cccc_cccccc : Virus : suivi, grrrr…
* cccc_cccccc : Divers
* Pppppp : mails: passage au karsher des domaines en erreur
* cccccccccc : intervention à la 100e de Libre à vous !
* cccc_cccccc : %fnii
* Pppppp : adminsys: réunion de sprint fructueuse
* cccccccccc : divers fournisseurs
* cccccccccc : divers en vente libre
* cccc_cccccc : Sensibilisation : participation réunion Boussole du Libre
* Pppppp : adminsys: maj de matomo et piwik
* cccc_cccccc : % fini
* cccccccccc : divers formulaire de contact
* Pppppp : %fini
* cccccccccc : divers régie lav !
* cccccccccc : test imprimante
* cccccccccc : divers pour rediffusion d'une émission mardi 06/04
* cccccccccc : suivi tâches admins me concernant
* cccccccccc : maj diverses pad d'orga LAV !
* cccc_cccccc : !courant
* Hebdobot : % Sujet individuel en cours : 1/ Actions passées ou en cours
* cccccccccc : ventilation temps par catégories LAV !
* cccccccccc : divers membres en bounce
* cccccccccc : %fini
* cccccccccc : % on va passer à la suite : Actions à venir
* cccccccccc : # 2/ Actions à venir
* Hebdobot : % cccccccccc cccc_cccccc Pppppp, on va passer à la suite : 2/ Actions
à venir
* Hebdobot : Sujet individuel : 2/ Actions à venir
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
* Hebdobot : % quand vous avez fini vous le dites par % fini
* cccccccccc : divers lef 2021 : remerciements, bilan, maj diverses
* cccc_cccccc : CA : courant
* cccc_cccccc : Gdt:adminsys : supervision SI
* cccc_cccccc : Gdt:adminsys : tâches de sprint
* cccc_cccccc : Gdt:chapril : supervision SI
* cccc_cccccc : Gdt:chapril : gestion gdt Chapril
* cccc_cccccc : Gdt:chapril : préparation réunion animateurs (annonce, pad,
stats…)
* cccc_cccccc : Gdt:chapril : animation de réunion mensuelle de sprint
* cccccccccc : divers refonte graphique libre en fête
* cccc_cccccc : Gdt:chapril : tâches post réunion mensuelle Chapril (tickets,
pad…)
* cccc_cccccc : Gdt:chapril : CHATONS, suivi forum
* cccc_cccccc : Gdt:chapril : dev ChatonsInfos
* cccccccccc : divers projets sensi
* cccc_cccccc : Gdt:chapril : dév ChaprilInfos
* Pppppp : rapport d'activité format pdf
* cccccccccc : divers lav !
* cccc_cccccc : Gdt:chapril : réunion ChatonsInfos
* cccccccccc : suite dépilage courriels
* cccc_cccccc : Gdt:chapril : point modération Mastodon
* cccc_cccccc : Libreàvous! : écoute de l'émission
* cccc_cccccc : Décryptualité : écoute de l'émission
* cccccccccc : suivi dossiers administratifs divers
* cccc_cccccc : Galerie photos : fin traitement photos AGO
* cccccccccc : divers en vente libre
* cccccccccc : recherche personnes intervenantes pour sujet longchronique à
venir lav !
* aaaa : !courant
* Hebdobot : % Sujet individuel en cours : 2/ Actions à venir
* cccccccccc : rdv « tâches importantes » : orga, annonces, présence
* aaaa : Participation à reunion chatons
* cccccccccc : revue hebdomadaire : génération de la synthèse
* aaaa : Participation à réunion chapril
* cccccccccc : divers en fonction du temps
* aaaa : Modération et animation chapril xmpp
* aaaa : Mise en place de mon serveur physique \o/
* aaaa : %fini
* cccccccccc : %cccc_cccccc: fini ?
* cccccccccc : %on va passer à la suite : Points de blocage / points en retard
* cccccccccc : ## 3/ Points de blocage / points en retard corrigés cette semaine
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 3/
Points de blocage / points en retard corrigés cette semaine
* Hebdobot : Sujet collectif : 3/ Points de blocage / points en retard corrigés
cette semaine
* Hebdobot : % 1 minute max
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
* Hebdobot : % quand vous avez fini vous le dites par % fini
* aaaa : % cccccccccc : en action passées, modération chapril xmpp ;)
* Pppppp : %ras
* cccc_cccccc : %ras
* cccccccccc : %aaaa : ok
* aaaa : Écouter LAV 100 🤣😅
* cccccccccc : %ras
* aaaa : %fini
* cccccccccc : % ♪ ♫ ♬ ♭
* cccccccccc : %on va passer à la suite : Points de blocage / points en retard
existants à traiter
* cccccccccc : ## 4/ Points de blocage existants / points en retard à traiter
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 4/
Points de blocage existants / points en retard à traiter
* Hebdobot : Sujet collectif : 4/ Points de blocage existants / points en retard
à traiter
* Hebdobot : % 1 minute max
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
* Hebdobot : % quand vous avez fini vous le dites par % fini
* Pppppp : rapport d'activité version pdf :)
* aaaa : %ras
* cccc_cccccc : %nspp
* cccccccccc : %bravo Pppppp :)
* cccccccccc : mise en vente t-shirt
* cccccccccc : divers comm' et sensi
* cccccccccc : %fini
* cccccccccc : % on va passer à la suite : Points Forts et Points de Vigilance de
la semaine
* cccccccccc : ## 5/ Points forts de la semaine
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 5/
Points forts de la semaine
* Hebdobot : Sujet collectif : 5/ Points forts de la semaine
* Hebdobot : % 1 minute max
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
* Hebdobot : % quand vous avez fini vous le dites par % fini
* cccc_cccccc : La centième de Libre à vous ! \o/
* cccccccccc : lav ! a fêté 100 émissions \o/
* cccc_cccccc : Réunion adminsys
* aaaa : Je vois le bout du tunnel ovh
* cccccccccc : visite surprise de booky à la fin de la réu sensi
* cccccccccc : veste légère pour sortir :)
* cccc_cccccc : réunion sensibilisation en visio
* cccccccccc : % on va passer à la suite : Points de Vigilance de la semaine
* cccccccccc : ## 6/ Points de vigilance de la semaine
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 6/
Points de vigilance de la semaine
* Hebdobot : Sujet collectif : 6/ Points de vigilance de la semaine
* Hebdobot : % 1 minute max
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
* Hebdobot : % quand vous avez fini vous le dites par % fini
* Pppppp : la covid nous prive de notre DG
* aaaa : Trop
* cccc_cccccc : garder le rythme et continuer à faire attention
* cccccccccc : l'avalanche de courriels qu'on peut retrouver dans sa bal en
rentrant de congé :)
* cccccccccc : % ♪ ♫ ♬ ♭
* cccccccccc : % on va passer à la suite : Points Forts et Points de Vigilance de
la réunion
* cccccccccc : ## 7/ Points forts de la réunion
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 7/
Points forts de la réunion
* Hebdobot : Sujet collectif : 7/ Points forts de la réunion
* Hebdobot : % 1 minute max
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
* Hebdobot : % quand vous avez fini vous le dites par % fini
* aaaa : On est là avec Pppppp
* cccc_cccccc : Polux avec nous \O/
* cccccccccc : elle a lieu, en petit comité, mais elle a lieu :)
* cccc_cccccc : continuité assurée
* cccccccccc : plein d'actions
* cccccccccc : % on va passer à la suite : Points de Vigilance de la réunion
* cccccccccc : ## 8/ Points de vigilance de la réunion
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 8/
Points de vigilance de la réunion
* Hebdobot : Sujet collectif : 8/ Points de vigilance de la réunion
* Hebdobot : % 1 minute max
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
* Hebdobot : % quand vous avez fini vous le dites par % fini
* cccc_cccccc : Pensée pour les covidés
* cccccccccc : +1
* cccc_cccccc : %fnin
* cccccccccc : %fini
* cccccccccc : % ♪ ♫ ♬ ♭
* cccccccccc : abus de postage de notes de la part de l'animatrice
* cccccccccc : % ♪ ♫ ♬ ♭
* aaaa : Connexion internet pourrie
* cccccccccc : % Fin de la revue hebdomadaire, merci à vous
* cccccccccc : !fin
Statistiques
C'était la 459e revue hebdomadaire de l'April, la 13e de l'année 2021.
Horaire de début de la revue : 12h00
Horaire de fin de la revue : 12h15
Durée de la revue : 16 minutes
Nombre de personnes participantes : 4
Le dernier record de participation est de 14 personnes le vendredi 14 décembre
2012.
Statistiques sur la participation à la revue (4 personnes) : position 11 (min.=2,
moy.=6,6, max.=14), fréquence 42/459 (9 %)
Statistiques sur la durée de la revue (16 min) : position 5 (min.=7 min,
moy.=15,7 min, max.=20 min), fréquence 33/161 (21 %)

View File

@ -1,78 +0,0 @@
/**
* Copyright (C) 2019-2021 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.privatebin;
import java.io.File;
import java.net.URL;
import org.apache.commons.io.FileUtils;
import org.apache.log4j.BasicConfigurator;
import org.junit.Test;
/**
* The Class PrivatebinClientTest.
*/
public class PrivatebinClientTest
{
/**
* Test paste.
*
* @throws Exception
* the exception
*/
@Test
public void testPaste00() throws Exception
{
PrivatebinClient client = new PrivatebinClient(new URL("https://cpaste.org/"));
// PrivatebinClient client = new
// PrivatebinClient("https://paste.chapril.org/");
String text = "This is a test.\ntoto";
client.setExpiration(Expiration.MINUTE_5);
String result = client.paste(text);
System.out.println("result:" + result);
}
/**
* Test paste 01.
*
* @throws Exception
* the exception
*/
@Test
public void testPaste01() throws Exception
{
BasicConfigurator.configure();
PrivatebinClient client = new PrivatebinClient(new URL("https://cpaste.org/"));
// PrivatebinClient client = new
// PrivatebinClient("https://paste.chapril.org/");
// String text = FileUtils.readFileToString(new
// File("./test/org/april/hebdobot/privatebin/20210305-log-irc-revue-hebdomadaire.txt"));
String text = FileUtils.readFileToString(new File("./test/org/april/hebdobot/privatebin/20210402-log-irc-revue-hebdomadaire.txt"));
client.setExpiration(Expiration.MINUTE_5);
String result = client.paste(text);
System.out.println("result:" + result);
}
}