}
public void logout(GatewayConnection gc) {
String[] jids = gc.getAllJids();
for (String username: jids) {
addOutPacket(new Packet(new Element(PRESENCE_ELNAME,
new String[] {"from", "to", "type"},
new String[] {getComponentId(), username, "unavailable"})));
List<RosterItem> roster = gc.getRoster();
for (RosterItem item: roster) {
String from = formatJID(item.getBuddyId());
Element pres_el = new Element(PRESENCE_ELNAME,
new String[] {"to", "from", "type"},
new String[] {username, from, "unavailable"});
Packet presence = new Packet(pres_el);
log.finest("Sending out presence: " + presence.toString());
addOutPacket(presence);