1d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5d1766043SAndrew Rist * distributed with this work for additional information
6d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10d1766043SAndrew Rist *
11d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12d1766043SAndrew Rist *
13d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14d1766043SAndrew Rist * software distributed under the License is distributed on an
15d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17d1766043SAndrew Rist * specific language governing permissions and limitations
18d1766043SAndrew Rist * under the License.
19d1766043SAndrew Rist *
20d1766043SAndrew Rist *************************************************************/
21d1766043SAndrew Rist
22d1766043SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir#ifndef __com_sun_star_mail_XMailService_idl__
25cdf0e10cSrcweir#define __com_sun_star_mail_XMailService_idl__
26cdf0e10cSrcweir
27cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__
28cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
29cdf0e10cSrcweir#endif
30cdf0e10cSrcweir
31cdf0e10cSrcweir#ifndef __com_sun_star_mail_XAuthenticator_idl__
32cdf0e10cSrcweir#include <com/sun/star/mail/XAuthenticator.idl>
33cdf0e10cSrcweir#endif
34cdf0e10cSrcweir
35cdf0e10cSrcweir#ifndef __com_sun_star_auth_AuthenticationFailedException_idl__
36cdf0e10cSrcweir#include <com/sun/star/auth/AuthenticationFailedException.idl>
37cdf0e10cSrcweir#endif
38cdf0e10cSrcweir
39cdf0e10cSrcweir#ifndef __com_sun_star_io_AlreadyConnectedException_idl__
40cdf0e10cSrcweir#include <com/sun/star/io/AlreadyConnectedException.idl>
41cdf0e10cSrcweir#endif
42cdf0e10cSrcweir
43cdf0e10cSrcweir#ifndef __com_sun_star_io_NotConnectedException_idl__
44cdf0e10cSrcweir#include <com/sun/star/io/NotConnectedException.idl>
45cdf0e10cSrcweir#endif
46cdf0e10cSrcweir
47cdf0e10cSrcweir#ifndef __com_sun_star_io_UnknownHostException_idl__
48cdf0e10cSrcweir#include <com/sun/star/io/UnknownHostException.idl>
49cdf0e10cSrcweir#endif
50cdf0e10cSrcweir
51cdf0e10cSrcweir#ifndef __com_sun_star_io_NoRouteToHostException_idl__
52cdf0e10cSrcweir#include <com/sun/star/io/NoRouteToHostException.idl>
53cdf0e10cSrcweir#endif
54cdf0e10cSrcweir
55cdf0e10cSrcweir#ifndef __com_sun_star_io_ConnectException_idl__
56cdf0e10cSrcweir#include <com/sun/star/io/ConnectException.idl>
57cdf0e10cSrcweir#endif
58cdf0e10cSrcweir
59cdf0e10cSrcweir#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
60cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl>
61cdf0e10cSrcweir#endif
62cdf0e10cSrcweir
63cdf0e10cSrcweir#ifndef __com_sun_star_mail_XConnectionListener_idl__
64cdf0e10cSrcweir#include <com/sun/star/mail/XConnectionListener.idl>
65cdf0e10cSrcweir#endif
66cdf0e10cSrcweir
67cdf0e10cSrcweir#ifndef __com_sun_star_mail_MailException_idl__
68cdf0e10cSrcweir#include <com/sun/star/mail/MailException.idl>
69cdf0e10cSrcweir#endif
70cdf0e10cSrcweir
71cdf0e10cSrcweir#ifndef __com_sun_star_uno_XCurrentContext_idl__
72cdf0e10cSrcweir#include <com/sun/star/uno/XCurrentContext.idl>
73cdf0e10cSrcweir#endif
74cdf0e10cSrcweir
75cdf0e10cSrcweir
76cdf0e10cSrcweirmodule com { module sun { module star { module mail {
77cdf0e10cSrcweir
78cdf0e10cSrcweir/**
79cdf0e10cSrcweir   Represents a mail server abstraction.
80cdf0e10cSrcweir
81*96af39f7SJürgen Schmidt   @since OpenOffice 2.0
82cdf0e10cSrcweir */
83cdf0e10cSrcweirinterface XMailService: ::com::sun::star::uno::XInterface {
84cdf0e10cSrcweir
85cdf0e10cSrcweir    /**
86cdf0e10cSrcweir        Returns all connection types which are supported to
87cdf0e10cSrcweir        connect to the mail service. At least support insecure
88cdf0e10cSrcweir        connections must be supported. Currently defined
89cdf0e10cSrcweir        connection types are (the values should be handled
90cdf0e10cSrcweir        case insensitive):
91cdf0e10cSrcweir        "Insecure" - insecure connections
92cdf0e10cSrcweir        "Ssl" - Secure Socket Layer 2.0/3.0 based connection
93cdf0e10cSrcweir
94cdf0e10cSrcweir        @returns
95cdf0e10cSrcweir        a sequence of supported connection types.
96cdf0e10cSrcweir    */
97cdf0e10cSrcweir    sequence<string> getSupportedConnectionTypes();
98cdf0e10cSrcweir
99cdf0e10cSrcweir    /**
100cdf0e10cSrcweir        Register a connection listener.
101cdf0e10cSrcweir
102cdf0e10cSrcweir        @param xListener
103cdf0e10cSrcweir        [in] a listener that will be informed about connection events.
104cdf0e10cSrcweir
105cdf0e10cSrcweir        @see com::sun::star::mail::XConnectionListener
106cdf0e10cSrcweir    */
107cdf0e10cSrcweir    void addConnectionListener([in] XConnectionListener xListener);
108cdf0e10cSrcweir
109cdf0e10cSrcweir    /**
110cdf0e10cSrcweir        Unregister a connection listener.
111cdf0e10cSrcweir
112cdf0e10cSrcweir        @param xListener
113cdf0e10cSrcweir        [in] a listener that no longer need to be informed about connection events.
114cdf0e10cSrcweir
115cdf0e10cSrcweir        @see com::sun::star::mail::XConnectionListener
116cdf0e10cSrcweir    */
117cdf0e10cSrcweir    void removeConnectionListener([in] XConnectionListener xListener);
118cdf0e10cSrcweir
119cdf0e10cSrcweir    /**
120cdf0e10cSrcweir        Return the context of the current connnection. The context
121cdf0e10cSrcweir        contains information like the server name, port, connection type
122cdf0e10cSrcweir        etc.
123cdf0e10cSrcweir
124cdf0e10cSrcweir        @precond
125cdf0e10cSrcweir        <code>isConnected</code> returns true.
126cdf0e10cSrcweir
127cdf0e10cSrcweir        @returns
128cdf0e10cSrcweir        the current connection context.
129cdf0e10cSrcweir
130cdf0e10cSrcweir        @throws com::sun::star::io::NotConnectedException
131cdf0e10cSrcweir        if no connection is currently established.
132cdf0e10cSrcweir
133cdf0e10cSrcweir        @see com::sun::star::mail::connectUser
134cdf0e10cSrcweir        @see com::sun::star::io::NotConnectedException
135cdf0e10cSrcweir    */
136cdf0e10cSrcweir    com::sun::star::uno::XCurrentContext getCurrentConnectionContext()
137cdf0e10cSrcweir        raises(com::sun::star::io::NotConnectedException);
138f9b7d013SAriel Constenla-Haile
139cdf0e10cSrcweir    /**
140cdf0e10cSrcweir        Connect to a mail service. Only one connection to a mail service
141cdf0e10cSrcweir        can be established at a time.
142f9b7d013SAriel Constenla-Haile
143cdf0e10cSrcweir        @param xConnectionContext
144cdf0e10cSrcweir        [in] an interface used to query for connection related information.
145cdf0e10cSrcweir        The context must contain the following values:
146f9b7d013SAriel Constenla-Haile        <ul>
147f9b7d013SAriel Constenla-Haile            <li>
148f9b7d013SAriel Constenla-Haile                <b>ServerName</b> of type 'string'.
149f9b7d013SAriel Constenla-Haile            </li>
150f9b7d013SAriel Constenla-Haile            <li>
151f9b7d013SAriel Constenla-Haile                <b>Port</b> of type 'long'.
152f9b7d013SAriel Constenla-Haile            </li>
153f9b7d013SAriel Constenla-Haile            <li>
154f9b7d013SAriel Constenla-Haile                <b>ConnectionType</b> of type 'string'.
155f9b7d013SAriel Constenla-Haile                A list of supported connection types can be queried using
156f9b7d013SAriel Constenla-Haile                <member>getSupportedConnectionTypes</member>.
157f9b7d013SAriel Constenla-Haile            </li>
158f9b7d013SAriel Constenla-Haile            <li>
159f9b7d013SAriel Constenla-Haile                <b>Timeout</b> of type 'long' (Optional).
160f9b7d013SAriel Constenla-Haile                Specifies a timeout in seconds for blocking operations,
161f9b7d013SAriel Constenla-Haile                like the connection attempt.
162f9b7d013SAriel Constenla-Haile            </li>
163f9b7d013SAriel Constenla-Haile        </ul>
164f9b7d013SAriel Constenla-Haile
165cdf0e10cSrcweir        @param xAuthenticator
166cdf0e10cSrcweir        [in] an interface used to query for the necessary user information
167cdf0e10cSrcweir        needed to login to the mail server. If no authentication is required
168cdf0e10cSrcweir        the xAuthenticator must return an empty user name and an empty password.
169f9b7d013SAriel Constenla-Haile
170cdf0e10cSrcweir        @throws com::sun::star::lang::IllegalArgumentException
171cdf0e10cSrcweir        if the provided connection context contains invalid values or
172cdf0e10cSrcweir        misses required connection parameters.
173f9b7d013SAriel Constenla-Haile
174cdf0e10cSrcweir        @throws com::sun::star::io::AlreadyConnectedException
175cdf0e10cSrcweir        on a try to connect to an already connect mail server.
176f9b7d013SAriel Constenla-Haile
177cdf0e10cSrcweir        @throws com::sun::star::io::UnknownHostException
178cdf0e10cSrcweir        usually if the IP address of the mail server could not be
179cdf0e10cSrcweir        determined. Possible causes are a broken network connection,
180cdf0e10cSrcweir        a wrong server name, an unreachable DNS server, etc.
181cdf0e10cSrcweir
182cdf0e10cSrcweir        @throws com::sun::star::io::NoRouteToHostException
183cdf0e10cSrcweir        if an error occured to connect to the remote mail server.
184cdf0e10cSrcweir        Typically the remote mail server cannot be reach because of an
185cdf0e10cSrcweir        intervening firewall, or if an intermediate router is down,
186cdf0e10cSrcweir        the network connection is broken, etc.
187cdf0e10cSrcweir
188cdf0e10cSrcweir        @throws com::sun::star::io::ConnectException
189cdf0e10cSrcweir        if an error occured while attempting to connect to the remote
190cdf0e10cSrcweir        mail server. Typically the connection was refused remotely,
191cdf0e10cSrcweir        because the mail server is not listening on the remote address/port.
192cdf0e10cSrcweir
193cdf0e10cSrcweir        @throws com::sun::star::auth::AuthenticationException
194cdf0e10cSrcweir        if the specified user could not be logged in.
195cdf0e10cSrcweir
196cdf0e10cSrcweir        @throws com::sun::star::mail::MailException
197cdf0e10cSrcweir        for other errors during login.
198cdf0e10cSrcweir
199cdf0e10cSrcweir        @see com::sun::star::uno::XCurrentContext
200cdf0e10cSrcweir        @see com::sun::star::mail::XAuthenticator
201cdf0e10cSrcweir        @see com::sun::star::lang::IllegalArgumentException
202cdf0e10cSrcweir        @see com::sun::star::io::AlreadyConnectedException
203cdf0e10cSrcweir        @see com::sun::star::io::UnknownHostException
204cdf0e10cSrcweir        @see com::sun::star::io::NoRouteToHostException
205cdf0e10cSrcweir        @see com::sun::star::io::ConnectException
206cdf0e10cSrcweir        @see com::sun::star::auth::AuthenticationException
207cdf0e10cSrcweir        @see com::sun::star::mail::IllegalStateException
208cdf0e10cSrcweir        @see com::sun::star::mail::MailException
209cdf0e10cSrcweir    */
210cdf0e10cSrcweir    void connect([in] com::sun::star::uno::XCurrentContext xConnectionContext, [in] XAuthenticator xAuthenticator)
211cdf0e10cSrcweir        raises(com::sun::star::lang::IllegalArgumentException,
212cdf0e10cSrcweir               com::sun::star::io::AlreadyConnectedException,
213cdf0e10cSrcweir               com::sun::star::io::UnknownHostException,
214cdf0e10cSrcweir               com::sun::star::io::NoRouteToHostException,
215cdf0e10cSrcweir               com::sun::star::io::ConnectException,
216cdf0e10cSrcweir               com::sun::star::auth::AuthenticationFailedException,
217cdf0e10cSrcweir               com::sun::star::mail::MailException);
218cdf0e10cSrcweir
219cdf0e10cSrcweir    /**
220cdf0e10cSrcweir        Disconnect from a mail service.
221cdf0e10cSrcweir
222cdf0e10cSrcweir        @throws com::sun::star::mail::MailException
223cdf0e10cSrcweir        if errors occur during disconnecting.
224cdf0e10cSrcweir    */
225cdf0e10cSrcweir    void disconnect()
226cdf0e10cSrcweir        raises(com::sun::star::mail::MailException);
227cdf0e10cSrcweir
228cdf0e10cSrcweir    /**
229cdf0e10cSrcweir        Returns whether a connection to a mail service
230cdf0e10cSrcweir        currently exist or not.
231cdf0e10cSrcweir
232cdf0e10cSrcweir        @returns
233cdf0e10cSrcweir        <TRUE/> if a connection to a mail service is established.
234cdf0e10cSrcweir    */
235cdf0e10cSrcweir    boolean isConnected();
236cdf0e10cSrcweir};
237cdf0e10cSrcweir
238cdf0e10cSrcweir}; }; }; };
239cdf0e10cSrcweir
240cdf0e10cSrcweir#endif
241