+ this.raw("PONG " + msg.msg);
+ }
+ if (msg.cmd.equals("PONG")) {
+ this.pinging = false;
+ }
+ }
+
+ private void dosasl(Message msg)
+ {
+ switch (msg.type) {
+ case CAP:
+ if (msg.msg.equals("sasl") && msg.arg.equals("ACK")) {
+ Os.debug("Client: sasl - starting auth");
+ this.raw("AUTHENTICATE PLAIN");
+ } else {
+ Os.debug("Client: sasl - Server does not support sasl");
+ }
+ break;
+ case AUTH:
+ if (msg.arg.equals("+")) {
+ Os.debug("Client: sasl - performin authentication");
+ this.raw("AUTHENTICATE " + Os.base64(
+ this.authname + "\0" +
+ this.authname + "\0" +
+ this.password));
+ } else {
+ Os.debug("Client: sasl - unexpected authenticate response");
+ }
+ break;
+ case AUTHOK:
+ Os.debug("Client: SASL Auth Successful");
+ this.raw("CAP END");
+ break;
+ case AUTHFAIL:
+ Os.debug("Client: SASL Auth Failed");
+ this.raw("CAP END");
+ break;