Closed TJFJefroy closed 7 years ago
Of course...
// Accept Contatcs public static int accept() throws SkypeException{ Friend[] contatosAceitar = Skype.getContactList().getAllUserWaitingForAuthorization(); int aceites = 0; for(Friend aceitar : contatosAceitar){ aceitar.setAuthorized(true); aceitar.send("We'll come to my handsome program!"); aceites++; } return aceites; }
// Create a sheduler
public static final ScheduledExecutorService tarefas = Executors.newScheduledThreadPool(1);
public static void autoAccept(){
tarefas.scheduleAtFixedRate(new Runnable() {
public void run() {
// call accept()
try {
int aceites = accept();
} catch (SkypeException ex) {
System.out.println("Error while accepting new contacts");
}
}
}, 0, 15, TimeUnit.SECONDS);
System.out.println("AutoAccept registered");
}
}
Just call autoAccept() in your main class :D
I did this but i was just wondering if there is any listener for this or i'm just stupid (again). But still thanks for the answer :D
No there's no listener :/
Is it possible to add this to you can automatically accept a request over this api?