use of org.jivesoftware.smackx.muc.RoomInfo in project xabber-android by redsolution.
the class MUCManager method requestRoomInfo.
public static void requestRoomInfo(final String account, final String roomJid, final RoomInfoListener listener) {
final XMPPConnection xmppConnection = AccountManager.getInstance().getAccount(account).getConnectionThread().getXMPPConnection();
final Thread thread = new Thread("Get room " + roomJid + " info for account " + account) {
@Override
public void run() {
RoomInfo roomInfo = null;
try {
LogManager.i(MUCManager.class, "Requesting room info " + roomJid);
roomInfo = MultiUserChatManager.getInstanceFor(xmppConnection).getRoomInfo(roomJid);
} catch (SmackException.NoResponseException | XMPPException.XMPPErrorException | SmackException.NotConnectedException e) {
e.printStackTrace();
}
final RoomInfo finalRoomInfo = roomInfo;
Application.getInstance().runOnUiThread(new Runnable() {
@Override
public void run() {
listener.onRoomInfoReceived(finalRoomInfo);
}
});
}
};
thread.start();
}
use of org.jivesoftware.smackx.muc.RoomInfo in project xabber-android by redsolution.
the class MUCManager method requestRoomInfo.
public static void requestRoomInfo(final AccountJid account, final EntityBareJid roomJid, final RoomInfoListener listener) {
AccountItem accountItem = AccountManager.getInstance().getAccount(account);
if (accountItem == null) {
listener.onRoomInfoReceived(null);
return;
}
final XMPPConnection xmppConnection = accountItem.getConnection();
if (!xmppConnection.isAuthenticated()) {
listener.onRoomInfoReceived(null);
return;
}
Application.getInstance().runInBackgroundUserRequest(new Runnable() {
@Override
public void run() {
RoomInfo roomInfo = null;
try {
LogManager.i(MUCManager.class, "Requesting room info " + roomJid);
roomInfo = MultiUserChatManager.getInstanceFor(xmppConnection).getRoomInfo(roomJid);
} catch (SmackException.NoResponseException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | InterruptedException e) {
LogManager.exception(this, e);
}
final RoomInfo finalRoomInfo = roomInfo;
Application.getInstance().runOnUiThread(new Runnable() {
@Override
public void run() {
listener.onRoomInfoReceived(finalRoomInfo);
}
});
}
});
}
Aggregations