Java Code Examples for org.jxmpp.jid.impl.JidCreate#entityBareFromUnescapedOrThrowUnchecked()

The following examples show how to use org.jxmpp.jid.impl.JidCreate#entityBareFromUnescapedOrThrowUnchecked() . 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: ConferenceRoomBrowser.java    From Spark with Apache License 2.0 6 votes vote down vote up
private void enterRoom() {
int selectedRow = roomsTable.getSelectedRow();
UIManager.put("OptionPane.okButtonText", Res.getString("ok"));
if (-1 == selectedRow) {
    JOptionPane.showMessageDialog(dlg,
	    Res.getString("message.select.room.to.enter"),
	    Res.getString("title.group.chat"),
	    JOptionPane.INFORMATION_MESSAGE);
    return;
}
final String roomJIDString = roomsTable.getValueAt(selectedRow, 2) + "@"
	+ serviceName;
   EntityBareJid roomJID = JidCreate.entityBareFromUnescapedOrThrowUnchecked(roomJIDString);
final String roomDescription = (String) roomsTable.getValueAt(
	selectedRow, 1);

try {
    chatManager.getChatContainer().getChatRoom(roomJID);
} catch (ChatRoomNotFoundException e1) {
    ConferenceUtils.joinConferenceOnSeperateThread(roomDescription,
	    roomJID, null);
}
   }
 
Example 2
Source File: FormText.java    From Spark with Apache License 2.0 6 votes vote down vote up
public static String getTextSetting(String key, String workgroupString) {
    EntityBareJid workgroup = JidCreate.entityBareFromUnescapedOrThrowUnchecked(workgroupString);
    WorkgroupManager settingsManager = WorkgroupManager.getInstance();
    ChatSetting chatSettings = settingsManager.getChatSetting(key, workgroup);

    Date now = new Date();
    String date = DATE_FORMATTER.format(now);
    String time = TIME_FORMATTER.format(now);

    if (chatSettings == null) {
        return "";
    }

    String value = chatSettings.getValue();
    value = FormUtils.replace(value, "${time}", time);
    value = FormUtils.replace(value, "${date}", date);
    return value;
}
 
Example 3
Source File: ConversationHistoryPlugin.java    From Spark with Apache License 2.0 5 votes vote down vote up
/**
 * Loads the previous history.
 */
private void loadPreviousHistory() {
    if (!conFile.exists()) {
        return;
    }

    // Otherwise load it.
    try {
        final MXParser parser = new MXParser();
        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
        BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(conFile), "UTF-8"));
        parser.setInput(in);
        boolean done = false;
        while (!done) {
            int eventType = parser.next();
            if (eventType == XmlPullParser.START_TAG && "user".equals(parser.getName())) {
                EntityBareJid jid = JidCreate.entityBareFromUnescapedOrThrowUnchecked(parser.nextText());
                historyList.add(jid);
            }
            else if (eventType == XmlPullParser.END_TAG && "conversations".equals(parser.getName())) {
                done = true;
            }
        }
        in.close();
    }
    catch (Exception e) {
        Log.error(e);
    }
}
 
Example 4
Source File: RequestUtils.java    From Spark with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the Unique Identifier of the user.
 *
 * @return the unique id of the user or {@code null}.
 */
public EntityBareJid getUserID() {
    if (getMetadata() == null) {
        return null;
    }

    final String userID = getFirstValue("userID");//NOTRANS
    return JidCreate.entityBareFromUnescapedOrThrowUnchecked(userID);
}