org.jivesoftware.smackx.muc.InvitationListener Java Examples

The following examples show how to use org.jivesoftware.smackx.muc.InvitationListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MucChatService.java    From xyTalk-pc with GNU Affero General Public License v3.0 5 votes vote down vote up
public static void mucInvitation() {
	MultiUserChatManager.getInstanceFor(Launcher.connection).addInvitationListener(new InvitationListener() {
		@Override
		public void invitationReceived(XMPPConnection conn, MultiUserChat room, EntityJid inviter, String reason,
				String password, Message message, Invite invitation) {
			String barejid = message.getFrom().toString();
			DebugUtil.debug("被邀请加入群聊:" + barejid + reason);
			try {

				room.join(Resourcepart.from(UserCache.CurrentUserName + "-" + UserCache.CurrentUserRealName));

				if (barejid != null) {
					if (Launcher.currRoomId.equals(barejid)) {
						// 当前聊天者即为已有群
						// updateChatPanel(message);
					} else {
						if (Launcher.roomService.exist(barejid)) {
							// 联系人列表中存在群组,更新未读信息,则修改
							// updateRoom(message);
						} else {
							// 联系人中不存在群组,则新建一个群
							createNewRoom(message);
						}
						// dbMessagePersistence(message);
					}
				}

			} catch (NotAMucServiceException | NoResponseException | XMPPErrorException | NotConnectedException
					| XmppStringprepException | InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

		}

	});
}