mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Add a ConversationItemReceivedEvent
This commit is contained in:
@@ -16,20 +16,18 @@ import org.briarproject.android.contact.ConversationActivity;
|
||||
import org.briarproject.android.forum.ForumActivity;
|
||||
import org.briarproject.api.contact.Contact;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.conversation.ConversationManager;
|
||||
import org.briarproject.api.db.DatabaseExecutor;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.event.ConversationItemReceivedEvent;
|
||||
import org.briarproject.api.event.Event;
|
||||
import org.briarproject.api.event.EventListener;
|
||||
import org.briarproject.api.event.ForumInvitationReceivedEvent;
|
||||
import org.briarproject.api.event.IntroductionRequestReceivedEvent;
|
||||
import org.briarproject.api.event.IntroductionResponseReceivedEvent;
|
||||
import org.briarproject.api.event.IntroductionSucceededEvent;
|
||||
import org.briarproject.api.event.MessageStateChangedEvent;
|
||||
import org.briarproject.api.event.SettingsUpdatedEvent;
|
||||
import org.briarproject.api.forum.ForumManager;
|
||||
import org.briarproject.api.lifecycle.Service;
|
||||
import org.briarproject.api.lifecycle.ServiceException;
|
||||
import org.briarproject.api.messaging.MessagingManager;
|
||||
import org.briarproject.api.settings.Settings;
|
||||
import org.briarproject.api.settings.SettingsManager;
|
||||
import org.briarproject.api.sync.ClientId;
|
||||
@@ -75,9 +73,9 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(AndroidNotificationManagerImpl.class.getName());
|
||||
|
||||
private final ConversationManager conversationManager;
|
||||
private final Executor dbExecutor;
|
||||
private final SettingsManager settingsManager;
|
||||
private final MessagingManager messagingManager;
|
||||
private final ForumManager forumManager;
|
||||
private final AndroidExecutor androidExecutor;
|
||||
private final Context appContext;
|
||||
@@ -94,13 +92,15 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
||||
private volatile Settings settings = new Settings();
|
||||
|
||||
@Inject
|
||||
public AndroidNotificationManagerImpl(@DatabaseExecutor Executor dbExecutor,
|
||||
SettingsManager settingsManager, MessagingManager messagingManager,
|
||||
public AndroidNotificationManagerImpl(
|
||||
ConversationManager conversationManager,
|
||||
@DatabaseExecutor Executor dbExecutor,
|
||||
SettingsManager settingsManager,
|
||||
ForumManager forumManager, AndroidExecutor androidExecutor,
|
||||
Application app) {
|
||||
this.conversationManager = conversationManager;
|
||||
this.dbExecutor = dbExecutor;
|
||||
this.settingsManager = settingsManager;
|
||||
this.messagingManager = messagingManager;
|
||||
this.forumManager = forumManager;
|
||||
this.androidExecutor = androidExecutor;
|
||||
appContext = app.getApplicationContext();
|
||||
@@ -157,27 +157,19 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
||||
if (e instanceof SettingsUpdatedEvent) {
|
||||
SettingsUpdatedEvent s = (SettingsUpdatedEvent) e;
|
||||
if (s.getNamespace().equals(SETTINGS_NAMESPACE)) loadSettings();
|
||||
} else if (e instanceof ConversationItemReceivedEvent) {
|
||||
ContactId c = ((ConversationItemReceivedEvent) e).getContactId();
|
||||
showNotificationForPrivateConversation(c);
|
||||
} else if (e instanceof MessageStateChangedEvent) {
|
||||
MessageStateChangedEvent m = (MessageStateChangedEvent) e;
|
||||
if (!m.isLocal() && m.getState() == DELIVERED) {
|
||||
ClientId c = m.getClientId();
|
||||
if (c.equals(messagingManager.getClientId()))
|
||||
showPrivateMessageNotification(m.getMessage().getGroupId());
|
||||
else if (c.equals(forumManager.getClientId()))
|
||||
if (c.equals(forumManager.getClientId()))
|
||||
showForumPostNotification(m.getMessage().getGroupId());
|
||||
}
|
||||
} else if (e instanceof IntroductionRequestReceivedEvent) {
|
||||
ContactId c = ((IntroductionRequestReceivedEvent) e).getContactId();
|
||||
showNotificationForPrivateConversation(c);
|
||||
} else if (e instanceof IntroductionResponseReceivedEvent) {
|
||||
ContactId c = ((IntroductionResponseReceivedEvent) e).getContactId();
|
||||
showNotificationForPrivateConversation(c);
|
||||
} else if (e instanceof IntroductionSucceededEvent) {
|
||||
Contact c = ((IntroductionSucceededEvent) e).getContact();
|
||||
showIntroductionSucceededNotification(c);
|
||||
} else if (e instanceof ForumInvitationReceivedEvent) {
|
||||
ContactId c = ((ForumInvitationReceivedEvent) e).getContactId();
|
||||
showNotificationForPrivateConversation(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,7 +376,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
GroupId group = messagingManager.getConversationId(c);
|
||||
GroupId group = conversationManager.getConversationId(c);
|
||||
showPrivateMessageNotification(group);
|
||||
} catch (DbException e) {
|
||||
if (LOG.isLoggable(WARNING))
|
||||
|
||||
@@ -87,15 +87,6 @@ public abstract class BaseContactListAdapter<VH extends BaseContactListAdapter.B
|
||||
return INVALID_POSITION; // Not found
|
||||
}
|
||||
|
||||
int findItemPosition(GroupId g) {
|
||||
int count = getItemCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
ContactListItem item = getItem(i);
|
||||
if (item.getGroupId().equals(g)) return i;
|
||||
}
|
||||
return INVALID_POSITION; // Not found
|
||||
}
|
||||
|
||||
public void addAll(List<ContactListItem> contacts) {
|
||||
this.contacts.addAll(contacts);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ import org.briarproject.android.util.BriarRecyclerView;
|
||||
import org.briarproject.api.contact.Contact;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.contact.ContactManager;
|
||||
import org.briarproject.api.conversation.ConversationItem;
|
||||
import org.briarproject.api.conversation.ConversationItem.IncomingItem;
|
||||
import org.briarproject.api.conversation.ConversationManager;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.db.NoSuchContactException;
|
||||
@@ -31,16 +33,13 @@ import org.briarproject.api.event.ContactConnectedEvent;
|
||||
import org.briarproject.api.event.ContactDisconnectedEvent;
|
||||
import org.briarproject.api.event.ContactRemovedEvent;
|
||||
import org.briarproject.api.event.ContactStatusChangedEvent;
|
||||
import org.briarproject.api.event.ConversationItemReceivedEvent;
|
||||
import org.briarproject.api.event.Event;
|
||||
import org.briarproject.api.event.EventBus;
|
||||
import org.briarproject.api.event.EventListener;
|
||||
import org.briarproject.api.event.MessageStateChangedEvent;
|
||||
import org.briarproject.api.event.PrivateMessageReceivedEvent;
|
||||
import org.briarproject.api.identity.IdentityManager;
|
||||
import org.briarproject.api.identity.LocalAuthor;
|
||||
import org.briarproject.api.messaging.PrivateMessageHeader;
|
||||
import org.briarproject.api.plugins.ConnectionRegistry;
|
||||
import org.briarproject.api.sync.ClientId;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -53,7 +52,6 @@ import static android.support.v4.app.ActivityOptionsCompat.makeSceneTransitionAn
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static org.briarproject.android.BriarActivity.GROUP_ID;
|
||||
import static org.briarproject.api.sync.ValidationManager.State.DELIVERED;
|
||||
|
||||
public class ContactListFragment extends BaseFragment implements EventListener {
|
||||
|
||||
@@ -197,12 +195,14 @@ public class ContactListFragment extends BaseFragment implements EventListener {
|
||||
connectionRegistry.isConnected(c.getId());
|
||||
LocalAuthor localAuthor = identityManager
|
||||
.getLocalAuthor(c.getLocalAuthorId());
|
||||
long timestamp = conversationManager.getTimestamp(id);
|
||||
long timestamp =
|
||||
conversationManager.getTimestamp(id);
|
||||
long now1 = System.currentTimeMillis();
|
||||
int unread = conversationManager.getUnreadCount(id);
|
||||
long duration = System.currentTimeMillis() - now1;
|
||||
if (LOG.isLoggable(INFO))
|
||||
LOG.info("Loading unread messages took " + duration + " ms");
|
||||
LOG.info("Loading unread messages took " +
|
||||
duration + " ms");
|
||||
contacts.add(new ContactListItem(c, localAuthor,
|
||||
connected, groupId, timestamp, unread));
|
||||
} catch (NoSuchContactException e) {
|
||||
@@ -248,64 +248,27 @@ public class ContactListFragment extends BaseFragment implements EventListener {
|
||||
} else if (e instanceof ContactRemovedEvent) {
|
||||
LOG.info("Contact removed");
|
||||
removeItem(((ContactRemovedEvent) e).getContactId());
|
||||
} else if (e instanceof PrivateMessageReceivedEvent) {
|
||||
} else if (e instanceof ConversationItemReceivedEvent) {
|
||||
LOG.info("Message received, update contact");
|
||||
PrivateMessageReceivedEvent p = (PrivateMessageReceivedEvent) e;
|
||||
PrivateMessageHeader h = p.getMessageHeader();
|
||||
updateItem(p.getGroupId(), h.getTimestamp(), h.isRead());
|
||||
} else if (e instanceof MessageStateChangedEvent) {
|
||||
MessageStateChangedEvent m = (MessageStateChangedEvent) e;
|
||||
ClientId c = m.getClientId();
|
||||
if (m.getState() == DELIVERED && conversationManager.isWrappedClient(c)) {
|
||||
LOG.info("Message added, reloading");
|
||||
reloadConversation(m.getMessage().getGroupId());
|
||||
}
|
||||
ConversationItemReceivedEvent event =
|
||||
(ConversationItemReceivedEvent) e;
|
||||
ConversationItem item = event.getItem();
|
||||
updateItem(event.getContactId(), item.getTime(),
|
||||
((IncomingItem) item).isRead());
|
||||
}
|
||||
}
|
||||
|
||||
private void reloadConversation(final GroupId g) {
|
||||
listener.runOnDbThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
ContactId c = conversationManager.getContactId(g);
|
||||
long timestamp = conversationManager.getTimestamp(c);
|
||||
int unread = conversationManager.getUnreadCount(c);
|
||||
updateItem(c, timestamp, unread);
|
||||
} catch (NoSuchContactException e) {
|
||||
LOG.info("Contact removed");
|
||||
} catch (DbException e) {
|
||||
if (LOG.isLoggable(WARNING))
|
||||
LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateItem(final ContactId c, final long timestamp, final int unread) {
|
||||
private void updateItem(final ContactId c, final long timestamp,
|
||||
final boolean read) {
|
||||
listener.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int position = adapter.findItemPosition(c);
|
||||
ContactListItem item = adapter.getItem(position);
|
||||
if (item != null) {
|
||||
item.setTimestamp(timestamp);
|
||||
item.setUnreadCount(unread);
|
||||
adapter.updateItem(position, item);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateItem(final GroupId g, final long timestamp, final boolean unread) {
|
||||
listener.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int position = adapter.findItemPosition(g);
|
||||
ContactListItem item = adapter.getItem(position);
|
||||
if (item != null) {
|
||||
item.setTimestamp(timestamp);
|
||||
if (unread)
|
||||
if (timestamp > item.getTimestamp())
|
||||
item.setTimestamp(timestamp);
|
||||
if (!read)
|
||||
item.setUnreadCount(item.getUnreadCount() + 1);
|
||||
adapter.updateItem(position, item);
|
||||
}
|
||||
|
||||
@@ -33,8 +33,6 @@ import org.briarproject.api.FormatException;
|
||||
import org.briarproject.api.contact.Contact;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.contact.ContactManager;
|
||||
import org.briarproject.api.conversation.ConversationIntroductionRequestItem;
|
||||
import org.briarproject.api.conversation.ConversationIntroductionResponseItem;
|
||||
import org.briarproject.api.conversation.ConversationItem;
|
||||
import org.briarproject.api.conversation.ConversationItem.IncomingItem;
|
||||
import org.briarproject.api.conversation.ConversationManager;
|
||||
@@ -44,17 +42,12 @@ import org.briarproject.api.db.NoSuchContactException;
|
||||
import org.briarproject.api.event.ContactConnectedEvent;
|
||||
import org.briarproject.api.event.ContactDisconnectedEvent;
|
||||
import org.briarproject.api.event.ContactRemovedEvent;
|
||||
import org.briarproject.api.event.ConversationItemReceivedEvent;
|
||||
import org.briarproject.api.event.Event;
|
||||
import org.briarproject.api.event.EventBus;
|
||||
import org.briarproject.api.event.EventListener;
|
||||
import org.briarproject.api.event.ForumInvitationReceivedEvent;
|
||||
import org.briarproject.api.event.IntroductionRequestReceivedEvent;
|
||||
import org.briarproject.api.event.IntroductionResponseReceivedEvent;
|
||||
import org.briarproject.api.event.MessagesAckedEvent;
|
||||
import org.briarproject.api.event.MessagesSentEvent;
|
||||
import org.briarproject.api.event.PrivateMessageReceivedEvent;
|
||||
import org.briarproject.api.introduction.IntroductionRequest;
|
||||
import org.briarproject.api.introduction.IntroductionResponse;
|
||||
import org.briarproject.api.messaging.PrivateMessage;
|
||||
import org.briarproject.api.messaging.PrivateMessageFactory;
|
||||
import org.briarproject.api.plugins.ConnectionRegistry;
|
||||
@@ -399,15 +392,13 @@ public class ConversationActivity extends BriarActivity
|
||||
LOG.info("Contact removed");
|
||||
finishOnUiThread();
|
||||
}
|
||||
} else if (e instanceof PrivateMessageReceivedEvent) {
|
||||
PrivateMessageReceivedEvent p = (PrivateMessageReceivedEvent) e;
|
||||
if (p.getGroupId().equals(groupId)) {
|
||||
} else if (e instanceof ConversationItemReceivedEvent) {
|
||||
ConversationItemReceivedEvent event =
|
||||
(ConversationItemReceivedEvent) e;
|
||||
if (event.getContactId().equals(contactId)) {
|
||||
LOG.info("Message received, adding");
|
||||
PrivateMessageHeader h = p.getMessageHeader();
|
||||
ConversationMessageItem m = ConversationMessageItem.from(h);
|
||||
conversationManager.loadMessageContent(m);
|
||||
addConversationItem(m);
|
||||
markMessageReadIfNew(m);
|
||||
addConversationItem(event.getItem());
|
||||
markMessageReadIfNew(event.getItem());
|
||||
}
|
||||
} else if (e instanceof MessagesSentEvent) {
|
||||
MessagesSentEvent m = (MessagesSentEvent) e;
|
||||
@@ -435,30 +426,6 @@ public class ConversationActivity extends BriarActivity
|
||||
connected = false;
|
||||
displayContactDetails();
|
||||
}
|
||||
} else if (e instanceof IntroductionRequestReceivedEvent) {
|
||||
IntroductionRequestReceivedEvent event =
|
||||
(IntroductionRequestReceivedEvent) e;
|
||||
if (event.getContactId().equals(contactId)) {
|
||||
IntroductionRequest ir = event.getIntroductionRequest();
|
||||
ConversationItem item =
|
||||
ConversationIntroductionRequestItem.from(ir);
|
||||
addConversationItem(item);
|
||||
}
|
||||
} else if (e instanceof IntroductionResponseReceivedEvent) {
|
||||
IntroductionResponseReceivedEvent event =
|
||||
(IntroductionResponseReceivedEvent) e;
|
||||
if (event.getContactId().equals(contactId)) {
|
||||
IntroductionResponse ir = event.getIntroductionResponse();
|
||||
ConversationItem item =
|
||||
ConversationIntroductionResponseItem.from(ir);
|
||||
addConversationItem(item);
|
||||
}
|
||||
} else if (e instanceof ForumInvitationReceivedEvent) {
|
||||
ForumInvitationReceivedEvent event =
|
||||
(ForumInvitationReceivedEvent) e;
|
||||
if (event.getContactId().equals(contactId)) {
|
||||
loadMessages();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,6 @@ public interface ConversationManager {
|
||||
*/
|
||||
ClientId getClientId();
|
||||
|
||||
/**
|
||||
* Returns true if this is the id of a wrapped client.
|
||||
*/
|
||||
boolean isWrappedClient(ClientId clientId);
|
||||
|
||||
/**
|
||||
* Stores a local private message, and returns the corresponding item.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.conversation.ConversationItem;
|
||||
|
||||
/**
|
||||
* An event that is broadcast when a new conversation item is received.
|
||||
*/
|
||||
public class ConversationItemReceivedEvent extends Event {
|
||||
|
||||
private final ConversationItem item;
|
||||
private final ContactId contactId;
|
||||
|
||||
public ConversationItemReceivedEvent(ConversationItem item,
|
||||
ContactId contactId) {
|
||||
this.item = item;
|
||||
this.contactId = contactId;
|
||||
}
|
||||
|
||||
public ConversationItem getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public ContactId getContactId() {
|
||||
return contactId;
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,14 @@ import org.briarproject.api.conversation.ConversationMessageItem;
|
||||
import org.briarproject.api.db.DatabaseExecutor;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.db.NoSuchMessageException;
|
||||
import org.briarproject.api.event.ConversationItemReceivedEvent;
|
||||
import org.briarproject.api.event.Event;
|
||||
import org.briarproject.api.event.EventBus;
|
||||
import org.briarproject.api.event.EventListener;
|
||||
import org.briarproject.api.event.ForumInvitationReceivedEvent;
|
||||
import org.briarproject.api.event.IntroductionRequestReceivedEvent;
|
||||
import org.briarproject.api.event.IntroductionResponseReceivedEvent;
|
||||
import org.briarproject.api.event.PrivateMessageReceivedEvent;
|
||||
import org.briarproject.api.forum.ForumInvitationMessage;
|
||||
import org.briarproject.api.forum.ForumSharingManager;
|
||||
import org.briarproject.api.introduction.IntroductionManager;
|
||||
@@ -41,7 +49,8 @@ import javax.inject.Inject;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
|
||||
public class ConversationManagerImpl implements ConversationManager {
|
||||
public class ConversationManagerImpl implements ConversationManager,
|
||||
EventListener {
|
||||
|
||||
static final ClientId CLIENT_ID = new ClientId(StringUtils.fromHexString(
|
||||
"05313ec596871e5305181220488fc9c0"
|
||||
@@ -51,6 +60,7 @@ public class ConversationManagerImpl implements ConversationManager {
|
||||
Logger.getLogger(ConversationManagerImpl.class.getName());
|
||||
|
||||
private final Executor dbExecutor;
|
||||
private final EventBus eventBus;
|
||||
private final ForumSharingManager forumSharingManager;
|
||||
private final IntroductionManager introductionManager;
|
||||
private final MessagingManager messagingManager;
|
||||
@@ -60,13 +70,16 @@ public class ConversationManagerImpl implements ConversationManager {
|
||||
|
||||
@Inject
|
||||
ConversationManagerImpl(@DatabaseExecutor Executor dbExecutor,
|
||||
ForumSharingManager forumSharingManager,
|
||||
EventBus eventBus, ForumSharingManager forumSharingManager,
|
||||
IntroductionManager introductionManager,
|
||||
MessagingManager messagingManager) {
|
||||
this.dbExecutor = dbExecutor;
|
||||
this.eventBus = eventBus;
|
||||
this.forumSharingManager = forumSharingManager;
|
||||
this.introductionManager = introductionManager;
|
||||
this.messagingManager = messagingManager;
|
||||
|
||||
eventBus.addListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,12 +87,6 @@ public class ConversationManagerImpl implements ConversationManager {
|
||||
return CLIENT_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWrappedClient(ClientId clientId) {
|
||||
return clientId.equals(introductionManager.getClientId()) ||
|
||||
clientId.equals(forumSharingManager.getClientId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConversationItem addLocalMessage(PrivateMessage m, byte[] body)
|
||||
throws DbException {
|
||||
@@ -218,4 +225,57 @@ public class ConversationManagerImpl implements ConversationManager {
|
||||
forumSharingManager.setReadFlag(c, id, local, read);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eventOccurred(Event e) {
|
||||
if (e instanceof PrivateMessageReceivedEvent) {
|
||||
PrivateMessageReceivedEvent p = (PrivateMessageReceivedEvent) e;
|
||||
PrivateMessageHeader h = p.getMessageHeader();
|
||||
ConversationItem m = ConversationMessageItemImpl.from(h);
|
||||
loadMessageContent((Partial) m);
|
||||
try {
|
||||
ContactId c = getContactId(p.getGroupId());
|
||||
eventBus.broadcast(new ConversationItemReceivedEvent(m, c));
|
||||
} catch (DbException dbe) {
|
||||
if (LOG.isLoggable(WARNING))
|
||||
LOG.log(WARNING, dbe.toString(), dbe);
|
||||
}
|
||||
} else if (e instanceof IntroductionRequestReceivedEvent) {
|
||||
IntroductionRequestReceivedEvent event =
|
||||
(IntroductionRequestReceivedEvent) e;
|
||||
IntroductionRequest ir = event.getIntroductionRequest();
|
||||
ConversationItem item =
|
||||
ConversationIntroductionRequestItemImpl.from(ir);
|
||||
eventBus.broadcast(
|
||||
new ConversationItemReceivedEvent(item,
|
||||
event.getContactId()));
|
||||
} else if (e instanceof IntroductionResponseReceivedEvent) {
|
||||
IntroductionResponseReceivedEvent event =
|
||||
(IntroductionResponseReceivedEvent) e;
|
||||
IntroductionResponse ir = event.getIntroductionResponse();
|
||||
ConversationItem item =
|
||||
ConversationIntroductionResponseItemImpl.from(ir);
|
||||
eventBus.broadcast(new ConversationItemReceivedEvent(item,
|
||||
event.getContactId()));
|
||||
} else if (e instanceof ForumInvitationReceivedEvent) {
|
||||
ForumInvitationReceivedEvent event =
|
||||
(ForumInvitationReceivedEvent) e;
|
||||
try {
|
||||
Collection<ForumInvitationMessage> msgs = forumSharingManager
|
||||
.getInvitationMessages(event.getContactId());
|
||||
for (ForumInvitationMessage i : msgs) {
|
||||
if (i.getForumName().equals(event.getForum().getName())) {
|
||||
ConversationItem item =
|
||||
ConversationForumInvitationItemImpl.from(i);
|
||||
eventBus.broadcast(
|
||||
new ConversationItemReceivedEvent(item,
|
||||
event.getContactId()));
|
||||
}
|
||||
}
|
||||
} catch (DbException dbe) {
|
||||
if (LOG.isLoggable(WARNING))
|
||||
LOG.log(WARNING, dbe.toString(), dbe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user