我尝试通过花名册设置在线模式,但无法生效。我运行了这段代码并检查了我的本地主机服务器,模式仍然是“可用”,而不是“请勿打扰”。
final Connection connection = new XMPPConnection("xxx.xxx.x.xx");
connection.connect();
connection.login("hieugioi@hieund", "123456");
final Roster roster = connection.getRoster();
Presence p = roster.getPresence("hieugioi@hieund");
p.setPriority(128);
p.setMode(Mode.dnd);