diff src/login-common/login-proxy.h @ 2773:e624a9ad6a30 HEAD

More smart IMAP and POP3 proxies. Now if remote login fails, it just destroys the proxy and allows trying another username which can go elsewhere. Also now replies with the same old "Authentication failed" error message instead of showing remote server's failure message.
author Timo Sirainen <tss@iki.fi>
date Tue, 19 Oct 2004 02:07:01 +0300
parents d344be0bb70f
children 9d9e72374164
line wrap: on
line diff
--- a/src/login-common/login-proxy.h	Tue Oct 19 02:03:54 2004 +0300
+++ b/src/login-common/login-proxy.h	Tue Oct 19 02:07:01 2004 +0300
@@ -1,10 +1,24 @@
 #ifndef __LOGIN_PROXY_H
 #define __LOGIN_PROXY_H
 
-/* Create a proxy to given host. Returns -1 if failed, or 0 if ok.
-   In any case the client should be destroyed after this call. */
-int login_proxy_new(struct client *client, const char *host,
-		    unsigned int port, const char *login_cmd);
+struct login_proxy;
+
+/* Called when new input comes from proxy. */
+typedef void proxy_callback_t(struct istream *input, struct ostream *output,
+			      void *context);
+
+/* Create a proxy to given host. Returns NULL if failed. Given callback is
+   called when new input is available from proxy. */
+struct login_proxy *
+login_proxy_new(struct client *client, const char *host, unsigned int port,
+		proxy_callback_t *callback, void *context);
+/* Free the proxy. This should be called if authentication fails. */
+void login_proxy_free(struct login_proxy *proxy);
+
+/* Detach proxy from client. This is done after the authentication is
+   successful and all that is left is the dummy proxying. */
+void login_proxy_detach(struct login_proxy *proxy, struct istream *client_input,
+			struct ostream *client_output);
 
 void login_proxy_deinit(void);