IMAPNotifier
The IMAPNotifier class allows you to manage IMAP IDLE notifications for a selected mailbox.
Historia
| Lanzamiento | Modificaciones |
|---|---|
| 21 R3 | Clase añadida |
The IMAPNotifier class is available from the 4D class store.
An IMAPNotifier object is associated with an IMAP transporter and provides access to mailbox notification management.
Todas las funciones de clase IMAPNotifier son hilo seguro.
Ejemplo
// Define listener callbacks
var $parameter : Object
var $transporter : 4D.IMAPTransporter
$parameter:=New object
$parameter.authenticationMode:=IMAP authentication OAUTH2
$parameter.host:="Outlook.office365.com"
$parameter.port:=993
$parameter.accessTokenOAuth2:=$myToken
$parameter.user:="myaddress@email.com"
$parameter.listener:=cs.IMAPListener.new()
$transporter:=IMAP New transporter($parameter)
$transporter.selectBox("INBOX")
$transporter.notifier.start()
IMAPNotifier object
Un objeto IMAPNotifier proporciona las siguientes propiedades y funciones:
| .isStarted : Boolean indicates whether the notifier is started ( true) or stopped (false) |
| .start() : Object starts the subscription to server notifications and activates IMAP listener callbacks |
| .stop() : Object stops the notification subscription |
4D.IMAPNotifier.new()
4D.IMAPNotifier.new() : 4D.IMAPNotifier
| Parámetros | Tipo | Descripción | |
|---|---|---|---|
| Resultado | 4D.IMAPNotifier | <- | Nuevo objeto IMAPNotifier |
Descripción
La función 4D.IMAPNotifier.new() crea un nuevo objeto IMAPNotifier.
.isStarted
.isStarted : Boolean
Descripción
The .isStarted property indicates whether the notifier is started (true) or stopped (false). Esta propiedad es de solo lectura.
.start()
.start() : Object
| Parámetros | Tipo | Descripción | |
|---|---|---|---|
| Resultado | Object | <- | Estado de la operación |
Descripción
The .start() function starts the subscription to server notifications and activates IMAP listener callbacks.
Debe seleccionarse un buzón mediante selectBox() antes de llamar a .start().
Callback functions are executed in the worker where .start() is called.
-
Cuando se inicia el notificador, otras funciones del transportador (como
getMail()osend()) no están disponibles. You must call.stop()before using these functions, then call.start()again to resume notifications. -
IMAP IDLE notifications indicate that a change has occurred but do not provide updated mailbox data. Para actualizar el estado del buzón, debe detener el aviso, recuperar los datos actualizados (por ejemplo usando
getMail()), y luego reiniciarlo.
Objeto devuelto
| Propiedad | Tipo | Descripción | |
|---|---|---|---|
| success | Boolean | True si la operación tiene éxito, False en caso contrario | |
| statusText | Text | Mensaje de estado devuelto por el servidor IMAP, o último error devuelto en la pila de errores 4D | |
| errors | Collection | Pila de error 4D (no retornado si se recibe una respuesta del servidor) | |
| [].errcode | Number | Código de error 4D | |
| [].message | Text | Descripción del error | |
| [].componentSignature | Text | Firma del componente que ha devuelto el error |
.stop()
.stop() : Object
| Parámetros | Tipo | Descripción | |
|---|---|---|---|
| Resultado | Object | <- | Estado de la operación |
Descripción
The .stop() function stops the notification subscription. Calling .stop() is required before using other transporter functions (such as getMail() or send()).
Objeto devuelto
| Propiedad | Tipo | Descripción | |
|---|---|---|---|
| success | Boolean | True si la operación tiene éxito, False en caso contrario | |
| statusText | Text | Mensaje de estado devuelto por el servidor IMAP, o último error devuelto en la pila de errores 4D | |
| errors | Collection | Pila de error 4D (no retornado si se recibe una respuesta del servidor) | |
| [].errcode | Number | Código de error 4D | |
| [].message | Text | Descripción del error | |
| [].componentSignature | Text | Firma del componente que ha devuelto el error |