"Fossies" - the Fresh Open Source Software Archive

Member "evolution-mapi-3.46.1/src/libexchangemapi/e-mapi-utils.h" (2 Dec 2022, 7123 Bytes) of package /linux/misc/evolution-mapi-3.46.1.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "e-mapi-utils.h" see the Fossies "Dox" file reference documentation.

    1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
    2 /*
    3  * This program is free software; you can redistribute it and/or
    4  * modify it under the terms of the GNU Lesser General Public
    5  * License as published by the Free Software Foundation; either
    6  * version 2 of the License, or (at your option) version 3.
    7  *
    8  * This program is distributed in the hope that it will be useful,
    9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   11  * Lesser General Public License for more details.
   12  *
   13  * You should have received a copy of the GNU Lesser General Public
   14  * License along with the program; if not, see <http://www.gnu.org/licenses/>
   15  *
   16  *
   17  * Authors:
   18  *    Suman Manjunath <msuman@novell.com>
   19  *
   20  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
   21  *
   22  */
   23 
   24 #ifndef E_MAPI_UTILS_H
   25 #define E_MAPI_UTILS_H 
   26 
   27 #include <libedataserver/libedataserver.h>
   28 
   29 #include "camel-mapi-settings.h"
   30 #include "e-mapi-debug.h"
   31 #include "e-mapi-connection.h"
   32 
   33 #define e_mapi_return_client_error_if_fail(expr, _code)             \
   34     G_STMT_START {                              \
   35         if (G_LIKELY (expr)) {                      \
   36         } else {                            \
   37             g_log (G_LOG_DOMAIN,                    \
   38                 G_LOG_LEVEL_CRITICAL,               \
   39                 "file %s: line %d (%s): assertion `%s' failed", \
   40                 __FILE__, __LINE__, G_STRFUNC, #expr);      \
   41             g_set_error (error, E_CLIENT_ERROR, (_code),        \
   42                 "file %s: line %d (%s): assertion `%s' failed", \
   43                 __FILE__, __LINE__, G_STRFUNC, #expr);      \
   44             return;                         \
   45         }                               \
   46     } G_STMT_END
   47 
   48 #define e_mapi_return_data_book_error_if_fail(expr, _code)          \
   49     G_STMT_START {                              \
   50         if (G_LIKELY (expr)) {                      \
   51         } else {                            \
   52             g_log (G_LOG_DOMAIN,                    \
   53                 G_LOG_LEVEL_CRITICAL,               \
   54                 "file %s: line %d (%s): assertion `%s' failed", \
   55                 __FILE__, __LINE__, G_STRFUNC, #expr);      \
   56             g_set_error (error, E_DATA_BOOK_ERROR, (_code),     \
   57                 "file %s: line %d (%s): assertion `%s' failed", \
   58                 __FILE__, __LINE__, G_STRFUNC, #expr);      \
   59             return;                         \
   60         }                               \
   61     } G_STMT_END
   62 
   63 typedef struct _EMapiCancellableRecMutex {
   64     GRecMutex rec_mutex;
   65     GMutex cond_mutex;
   66     GCond cond;
   67 } EMapiCancellableRecMutex;
   68 
   69 void        e_mapi_cancellable_rec_mutex_init   (EMapiCancellableRecMutex *rec_mutex);
   70 void        e_mapi_cancellable_rec_mutex_clear  (EMapiCancellableRecMutex *rec_mutex);
   71 gboolean    e_mapi_cancellable_rec_mutex_lock   (EMapiCancellableRecMutex *rec_mutex,
   72                              GCancellable *cancellable,
   73                              GError **error);
   74 void        e_mapi_cancellable_rec_mutex_unlock (EMapiCancellableRecMutex *rec_mutex);
   75 
   76 gboolean    e_mapi_utils_global_lock        (GCancellable *cancellable,
   77                              GError **error);
   78 void        e_mapi_utils_global_unlock      (void);
   79 
   80 gchar *     e_mapi_util_mapi_id_to_string       (mapi_id_t id);
   81 gboolean    e_mapi_util_mapi_id_from_string     (const gchar *str, mapi_id_t *id);
   82 
   83 gconstpointer   e_mapi_util_find_SPropVal_array_propval (struct SPropValue *values, uint32_t proptag);
   84 gconstpointer   e_mapi_util_find_row_propval        (struct SRow *aRow,
   85                              uint32_t proptag);
   86 gconstpointer   e_mapi_util_find_propertyrow_propval    (struct PropertyRow_r *rRow,
   87                              uint32_t proptag);
   88 gconstpointer   e_mapi_util_find_array_propval      (struct mapi_SPropValue_array *properties,
   89                              uint32_t proptag);
   90 uint32_t    e_mapi_util_find_array_proptag      (struct mapi_SPropValue_array *properties,
   91                              uint32_t proptag);
   92 
   93 enum MAPISTATUS e_mapi_util_find_array_datetime_propval (struct timeval *tv,
   94                              struct mapi_SPropValue_array *properties,
   95                              uint32_t proptag);
   96 
   97 void        e_mapi_util_recip_entryid_generate_smtp (TALLOC_CTX *mem_ctx,
   98                              struct Binary_r *entryid,
   99                              const gchar *display_name,
  100                              const gchar *email);
  101 void        e_mapi_util_recip_entryid_generate_ex   (TALLOC_CTX *mem_ctx,
  102                              struct Binary_r *entryid,
  103                              const gchar *exchange_dn);
  104 gboolean    e_mapi_util_recip_entryid_decode    (EMapiConnection *conn,
  105                              const struct Binary_r *entyrid,
  106                              gchar **display_name,
  107                              gchar **email);
  108 gboolean    e_mapi_util_recip_entryid_decode_dn (const struct SBinary_short *entryid,
  109                              gchar **exchange_dn);
  110 gboolean    e_mapi_util_recip_entryid_equal     (const struct SBinary_short *entryid1,
  111                              const struct SBinary_short *entryid2);
  112 
  113 void        e_mapi_util_profiledata_from_settings   (EMapiProfileData *empd,
  114                              CamelMapiSettings *settings);
  115 gchar *     e_mapi_util_profile_name        (struct mapi_context *mapi_ctx,
  116                              const EMapiProfileData *empd,
  117                              gboolean migrate);
  118 gboolean    e_mapi_util_trigger_krb_auth        (const EMapiProfileData *empd,
  119                              GError **error);
  120 gboolean    e_mapi_util_trigger_krb_auth_from_settings
  121                             (CamelMapiSettings *mapi_settings,
  122                              GError **error);
  123 
  124 gboolean    e_mapi_utils_add_spropvalue     (TALLOC_CTX *mem_ctx,
  125                              struct SPropValue **values_array,
  126                              uint32_t *n_values,
  127                              uint32_t prop_tag,
  128                              gconstpointer prop_value);
  129 gboolean    e_mapi_utils_add_property       (struct mapi_SPropValue_array *properties,
  130                              uint32_t proptag,
  131                              gconstpointer propvalue,
  132                              TALLOC_CTX *mem_ctx);
  133 gboolean    e_mapi_utils_ensure_utf8_string     (uint32_t proptag,
  134                              const uint32_t *cpid,
  135                              const guint8 *buf_data,
  136                              guint32 buf_len,
  137                              gchar **out_utf8);
  138 
  139 uint32_t    e_mapi_utils_push_crc32         (uint32_t crc32,
  140                              uint8_t *bytes,
  141                              uint32_t n_bytes);
  142 
  143 struct
  144 SBinary_short * e_mapi_util_copy_sbinary_short      (const struct SBinary_short *bin);
  145 void        e_mapi_util_free_sbinary_short      (struct SBinary_short *bin);
  146 
  147 time_t      e_mapi_util_filetime_to_time_t      (const struct FILETIME *filetime);
  148 void        e_mapi_util_time_t_to_filetime      (const time_t tt,
  149                              struct FILETIME *filetime);
  150 
  151 gboolean    e_mapi_utils_propagate_cancelled_error  (const GError *mapi_error,
  152                              GError **error);
  153 
  154 gboolean    e_mapi_utils_create_mapi_context    (struct mapi_context **mapi_ctx,
  155                              GError **perror);
  156 void        e_mapi_utils_destroy_mapi_context   (struct mapi_context *mapi_ctx);
  157 
  158 gboolean    e_mapi_utils_build_last_modify_restriction  (EMapiConnection *conn,
  159                                  TALLOC_CTX *mem_ctx,
  160                                  struct mapi_SRestriction **restrictions,
  161                                  gpointer user_data, /* const time_t * */
  162                                  GCancellable *cancellable,
  163                                  GError **perror);
  164 struct FolderBasicPropertiesData
  165 {
  166     mapi_id_t fid;
  167     time_t last_modified;
  168     guint32 obj_total;
  169 };
  170 
  171 gboolean    e_mapi_utils_get_folder_basic_properties_cb (EMapiConnection *conn,
  172                                  TALLOC_CTX *mem_ctx,
  173                                  /* const */ struct mapi_SPropValue_array *properties,
  174                                  gpointer user_data, /* struct FolderBasicPropertiesData * */
  175                                  GCancellable *cancellable,
  176                                  GError **perror);
  177 gboolean    e_mapi_utils_copy_to_mapi_SPropValue        (TALLOC_CTX *mem_ctx,
  178                                  struct mapi_SPropValue *mapi_sprop, 
  179                                  struct SPropValue *sprop);
  180 
  181 void        e_mapi_utils_unref_in_thread            (GObject *object);
  182 
  183 GList *     e_mapi_utils_filter_sources_for_profile     (const GList *esources,
  184                                  const gchar *profile);
  185 
  186 ESource *   e_mapi_utils_get_source_for_folder      (const GList *esources,
  187                                  const gchar *profile,
  188                                  mapi_id_t folder_id);
  189 
  190 ESource *   e_mapi_utils_get_master_source          (const GList *esources,
  191                                  const gchar *profile);
  192 #endif