mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-11-01 16:40:26 +00:00
Replace usage of deprecated method with alternative and delete method itself.
Deprecated method: org.jivesoftware.spark.ChatManager.getChatRoom(java.lang.String) Alternative method: org.jivesoftware.spark.ChatManager.getChatRoom(org.jxmpp.jid.EntityBareJid)
This commit is contained in:
parent
28cdae1ea1
commit
8d614399bb
@ -238,30 +238,11 @@ public class ChatManager {
|
||||
* Returns the <code>ChatRoom</code> for the giving jid. If the ChatRoom is not found,
|
||||
* a new ChatRoom will be created.
|
||||
*
|
||||
* @param jid the jid of the user to chat with.
|
||||
* @return the ChatRoom.
|
||||
* @deprecated use {@link #getChatRoom(BareJid)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public ChatRoom getChatRoom(String jid) {
|
||||
BareJid mucAddress;
|
||||
try {
|
||||
mucAddress = JidCreate.bareFrom(jid);
|
||||
} catch (XmppStringprepException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
return getChatRoom(mucAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>ChatRoom</code> for the giving jid. If the ChatRoom is not found,
|
||||
* a new ChatRoom will be created.
|
||||
*
|
||||
* @param jid the jid of the user to chat with.
|
||||
* @param bareJid the jid of the user to chat with.
|
||||
* @param bareJid
|
||||
* @return the ChatRoom.
|
||||
*/
|
||||
public ChatRoom getChatRoom(BareJid bareJid) {
|
||||
// TODO: Change signature of method to use EntityBareJid.
|
||||
public ChatRoom getChatRoom(EntityBareJid bareJid) {
|
||||
EntityBareJid jid = bareJid.asEntityBareJidOrThrow();
|
||||
ChatRoom chatRoom;
|
||||
try {
|
||||
|
||||
@ -126,7 +126,7 @@ public class AnswerFormDialog {
|
||||
*/
|
||||
private void sendAnswerForm(Form answer, MultiUserChat chat) {
|
||||
|
||||
ChatRoom room = SparkManager.getChatManager().getChatRoom(chat.getRoom().toString());
|
||||
ChatRoom room = SparkManager.getChatManager().getChatRoom(chat.getRoom());
|
||||
|
||||
for (String key : _map.keySet()) {
|
||||
String value = getValueFromComponent(key);
|
||||
|
||||
@ -43,6 +43,7 @@ import org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster;
|
||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
import org.jxmpp.jid.BareJid;
|
||||
import org.jxmpp.jid.EntityBareJid;
|
||||
import org.jxmpp.jid.Jid;
|
||||
import org.jxmpp.util.XmppStringUtils;
|
||||
|
||||
@ -172,13 +173,13 @@ if (localPref.getShowToasterPopup()) {
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
SparkManager.getChatManager().getChatRoom( jid );
|
||||
SparkManager.getChatManager().getChatRoom( jid.asEntityBareJidOrThrow() );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
||||
ChatRoom room = SparkManager.getChatManager().getChatRoom(jid);
|
||||
ChatRoom room = SparkManager.getChatManager().getChatRoom(jid.asEntityBareJidOrThrow());
|
||||
|
||||
if (localPref.getWindowTakesFocus())
|
||||
{
|
||||
|
||||
@ -19,6 +19,8 @@ import com.google.code.jgntp.*;
|
||||
import org.jivesoftware.spark.SparkManager;
|
||||
import org.jivesoftware.spark.ui.ChatRoom;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
import org.jxmpp.jid.EntityBareJid;
|
||||
import org.jxmpp.jid.impl.JidCreate;
|
||||
import org.jxmpp.util.XmppStringUtils;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
@ -120,8 +122,8 @@ public class GrowlTalker implements GntpListener
|
||||
public void onClickCallback( GntpNotification notification )
|
||||
{
|
||||
Log.debug( "Callback clicked: " + notification );
|
||||
final String jid = XmppStringUtils.parseBareJid( (String) notification.getContext() );
|
||||
final ChatRoom room = SparkManager.getChatManager().getChatRoom( jid );
|
||||
final EntityBareJid jid = JidCreate.entityBareFromOrThrowUnchecked( (String) notification.getContext() );
|
||||
final ChatRoom room = SparkManager.getChatManager().getChatRoom(jid);
|
||||
SparkManager.getChatManager().getChatContainer().activateChatRoom( room );
|
||||
SparkManager.getChatManager().getChatContainer().requestFocusInWindow();
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ public class ReversiPlugin implements Plugin {
|
||||
// Got an offer to start a new game. So, make sure that a chat is
|
||||
// started with the other
|
||||
// user and show an invite panel.
|
||||
final ChatRoom room = SparkManager.getChatManager().getChatRoom( invitation.getFrom().asBareJid() );
|
||||
final ChatRoom room = SparkManager.getChatManager().getChatRoom( invitation.getFrom().asEntityBareJidOrThrow() );
|
||||
|
||||
inviteAlert = new JPanel();
|
||||
inviteAlert.setLayout(new BorderLayout());
|
||||
|
||||
@ -230,7 +230,7 @@ public class TicTacToePlugin implements Plugin {
|
||||
invitation.setTo(invitation.getFrom());
|
||||
|
||||
|
||||
final ChatRoom room = SparkManager.getChatManager().getChatRoom( invitation.getFrom().asBareJid());
|
||||
final ChatRoom room = SparkManager.getChatManager().getChatRoom( invitation.getFrom().asEntityBareJidOrThrow());
|
||||
|
||||
Localpart name = invitation.getFrom().getLocalpartOrThrow();
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@ public class GamePanel extends JPanel {
|
||||
message.addExtension(inval);
|
||||
_connection.sendStanza(message);
|
||||
|
||||
ChatRoom cr = SparkManager.getChatManager().getChatRoom( _opponent.asBareJid());
|
||||
ChatRoom cr = SparkManager.getChatManager().getChatRoom( _opponent.asEntityBareJid());
|
||||
cr.getTranscriptWindow().insertCustomText(_opponent+"seems to be cheating\n"+
|
||||
"He tried placing a wrong Move", true, false, Color.red);
|
||||
|
||||
@ -129,7 +129,7 @@ public class GamePanel extends JPanel {
|
||||
public void processStanza(Stanza stanza) {
|
||||
|
||||
//InvalidMove im = (InvalidMove)packet.getExtension(InvalidMove.ELEMENT_NAME, InvalidMove.NAMESPACE);
|
||||
ChatRoom cr = SparkManager.getChatManager().getChatRoom(_opponent.asBareJid());
|
||||
ChatRoom cr = SparkManager.getChatManager().getChatRoom(_opponent.asEntityBareJid());
|
||||
cr.getTranscriptWindow().insertCustomText("You seem to be Cheating\n"+
|
||||
"You placed a wrong Move", true, false, Color.red);
|
||||
ShakeWindow sw = new ShakeWindow(_frame);
|
||||
|
||||
@ -70,7 +70,7 @@ public class TranslatorPlugin implements Plugin {
|
||||
if (type != null && type != TranslatorUtil.TranslationType.None) {
|
||||
message.setBody(null);
|
||||
currentBody = TranslatorUtil.translate(currentBody, type);
|
||||
TranscriptWindow transcriptWindow = chatManager.getChatRoom( message.getTo().asBareJid() ).getTranscriptWindow();
|
||||
TranscriptWindow transcriptWindow = chatManager.getChatRoom( message.getTo().asEntityBareJidOrThrow() ).getTranscriptWindow();
|
||||
if(oldBody.equals(currentBody.substring(0,currentBody.length()-1)))
|
||||
{
|
||||
transcriptWindow.insertNotificationMessage("Could not translate: "+currentBody, ChatManager.ERROR_COLOR);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user