Skip to content

Commit

Permalink
Fixato il plugin del forum.
Browse files Browse the repository at this point in the history
Ora non dovrebbe più spammare le notifiche.
  • Loading branch information
gianluca-nitti committed Aug 19, 2016
1 parent 4293566 commit 6aa1fe6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/com/neroreflex/plugins/PTforum.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Pizza IRC Bot (for pierotofy.it community)
* Copyright (C) 2016 Benato Denis, Gianluca Nitti, Gianluca Nitti
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Expand Down Expand Up @@ -38,6 +38,8 @@ public final class PTforum extends Trancio {
protected final void onPoll(){
try {
String[] channels = this.getChannels();
//for (String chan : channels)
// sendMessage(new Message(chan, "Controllo se ci sono nuovi messaggi..."));
InputStream is = new URL(apiEndpoint).openStream();
JsonArray topicList = Json.createReader(is).readArray();
boolean firstFetch = (topics.size() == 0);
Expand All @@ -58,6 +60,8 @@ protected final void onPoll(){
sendMessage(new Message(chan, "Ci sono nuovi messaggi nel topic \"" + obj.getString("subject") + "\": http://pierotofy.it" + obj.getString("url")));
}
}
//Aggiorna il numero di risposte
topics.put(obj.getString("url"), obj.getInt("replies"));
}
ArrayList<String> topicsToRemove = new ArrayList<>();
// Pulisce la hashmap dai vecchi topic (che non sono più nella risposta dell'api)
Expand All @@ -83,4 +87,4 @@ protected final void onPoll(){
e.printStackTrace();
}
}
}
}

0 comments on commit 6aa1fe6

Please sign in to comment.