aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'juick-xmpp/src/main/java/com')
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java b/juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java
index bab65141..3242803a 100644
--- a/juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java
+++ b/juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java
@@ -81,7 +81,7 @@ public class JuickBot implements StanzaListener, AutoCloseable {
public boolean incomingPresence(Presence p) {
final String username = p.getTo().getLocal();
- final boolean toJuick = username.equals("juick");
+ final boolean toJuick = username.equals(xmpp.getJid().getLocal());
if (p.getType() == null) {
Presence reply = new Presence();
@@ -98,7 +98,7 @@ public class JuickBot implements StanzaListener, AutoCloseable {
if (toJuick || uid_to > 0) {
Presence reply = new Presence();
- reply.setFrom(p.getTo().withResource("Juick"));
+ reply.setFrom(p.getTo().withResource(xmpp.getJid().getResource()));
reply.setTo(p.getFrom());
reply.setPriority((byte)10);
xmpp.sendOut(ClientPresence.from(reply));
@@ -132,7 +132,7 @@ public class JuickBot implements StanzaListener, AutoCloseable {
reply.setType(Presence.Type.SUBSCRIBED);
xmpp.sendOut(ClientPresence.from(reply));
- reply.setFrom(reply.getFrom().withResource("Juick"));
+ reply.setFrom(reply.getFrom().withResource(xmpp.getJid().getResource()));
reply.setPriority((byte) 10);
reply.setType(null);
xmpp.sendOut(ClientPresence.from(reply));
@@ -188,7 +188,7 @@ public class JuickBot implements StanzaListener, AutoCloseable {
if (xmpp.messagesService.isReadonly()) {
reply.setBody("Регистрация временно недоступна\n\nRegistration temporarily unavailable");
} else {
- if (username.equals("juick")) {
+ if (username.equals(xmpp.getJid().getLocal())) {
reply.setBody("Для того, чтобы начать пользоваться сервисом, пожалуйста пройдите быструю регистрацию: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nЕсли у вас уже есть учетная запись на Juick, вы сможете присоединить этот JabberID к ней.\n\nTo start using Juick, please sign up: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nIf you already have an account on Juick, you will be proposed to attach this JabberID to your existing account.");
} else {
reply.setBody("Внимание, системное сообщение!\nВаш JabberID не обнаружен в списке доверенных. Для того, чтобы отправить сообщение пользователю " + username + "@juick.com, пожалуйста зарегистрируйте свой JabberID в системе: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nЕсли у вас уже есть учетная запись на Juick, вы сможете присоединить этот JabberID к ней.\n\nWarning, system message!\nYour JabberID is not found in our server's white list. To send a message to " + username + "@juick.com, please sign up: http://juick.com/signup?type=xmpp&hash=" + signuphash + "\nIf you already have an account on Juick, you will be proposed to attach this JabberID to your existing account.");
@@ -198,7 +198,7 @@ public class JuickBot implements StanzaListener, AutoCloseable {
return true;
}
- if (username.equals("juick")) {
+ if (username.equals(xmpp.getJid().getLocal())) {
return incomingMessageJuick(user_from, msg);
}
@@ -222,7 +222,7 @@ public class JuickBot implements StanzaListener, AutoCloseable {
if (success) {
Message m = new Message();
- m.setFrom(Jid.of("juick@juick.com"));
+ m.setFrom(xmpp.getJid().asBareJid());
m.setTo(Jid.of(Integer.toString(uid_to), "push.juick.com", null));
com.juick.Message jmsg = new com.juick.Message();
jmsg.setUser(user_from);
@@ -245,7 +245,7 @@ public class JuickBot implements StanzaListener, AutoCloseable {
mm.setFrom(Jid.of(jmsg.getUser().getName(), "juick.com", "Juick"));
mm.setBody(msg.getBody());
} else {
- mm.setFrom(Jid.of("juick", "juick.com", "Juick"));
+ mm.setFrom(xmpp.getJid());
mm.setBody("Private message from @" + jmsg.getUser().getName() + ":\n" + msg.getBody());
}
xmpp.sendOut(ClientMessage.from(mm));
@@ -354,7 +354,7 @@ public class JuickBot implements StanzaListener, AutoCloseable {
if (ret == 200) {
Message msg = new Message();
- msg.setFrom(Jid.of("juick", "juick.com", null));
+ msg.setFrom(xmpp.getJid().asBareJid());
msg.setTo(Jid.of(Integer.toString(uid_to), "push.juick.com", null));
com.juick.Message jmsg = new com.juick.Message();
jmsg.setUser(user_from);
@@ -374,7 +374,7 @@ public class JuickBot implements StanzaListener, AutoCloseable {
mm.setFrom(Jid.of(user_from.getName(), "juick.com", "Juick"));
mm.setBody(body);
} else {
- mm.setFrom(Jid.of("juick", "juick.com", "Juick"));
+ mm.setFrom(xmpp.getJid());
mm.setBody("Private message from @" + user_from.getName() + ":\n" + body);
}
xmpp.sendOut(ClientMessage.from(mm));