[kune-commits] r1655 - in trunk/src/main/java/cc/kune: core/client/auth core/client/events core/client/state core/client/ui core/server core/server/notifier core/server/tool wave/server
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Fri Jan 6 21:54:30 CET 2012
Author: vjrj_
Date: 2012-01-06 21:54:28 +0100 (Fri, 06 Jan 2012)
New Revision: 1655
Modified:
trunk/src/main/java/cc/kune/core/client/auth/WaveClientSimpleAuthenticator.java
trunk/src/main/java/cc/kune/core/client/events/InboxUnreadUpdatedEvent.java
trunk/src/main/java/cc/kune/core/client/state/SessionDefault.java
trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java
trunk/src/main/java/cc/kune/core/client/state/UserSignOutEvent.java
trunk/src/main/java/cc/kune/core/client/ui/ContentPosition.java
trunk/src/main/java/cc/kune/core/server/InitData.java
trunk/src/main/java/cc/kune/core/server/notifier/NotifySender.java
trunk/src/main/java/cc/kune/core/server/notifier/NotifySenderDefault.java
trunk/src/main/java/cc/kune/core/server/notifier/NotifyService.java
trunk/src/main/java/cc/kune/core/server/tool/ServerToolRegistry.java
trunk/src/main/java/cc/kune/wave/server/WaveEmailNotifier.java
Log:
Dep refactorization
Modified: trunk/src/main/java/cc/kune/core/client/auth/WaveClientSimpleAuthenticator.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/WaveClientSimpleAuthenticator.java 2012-01-03 01:47:18 UTC (rev 1654)
+++ trunk/src/main/java/cc/kune/core/client/auth/WaveClientSimpleAuthenticator.java 2012-01-06 20:54:28 UTC (rev 1655)
@@ -19,10 +19,10 @@
*/
package cc.kune.core.client.auth;
-import cc.kune.common.client.log.Log;
-import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.core.client.events.StackErrorEvent;
import cc.kune.gspace.client.GSpaceArmor;
+import com.google.gwt.event.shared.EventBus;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
@@ -35,65 +35,68 @@
public class WaveClientSimpleAuthenticator {
- private final GSpaceArmor wsArmor;
+ private final EventBus eventBus;
+ private final GSpaceArmor wsArmor;
- @Inject
- public WaveClientSimpleAuthenticator(final GSpaceArmor wsArmor) {
- this.wsArmor = wsArmor;
- }
+ @Inject
+ public WaveClientSimpleAuthenticator(final GSpaceArmor wsArmor, final EventBus eventBus) {
+ this.wsArmor = wsArmor;
+ this.eventBus = eventBus;
+ }
- public void doLogin(final String userWithoutDomain, final String passwd, final AsyncCallback<Void> callback) {
- final RequestBuilder request = new RequestBuilder(RequestBuilder.POST, "/auth/signin");
- final StringBuffer params = new StringBuffer();
- params.append("address=");
- params.append(URL.encodeQueryString(userWithoutDomain));
- params.append("&password=");
- params.append(URL.encodeQueryString(passwd));
- params.append("&signIn=");
- params.append(URL.encodeQueryString("Sign in"));
- try {
- request.setHeader("Content-Type", "application/x-www-form-urlencoded");
- request.sendRequest(params.toString(), new RequestCallback() {
- @Override
- public void onError(final Request request, final Throwable exception) {
- NotifyUser.error(exception.getStackTrace().toString(), true);
- callback.onFailure(exception);
- }
+ public void doLogin(final String userWithoutDomain, final String passwd,
+ final AsyncCallback<Void> callback) {
+ final RequestBuilder request = new RequestBuilder(RequestBuilder.POST, "/auth/signin");
+ final StringBuffer params = new StringBuffer();
+ params.append("address=");
+ params.append(URL.encodeQueryString(userWithoutDomain));
+ params.append("&password=");
+ params.append(URL.encodeQueryString(passwd));
+ params.append("&signIn=");
+ params.append(URL.encodeQueryString("Sign in"));
+ try {
+ request.setHeader("Content-Type", "application/x-www-form-urlencoded");
+ request.sendRequest(params.toString(), new RequestCallback() {
+ @Override
+ public void onError(final Request request, final Throwable exception) {
+ StackErrorEvent.fire(eventBus, exception);
+ callback.onFailure(exception);
+ }
- @Override
- public void onResponseReceived(final Request request, final Response response) {
- callback.onSuccess(null);
- }
- });
- } catch (final RequestException e) {
- Log.error(e.getStackTrace().toString());
+ @Override
+ public void onResponseReceived(final Request request, final Response response) {
+ callback.onSuccess(null);
}
+ });
+ } catch (final RequestException e) {
+ StackErrorEvent.fire(eventBus, e);
}
+ }
- public void doLogout(final AsyncCallback<Void> callback) {
- // Original: <a href=\"/auth/signout?r=/\">"
- final RequestBuilder request = new RequestBuilder(RequestBuilder.GET, "/auth/signout");
- try {
- request.setHeader("Content-Type", "application/x-www-form-urlencoded");
- final StringBuffer params = new StringBuffer();
- request.sendRequest(params.toString(), new RequestCallback() {
- @Override
- public void onError(final Request request, final Throwable exception) {
- NotifyUser.error(exception.getStackTrace().toString(), true);
- callback.onFailure(exception);
- }
+ public void doLogout(final AsyncCallback<Void> callback) {
+ // Original: <a href=\"/auth/signout?r=/\">"
+ final RequestBuilder request = new RequestBuilder(RequestBuilder.GET, "/auth/signout");
+ try {
+ request.setHeader("Content-Type", "application/x-www-form-urlencoded");
+ final StringBuffer params = new StringBuffer();
+ request.sendRequest(params.toString(), new RequestCallback() {
+ @Override
+ public void onError(final Request request, final Throwable exception) {
+ StackErrorEvent.fire(eventBus, exception);
+ callback.onFailure(exception);
+ }
- @Override
- public void onResponseReceived(final Request request, final Response response) {
- callback.onSuccess(null);
- }
- });
- } catch (final RequestException e) {
- Log.error(e.getStackTrace().toString());
+ @Override
+ public void onResponseReceived(final Request request, final Response response) {
+ callback.onSuccess(null);
}
+ });
+ } catch (final RequestException e) {
+ StackErrorEvent.fire(eventBus, e);
}
+ }
- public String getCookieTokenValue() {
- return Cookies.getCookie("JSESSIONID");
- }
+ public String getCookieTokenValue() {
+ return Cookies.getCookie("JSESSIONID");
+ }
}
Modified: trunk/src/main/java/cc/kune/core/client/events/InboxUnreadUpdatedEvent.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/events/InboxUnreadUpdatedEvent.java 2012-01-03 01:47:18 UTC (rev 1654)
+++ trunk/src/main/java/cc/kune/core/client/events/InboxUnreadUpdatedEvent.java 2012-01-06 20:54:28 UTC (rev 1655)
@@ -94,8 +94,8 @@
@Override
public int hashCode() {
int hashCode = 23;
- hashCode = (hashCode * 37) + new Integer(count).hashCode();
- hashCode = (hashCode * 37) + new Boolean(greater).hashCode();
+ hashCode = (hashCode * 37) + Integer.valueOf(count).hashCode();
+ hashCode = (hashCode * 37) + Boolean.valueOf(greater).hashCode();
return hashCode;
}
Modified: trunk/src/main/java/cc/kune/core/client/state/SessionDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/SessionDefault.java 2012-01-03 01:47:18 UTC (rev 1654)
+++ trunk/src/main/java/cc/kune/core/client/state/SessionDefault.java 2012-01-06 20:54:28 UTC (rev 1655)
@@ -104,7 +104,7 @@
if (countriesArray == null) {
countriesArray = mapCountries();
}
- return countriesArray;
+ return countriesArray.clone();
}
@Override
@@ -192,7 +192,7 @@
if (languagesArray == null) {
languagesArray = mapLangs();
}
- return languagesArray;
+ return languagesArray.clone();
}
@Override
@@ -216,7 +216,7 @@
if (timezonesArray == null) {
mapTimezones();
}
- return timezonesArray;
+ return timezonesArray.clone();
}
@Override
Modified: trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java 2012-01-03 01:47:18 UTC (rev 1654)
+++ trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java 2012-01-06 20:54:28 UTC (rev 1655)
@@ -267,7 +267,7 @@
// Log.debug("Is not a special hash");
// token is not one of #newgroup #signin #translate ...
final String nToken = newHistoryToken != null ? newHistoryToken.toLowerCase() : null;
- if (tokenMatcher.hasRedirect(nToken)) {
+ if (nToken != null && tokenMatcher.hasRedirect(nToken)) {
final Pair<String, String> redirect = tokenMatcher.getRedirect(nToken);
final String firstToken = redirect.getLeft();
final String sndToken = redirect.getRight();
Modified: trunk/src/main/java/cc/kune/core/client/state/UserSignOutEvent.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/UserSignOutEvent.java 2012-01-03 01:47:18 UTC (rev 1654)
+++ trunk/src/main/java/cc/kune/core/client/state/UserSignOutEvent.java 2012-01-06 20:54:28 UTC (rev 1655)
@@ -25,7 +25,7 @@
import com.google.gwt.event.shared.HasHandlers;
import com.gwtplatform.mvp.client.HasEventBus;
-public class UserSignOutEvent extends GwtEvent<UserSignOutEvent.UserSignOutHandler> {
+public class UserSignOutEvent extends GwtEvent<UserSignOutEvent.UserSignOutHandler> {
public interface HasUserSignOutHandlers extends HasHandlers {
HandlerRegistration addUserSignOutHandler(UserSignOutHandler handler);
@@ -37,7 +37,7 @@
private static final Type<UserSignOutHandler> TYPE = new Type<UserSignOutHandler>();
- public static void fire(HasEventBus source) {
+ public static void fire(final HasEventBus source) {
source.fireEvent(new UserSignOutEvent());
}
@@ -45,31 +45,28 @@
return TYPE;
}
-
public UserSignOutEvent() {
}
@Override
- public Type<UserSignOutHandler> getAssociatedType() {
- return TYPE;
- }
-
- @Override
- protected void dispatch(UserSignOutHandler handler) {
+ protected void dispatch(final UserSignOutHandler handler) {
handler.onUserSignOut(this);
}
@Override
- public boolean equals(Object other) {
+ public boolean equals(final Object other) {
if (other != null && other.getClass().equals(this.getClass())) {
- UserSignOutEvent o = (UserSignOutEvent) other;
- return true
- ;
+ return true;
}
return false;
}
@Override
+ public Type<UserSignOutHandler> getAssociatedType() {
+ return TYPE;
+ }
+
+ @Override
public int hashCode() {
int hashCode = 23;
hashCode = (hashCode * 37) + getClass().hashCode();
@@ -78,8 +75,7 @@
@Override
public String toString() {
- return "UserSignOutEvent["
- + "]";
+ return "UserSignOutEvent[" + "]";
}
}
Modified: trunk/src/main/java/cc/kune/core/client/ui/ContentPosition.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/ui/ContentPosition.java 2012-01-03 01:47:18 UTC (rev 1654)
+++ trunk/src/main/java/cc/kune/core/client/ui/ContentPosition.java 2012-01-06 20:54:28 UTC (rev 1655)
@@ -35,7 +35,7 @@
public static final String RIGHT = "right";
private static I18nTranslationService i18n;
private static Object[][] positionObjs;
- public static final String[][] POSITIONS = { new String[] { LEFT }, new String[] { CENTER }, new String[] { RIGHT } };
+ protected static final String[][] POSITIONS = { new String[] { LEFT }, new String[] { CENTER }, new String[] { RIGHT } };
public synchronized static Object[][] getPositions() {
if (positionObjs == null) {
Modified: trunk/src/main/java/cc/kune/core/server/InitData.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/InitData.java 2012-01-03 01:47:18 UTC (rev 1654)
+++ trunk/src/main/java/cc/kune/core/server/InitData.java 2012-01-06 20:54:28 UTC (rev 1655)
@@ -58,7 +58,6 @@
private String oggEmbedObject;
private ReservedWordsRegistryDTO reservedWords;
private String siteCommonName;
- private String siteDomain;
private String siteLogoUrl;
private String siteLogoUrlOnOver;
private String siteShortName;
Modified: trunk/src/main/java/cc/kune/core/server/notifier/NotifySender.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/notifier/NotifySender.java 2012-01-03 01:47:18 UTC (rev 1654)
+++ trunk/src/main/java/cc/kune/core/server/notifier/NotifySender.java 2012-01-06 20:54:28 UTC (rev 1655)
@@ -1,6 +1,7 @@
package cc.kune.core.server.notifier;
import cc.kune.core.server.mail.FormatedString;
+import cc.kune.domain.User;
/**
* The Interface NotifySender.
@@ -21,10 +22,10 @@
* @param isHtml
* if the body is html
* @param recipients
- * the recipients shortnames (without domain)
+ * the recipients
*/
void send(NotifyType notifyType, FormatedString subject, FormatedString body, boolean isHtml,
- String... recipients);
+ User... recipients);
/**
* Send a message to the recipients (also translate the subject/body using the
@@ -38,8 +39,8 @@
* the body of the message (no translated) but with some %s
* {@link String.format} args
* @param recipients
- * the recipients shortnames (without domain)
+ * the recipients
*/
- void send(NotifyType notifyType, FormatedString subject, FormatedString body, String... recipients);
+ void send(NotifyType notifyType, FormatedString subject, FormatedString body, User... recipients);
}
Modified: trunk/src/main/java/cc/kune/core/server/notifier/NotifySenderDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/notifier/NotifySenderDefault.java 2012-01-03 01:47:18 UTC (rev 1654)
+++ trunk/src/main/java/cc/kune/core/server/notifier/NotifySenderDefault.java 2012-01-06 20:54:28 UTC (rev 1655)
@@ -3,8 +3,6 @@
import java.io.File;
import java.io.IOException;
-import javax.persistence.NoResultException;
-
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -13,7 +11,6 @@
import cc.kune.core.server.mail.FormatedString;
import cc.kune.core.server.mail.MailService;
import cc.kune.core.server.manager.I18nTranslationManager;
-import cc.kune.core.server.manager.UserManager;
import cc.kune.core.server.properties.KuneProperties;
import cc.kune.core.server.xmpp.XmppManager;
import cc.kune.core.shared.domain.dto.EmailNotificationFrequency;
@@ -30,18 +27,16 @@
private final String emailTemplate;
private final I18nTranslationManager i18n;
private final MailService mailService;
- private final UserManager userManager;
private final KuneWaveService waveService;
private final XmppManager xmppManager;
@Inject
public NotifySenderDefault(final MailService mailService, final KuneWaveService waveService,
- final XmppManager xmppManager, final UserManager userManager, final I18nTranslationManager i18n,
+ final XmppManager xmppManager, final I18nTranslationManager i18n,
final KuneProperties kuneProperties) throws IOException {
this.mailService = mailService;
this.waveService = waveService;
this.xmppManager = xmppManager;
- this.userManager = userManager;
this.i18n = i18n;
emailTemplate = FileUtils.readFileToString(new File(
kuneProperties.get(KuneProperties.SITE_EMAIL_TEMPLATE)));
@@ -51,15 +46,9 @@
@Override
public void send(final NotifyType notifyType, final FormatedString subject, final FormatedString body,
- final boolean isHtml, final String... recipients) {
- for (final String recipient : recipients) {
- User user;
- try {
- user = userManager.findByShortname(recipient);
- } catch (final NoResultException e) {
- LOG.info(String.format("The recipient %s is not a local user, don't notify", recipient));
- continue;
- }
+ final boolean isHtml, final User... recipients) {
+ for (final User user : recipients) {
+ final String username = user.getShortName();
if (subject.shouldBeTranslated()) {
// Translate per recipient language
final String subjectTranslation = i18n.getTranslation(user.getLanguage().getCode(),
@@ -79,7 +68,7 @@
}
switch (notifyType) {
case chat:
- xmppManager.sendMessage(recipient,
+ xmppManager.sendMessage(username,
String.format("<b>%s</b>%s", subject.getString(), body.getString()));
break;
case email:
@@ -94,7 +83,7 @@
if (isHtml) {
LOG.error("Wave html messages not supported yet");
}
- waveService.createWave(subject.getString(), body.getString(), recipient);
+ waveService.createWave(subject.getString(), body.getString(), username);
break;
}
}
@@ -102,7 +91,7 @@
@Override
public void send(final NotifyType notifyType, final FormatedString subject, final FormatedString body,
- final String... dests) {
+ final User... dests) {
send(notifyType, subject, body, false, dests);
}
Modified: trunk/src/main/java/cc/kune/core/server/notifier/NotifyService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/notifier/NotifyService.java 2012-01-03 01:47:18 UTC (rev 1654)
+++ trunk/src/main/java/cc/kune/core/server/notifier/NotifyService.java 2012-01-06 20:54:28 UTC (rev 1655)
@@ -1,13 +1,19 @@
package cc.kune.core.server.notifier;
import java.util.Collection;
-import java.util.List;
+import java.util.HashSet;
import java.util.Set;
+import javax.persistence.NoResultException;
+
import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import cc.kune.core.server.mail.FormatedString;
import cc.kune.domain.Group;
+import cc.kune.domain.User;
+import cc.kune.domain.finders.UserFinder;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -15,40 +21,69 @@
@Singleton
public class NotifyService {
+ public static final Log LOG = LogFactory.getLog(NotifyService.class);
private final NotifyHtmlHelper helper;
private final NotifySender sender;
+ private final UserFinder userFinder;
@Inject
- NotifyService(final NotifySender sender, final NotifyHtmlHelper helper) {
+ NotifyService(final NotifySender sender, final NotifyHtmlHelper helper, final UserFinder userFinder) {
this.sender = sender;
this.helper = helper;
+ this.userFinder = userFinder;
}
+ private void getAllUserMembers(final Set<User> users, final Group groupToNotify,
+ final boolean onlyAdmins) {
+ final Collection<Group> members;
+ final Set<Group> admins = groupToNotify.getSocialNetwork().getAccessLists().getAdmins().getList();
+ if (onlyAdmins) {
+ members = admins;
+ } else {
+ final Set<Group> collabs = groupToNotify.getSocialNetwork().getAccessLists().getEditors().getList();
+ members = CollectionUtils.union(admins, collabs);
+ }
+ for (final Group member : members) {
+ if (member.isPersonal()) {
+ final String shortName = member.getShortName();
+ try {
+ final User user = userFinder.findByShortName(shortName);
+ users.add(user);
+ } catch (final NoResultException e) {
+ LOG.error(String.format("This personal group %s is not a local user", shortName));
+ }
+ } else {
+ // Is a group, so go recursively
+ getAllUserMembers(users, member, onlyAdmins);
+ }
+ }
+
+ }
+
@SuppressWarnings("unchecked")
public void notifyGroup(final Group groupToNotify, final Group groupSender, final String subject,
final String message) {
- final Set<Group> admins = groupToNotify.getSocialNetwork().getAccessLists().getAdmins().getList();
- final Set<Group> collabs = groupToNotify.getSocialNetwork().getAccessLists().getEditors().getList();
- final List<Group> groups = (List<Group>) CollectionUtils.union(admins, collabs);
- notifyToAll(groupSender, subject, message, groups);
+ final Set<User> members = new HashSet<User>();
+ getAllUserMembers(members, groupToNotify, false);
+ notifyToAll(groupSender, subject, message, members);
}
public void notifyGroupAdmins(final Group groupToNotify, final Group groupSender,
final String subject, final String message) {
- final Set<Group> admins = groupToNotify.getSocialNetwork().getAccessLists().getAdmins().getList();
- notifyToAll(groupSender, subject, message, admins);
+ final Set<User> adminMembers = new HashSet<User>();
+ getAllUserMembers(adminMembers, groupToNotify, true);
+ notifyToAll(groupSender, subject, message, adminMembers);
}
private void notifyToAll(final Group groupSender, final String subject, final String message,
- final Collection<Group> groups) {
- for (final Group to : groups) {
+ final Collection<User> users) {
+ for (final User to : users) {
sender.send(NotifyType.email, FormatedString.build(subject),
- helper.groupNotification(groupSender.getShortName(), groupSender.hasLogo(), message),
- to.getShortName());
+ helper.groupNotification(groupSender.getShortName(), groupSender.hasLogo(), message), to);
}
}
- public void notifyUser(final String to, final Group group, final String subject, final String message) {
+ public void notifyUser(final User to, final Group group, final String subject, final String message) {
sender.send(NotifyType.email, FormatedString.build(subject),
helper.groupNotification(group.getShortName(), group.hasLogo(), message), to);
}
Modified: trunk/src/main/java/cc/kune/core/server/tool/ServerToolRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/tool/ServerToolRegistry.java 2012-01-03 01:47:18 UTC (rev 1654)
+++ trunk/src/main/java/cc/kune/core/server/tool/ServerToolRegistry.java 2012-01-06 20:54:28 UTC (rev 1655)
@@ -34,7 +34,7 @@
@Singleton
public class ServerToolRegistry {
- public static List<String> emptyToolList = new ArrayList<String>();
+ public static final List<String> emptyToolList = new ArrayList<String>();
static Log log = LogFactory.getLog(ServerToolRegistry.class);
Modified: trunk/src/main/java/cc/kune/wave/server/WaveEmailNotifier.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/WaveEmailNotifier.java 2012-01-03 01:47:18 UTC (rev 1654)
+++ trunk/src/main/java/cc/kune/wave/server/WaveEmailNotifier.java 2012-01-06 20:54:28 UTC (rev 1655)
@@ -1,5 +1,7 @@
package cc.kune.wave.server;
+import javax.persistence.NoResultException;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.waveprotocol.box.common.DeltaSequence;
@@ -23,6 +25,8 @@
import cc.kune.core.server.notifier.NotifyType;
import cc.kune.core.server.notifier.UsersOnline;
import cc.kune.core.server.properties.KuneBasicProperties;
+import cc.kune.domain.User;
+import cc.kune.domain.finders.UserFinder;
import com.google.inject.Inject;
@@ -33,7 +37,7 @@
@Inject
public WaveEmailNotifier(final WaveBus waveBus, final NotifySender notifyService,
final UsersOnline usersOnline, final KuneBasicProperties basicProperties,
- final ParticipantUtils partUtils) {
+ final ParticipantUtils partUtils, final UserFinder userFinder) {
waveBus.subscribe(new Subscriber() {
@Override
public void waveletCommitted(final WaveletName waveletName, final HashedVersion version) {
@@ -48,20 +52,25 @@
for (final TransformedWaveletDelta delta : deltas) {
for (final WaveletOperation op : delta) {
if (op instanceof AddParticipant) {
- final ParticipantId user = ((AddParticipant) op).getParticipantId();
+ final ParticipantId participant = ((AddParticipant) op).getParticipantId();
final String url = KuneWaveUtils.getUrl(WaveRef.of(wavelet.getWaveId(), waveletId));
final FormatedString body = FormatedString.build(
"Hi there,<br><br>You have a new message in %s. <a href=\"%s#%s\">Read more</a>.<br>",
basicProperties.getSiteCommonName(), basicProperties.getSiteUrl(), url);
- final String address = user.getAddress();
+ final String address = participant.getAddress();
if (partUtils.isLocal(address)) {
final String userName = partUtils.getAddressName(address);
// FIXME only for testing
- if (true || !usersOnline.isLogged(userName)) {
- notifyService.send(NotifyType.email, FormatedString.build("You have a new message"),
- body, true, userName);
- notifyService.send(NotifyType.chat, FormatedString.build("New message"), body, true,
- userName);
+ try {
+ final User user = userFinder.findByShortName(userName);
+ if (true || !usersOnline.isLogged(userName)) {
+ notifyService.send(NotifyType.email, FormatedString.build("You have a new message"),
+ body, true, user);
+ notifyService.send(NotifyType.chat, FormatedString.build("New message"), body, true,
+ user);
+ }
+ } catch (final NoResultException e) {
+ // Seems is not a local user
}
}
} else if (op instanceof WaveletBlipOperation) {
More information about the kune-commits
mailing list