1 5 package org.exoplatform.services.communication.message.impl; 6 7 import org.exoplatform.services.communication.message.*; 8 import org.picocontainer.Startable; 9 14 abstract public class BaseMessageProtocolPlugin 15 implements MessageProtocolPlugin, Startable { 16 protected MessageService mservice_ ; 17 18 public BaseMessageProtocolPlugin(MessageService mservice) { 19 mservice_ = mservice ; 20 mservice.addMessageProtocolPlugin(this) ; 21 } 22 23 protected void saveSentMessage(Account account, Message message) throws Exception { 24 MessageImpl mesageImpl = (MessageImpl) message ; 25 Folder folder = mservice_.getFolder(account, MessageService.SENT_FOLDER) ; 26 Message backupMessage = mesageImpl.cloneMessage() ; 27 mservice_.createMessage(account, folder, backupMessage) ; 28 } 29 30 protected String formatEmail(String email) { 31 if(email == null || email.length() == 0) { 32 email = "unknown@unknown.host" ; 33 } 34 return email ; 35 } 36 37 public void start() {} 38 public void stop() {} 39 } | Popular Tags |