create valid mailbox id on hyphen in localpart

This commit is contained in:
Peter Hormanns 2020-03-27 14:52:02 +01:00
parent 63201377f2
commit 29f13cf0ca

View File

@ -45,12 +45,14 @@ public class MailboxDAO {
} }
private String getMailbox(String pac, String localpart) throws IOException, XmlRpcException, MailboxNotFound { private String getMailbox(String pac, String localpart) throws IOException, XmlRpcException, MailboxNotFound {
final String mailboxPostfix = localpart.replace('-', '_');
final String mailboxIdentifier = pac + "-" + mailboxPostfix;
final List<Serializable> xmlRpcParamsList = new ArrayList<Serializable>(); final List<Serializable> xmlRpcParamsList = new ArrayList<Serializable>();
xmlRpcParamsList.add(pac); xmlRpcParamsList.add(pac);
xmlRpcParamsList.add(ticketBox.getTicket()); xmlRpcParamsList.add(ticketBox.getTicket());
final HashMap<String, Serializable> whereParamsMap = new HashMap<String, Serializable>(); final HashMap<String, Serializable> whereParamsMap = new HashMap<String, Serializable>();
xmlRpcParamsList.add(whereParamsMap); xmlRpcParamsList.add(whereParamsMap);
whereParamsMap.put("name", pac + "-" + localpart); whereParamsMap.put("name", mailboxIdentifier);
final Object[] rpcResult = (Object[])rpcClient.execute("user.search", xmlRpcParamsList); final Object[] rpcResult = (Object[])rpcClient.execute("user.search", xmlRpcParamsList);
if (rpcResult.length == 1) { if (rpcResult.length == 1) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")