package Manager; import Database.DatabaseClient; import Virtual.Comunication; import Server.Utility; import Encoding.vl64; import java.sql.*; public class ModTool { public DatabaseClient DB; public Utility U; public Comunication TH; public ModTool(DatabaseClient db, Utility U, Comunication TH) { this.DB = db; this.U = U; this.TH = TH; } /* LEGGENDA open 0 picked 1 resolved 2 abusive 3 invalid 4 deleted 5 */ public String ticket(int id,int tabid,int score,int type,int sender_id, int reported_id, int moderator_id, String message,int room_id, String room_name) { try{ String ticket = "HR" + vl64.Encode(id) + //ID chiamata vl64.Encode(tabid) + //TabId vl64.Encode(11) + //?? vl64.Encode(type) + //TYPE vl64.Encode(11) + //?? vl64.Encode(score) + //Score vl64.Encode(sender_id) + //ID Inviato Da U.getUserNamefromID(sender_id) + (char)2 + //Inviato Da vl64.Encode(reported_id) + //ID Riportato U.getUserNamefromID(reported_id) + (char)2 + //Riportato vl64.Encode(moderator_id) + //ID Inviato A U.getUserNamefromID(moderator_id) + (char)2 + //Inviato A message + (char)2 + //Messaggio vl64.Encode(room_id) + //Room ID room_name + (char)2; //Room Name; return ticket; }catch (Exception m) { m.printStackTrace(); return ""; } } public void sendmod(String messaggio) { try{ ResultSet queryticket = DB.Query("SELECT id FROM utenti WHERE rank >= '6'"); while(queryticket.next()){ int sendto = queryticket.getInt("id"); if(TH.isOnline(sendto)){ TH.SendPacketID(sendto, messaggio); } } }catch (Exception m) { m.printStackTrace(); } } public void sendtickets(int iduser) { try{ ResultSet pickticket = DB.Query("SELECT * FROM moderation_tickets WHERE status = '0' LIMIT 100"); while(pickticket.next()){ //sendmod(ticket(pickticket.getInt("id"),1,pickticket.getInt("score"),pickticket.getInt("type"),pickticket.getInt("sender_id"),pickticket.getInt("reported_id"), pickticket.getInt("moderator_id"), pickticket.getString("message"),pickticket.getInt("room_id"), pickticket.getString("room_name"))); } ResultSet mypickticket = DB.Query("SELECT * FROM moderation_tickets WHERE status = '1' AND moderator_id = '"+iduser+"' LIMIT 100"); while(mypickticket.next()){ //TH.SendPacketID(iduser, ticket(pickticket.getInt("id"),2,pickticket.getInt("score"),pickticket.getInt("type"),pickticket.getInt("sender_id"),pickticket.getInt("reported_id"), pickticket.getInt("moderator_id"), pickticket.getString("message"),pickticket.getInt("room_id"), pickticket.getString("room_name"))); } }catch (Exception m) { m.printStackTrace(); } } }