1 import org.jivesoftware.smackx.muc.UserStatusListener; 2 import org.jivesoftware.smack.util.StringUtils; 3 4 5 final class MUCEventListener implements UserStatusListener{ 6 7 private final MUCPanel mp; 8 9 public MUCEventListener(MUCPanel mp){ 10 this.mp=mp; 11 } 12 13 public void adminGranted(){ 14 mp.threadAnnounce(Lang.gs("adminGranted")); 15 } 16 17 public void adminRevoked(){ 18 mp.threadAnnounce(Lang.gs("adminRevoked")); 19 } 20 21 public void banned(String actor, String reason){ 22 doBan(actor,reason); 23 } 24 25 private void doBan(final String actor,final String reason){ 26 javax.swing.SwingUtilities.invokeLater(new Runnable (){ 27 public void run(){ 28 mp.announce(Lang.gs("banned")+"\r\n"+Lang.gs("by")+actor+"\r\n"+Lang.gs("reason")+reason); 29 mp.goneOffline(); 30 } 31 }); 32 } 33 34 public void kicked(String actor, String reason){ 35 doKicked(actor,reason); 36 } 37 38 private void doKicked(final String actor,final String reason){ 39 javax.swing.SwingUtilities.invokeLater(new Runnable (){ 40 public void run(){ 41 mp.threadAnnounce(Lang.gs("kicked")+"\r\n"+Lang.gs("by")+actor+"\r\n"+Lang.gs("reason")+reason); 42 mp.goneOffline(); 43 } 44 }); 45 } 46 47 public void membershipGranted(){ 48 mp.threadAnnounce(Lang.gs("membershipGranted")); 49 } 50 51 public void membershipRevoked(){ 52 mp.threadAnnounce(Lang.gs("membershipRevoked")); 53 } 54 55 public void moderatorGranted(){ 56 mp.threadAnnounce(Lang.gs("moderatorGranted")); 57 } 58 59 public void moderatorRevoked(){ 60 mp.threadAnnounce(Lang.gs("moderatorRevoked")); 61 } 62 63 public void ownershipGranted(){ 64 mp.threadAnnounce(Lang.gs("ownershipGranted")); 65 } 66 67 public void ownershipRevoked(){ 68 mp.threadAnnounce(Lang.gs("ownershipRevoked")); 69 } 70 71 public void voiceGranted(){ 72 mp.threadAnnounce(Lang.gs("voiceGranted")); 73 } 74 75 public void voiceRevoked(){ 76 mp.threadAnnounce(Lang.gs("voiceRevoked")); 77 } 78 79 } | Popular Tags |