use of net.kano.joscar.snaccmd.mailcheck.MailUpdate in project Openfire by igniterealtime.
the class EmailConnection method handleSnacPacket.
@Override
protected void handleSnacPacket(SnacPacketEvent e) {
// Log.debug("OSCAR email snac packet received: "+e);
SnacCommand cmd = e.getSnacCommand();
if (cmd instanceof ServerReadyCmd) {
ServerReadyCmd src = (ServerReadyCmd) cmd;
setSnacFamilies(src.getSnacFamilies());
Collection<SnacFamilyInfo> familyInfos = new ArrayList<SnacFamilyInfo>();
familyInfos.add(ConnCommand.FAMILY_INFO);
familyInfos.add(MailCheckCmd.FAMILY_INFO);
setSnacFamilyInfos(familyInfos);
getMainSession().registerSnacFamilies(this);
request(new ClientVersionsCmd(familyInfos));
request(new RateInfoRequest());
} else if (cmd instanceof MailUpdate) {
MailUpdate mu = (MailUpdate) cmd;
if (JiveGlobals.getBooleanProperty("plugin.gateway." + getMainSession().getTransport().getType() + ".mailnotifications", true) && lastMailCount < mu.getUnreadCount()) {
Integer diff = mu.getUnreadCount() - lastMailCount;
if (diff > 0) {
getMainSession().getTransport().sendMessage(getMainSession().getJID(), getMainSession().getTransport().getJID(), LocaleUtils.getLocalizedString("gateway.oscar.mail", "kraken", Arrays.asList(Integer.toString(diff), mu.getDomain(), mu.getUrl())), Message.Type.headline);
}
}
lastMailCount = mu.getUnreadCount();
} else {
super.handleSnacPacket(e);
}
}
Aggregations