/** * <code>receivedPacket</code> of PacketListener handler, this filters for jabber:iq:auth * extensions, then broadcasts those events on a special RosterListener interface. * * @param p incoming <code>PacketEvent</code> */ public void receivedPacket(PacketEvent p) { if (!(p.getPacket() instanceof InfoQuery)) return; Enumeration e = ((InfoQuery) p.getPacket()).Extensions(); Extension ext; if ((e == null) || (!e.hasMoreElements())) return; ext = (Extension) e.nextElement(); if (!(ext instanceof Roster)) return; // TODO: add code to modify current roster image based on // new data. Replacement is basically shown by if the type is not // 'result' of the IQ Roster rext = (Roster) ext; if (((InfoQuery) p.getPacket()).getType().equals("result")) { // the results of a get will be the results of a full fetch Enumeration enumx = rext.items(); currentRoster.clear(); while (enumx.hasMoreElements()) { RosterItem ri = (RosterItem) enumx.nextElement(); currentRoster.put(ri.getJID(), ri); } fireUserRosterReplaced(rext); } else { Enumeration enumx = rext.items(); while (enumx.hasMoreElements()) { RosterItem ri = (RosterItem) enumx.nextElement(); currentRoster.put(ri.getJID(), ri); } fireUserRosterChanged(rext); } }