use of com.zimbra.cs.mailclient.imap.IDInfo in project zm-mailbox by Zimbra.
the class ImapProxy method createIDInfo.
private IDInfo createIDInfo(ImapHandler handler) {
IDInfo id = new IDInfo();
id.put(IDInfo.NAME, "ZCS");
id.put(IDInfo.VERSION, BuildInfo.VERSION);
id.put(IDInfo.X_VIA, handler.getNextVia());
if (handler.getOrigRemoteIp() != null) {
id.put(IDInfo.X_ORIGINATING_IP, handler.getOrigRemoteIp());
}
return id;
}
use of com.zimbra.cs.mailclient.imap.IDInfo in project zm-mailbox by Zimbra.
the class TestRemoteImapMultiServer method testAuthenticateAsProxyToHomeHost.
@Test
public void testAuthenticateAsProxyToHomeHost() throws IOException, LoginException, AuthProviderException, AuthTokenException {
connection = connectAsProxy(homeServer);
IDInfo id = new IDInfo();
id.put(IDInfo.NAME, "ZCS");
id.put(IDInfo.VERSION, BuildInfo.VERSION);
connection.id(id);
connection.authenticate(AuthProvider.getAuthToken(acc).getEncoded());
assertTrue("IMAP connection is not authenticated", connection.isAuthenticated());
}
use of com.zimbra.cs.mailclient.imap.IDInfo in project zm-mailbox by Zimbra.
the class ConnectionManager method isImportingSelf.
private static boolean isImportingSelf(DataSource ds, ImapConnection ic) throws IOException, ServiceException {
if (!ds.isOffline() && ic.hasCapability(ImapCapabilities.ID)) {
try {
IDInfo clientId = new IDInfo();
clientId.put(IDInfo.NAME, IDInfo.DATASOURCE_IMAP_CLIENT_NAME);
clientId.put(IDInfo.VERSION, BuildInfo.VERSION);
IDInfo id = ic.id(clientId);
if ("Zimbra".equalsIgnoreCase(id.get(IDInfo.NAME)) && ds.getAccount() != null) {
String user = id.get("user");
String server = id.get("server");
return user != null && user.equals(ds.getAccount().getName()) && server != null && server.equals(Provisioning.getInstance().getLocalServer().getId());
}
} catch (CommandFailedException e) {
// Skip check if ID command fails
LOG.warn("ID command failed, assuming not importing self", e);
}
}
return false;
}
use of com.zimbra.cs.mailclient.imap.IDInfo in project zm-mailbox by Zimbra.
the class TestImapClient method testYahoo.
@Ignore("deprecated")
public void testYahoo() throws Exception {
ImapConfig config = new ImapConfig();
config.getLogger().setLevel(Log.Level.trace);
config.setHost("imap.mail.yahoo.com");
config.setAuthenticationId("dacztest");
connection = new ImapConnection(config);
connection.connect();
IDInfo id = new IDInfo();
id.put("guid", "unknown");
connection.id(id);
connection.login("test1234");
char delim = connection.getDelimiter();
assertEquals(0, delim);
createTestMailbox("Large", 10000);
}
use of com.zimbra.cs.mailclient.imap.IDInfo in project zm-mailbox by Zimbra.
the class TestImapClient method testID.
@Test
public void testID() throws Exception {
IDInfo id = new IDInfo();
id.put(IDInfo.NAME, "foo");
assertEquals("foo", id.get(IDInfo.NAME));
assertEquals("foo", id.get("Name"));
connect();
IDInfo id1 = connection.id(id);
assertNotNull(id1);
assertEquals("Zimbra", id1.get(IDInfo.NAME));
IDInfo id2 = connection.id(new IDInfo());
assertEquals(id1.get(IDInfo.NAME), id2.get(IDInfo.NAME));
assertEquals(id1.get(IDInfo.VERSION), id2.get(IDInfo.VERSION));
}
Aggregations