summaryrefslogtreecommitdiff
path: root/portland/dapi/tests/test_capabilities.c
blob: 7d1295596aab53cc3a70eeca9720f42f59a8b2d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include <stdlib.h>

#include <dapi/comm.h>
#include <dapi/calls.h>

int main()
    {
    intarr capabilities;
    int i;
    DapiConnection* conn = dapi_connectAndInit();
    if( conn == NULL )
        {
        fprintf( stderr, "Cannot connect!\n" );
        return 1;
        }
    if( dapi_Capabilities( conn, &capabilities ))
        {
        int has_mailto = 0;
        printf( "Capabilities:" );
        for( i = 0;
             i < capabilities.count;
             ++i )
            {
            printf( " %d", capabilities.data[ i ] );
            if( capabilities.data[ i ] == DAPI_COMMAND_MAILTO )
                has_mailto = 1;
            }
        printf( "\nHas mailto: %d\n", has_mailto );
        }
    else
        fprintf( stderr, "Capabilities call failed!\n" );
    dapi_close( conn );
    return 0;
    }