* NTLM authentication support with the ntlm library, in Unix systems.
[alpine.git] / pith / ablookup.h
blob445ca28a273fdc3f063309747e4421a914a643d1
1 /*
2 * $Id: ablookup.h 1266 2009-07-14 18:39:12Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyright 2013-2017 Eduardo Chappa
6 * Copyright 2006-2008 University of Washington
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * ========================================================================
17 #ifndef PITH_ABLOOKUP_INCLUDED
18 #define PITH_ABLOOKUP_INCLUDED
21 #include "../pith/state.h"
22 #include "../pith/pattern.h"
23 #include "../pith/adrbklib.h"
24 #include "../pith/bldaddr.h"
28 * Flags to adrbk_list_of_completions().
29 * ALC_INCLUDE_ADDRS means that the "addr" element
30 * should be included in the COMPLETE_S list. When
31 * this is not set the entries that match because
32 * of an addr match are still included in the list
33 * but the actual "addr" element itself is not filled
34 * in. That isn't needed by Web Alpine and it does
35 * have a cost, though rather small, to fill it in.
37 #define ALC_INCLUDE_ADDRS 0x1
38 #define ALC_INCLUDE_LDAP 0x2
41 * Values OR'd together in matches_bitmaps.
42 * These are not in the same namespace as the flags
43 * above, these are just bits for the matches_bitmaps member.
45 * If ALC_NICK is set that means there was a prefix match on the nickname.
46 * ALC_FULL is a match on the full address.
47 * ALC_ADDR is a match on the mailbox@host part of the address.
48 * ALC_REVFULL is a match on the Last, First Fullname if the user uses that.
49 * ALC_ABOOK means the entry came from an address book entry
50 * ALC_LDAP means the entry came from an LDAP lookup
51 * ALC_CURR means the entry came from the currently viewed message
52 * This is used in both ABOOK_ENTRY_S and COMPLETE_S structures.
54 #define ALC_NICK 0x01
55 #define ALC_FULL 0x02
56 #define ALC_REVFULL 0x04
57 #define ALC_ADDR 0x08
58 #define ALC_ABOOK 0x10
59 #define ALC_LDAP 0x20
60 #define ALC_CURR 0x40
61 #define ALC_FCC 0x80
64 typedef struct abook_entry_list {
65 AdrBk *ab;
66 adrbk_cntr_t entrynum;
67 unsigned matches_bitmap;
68 struct abook_entry_list *next;
69 } ABOOK_ENTRY_S;
72 typedef struct completelist {
73 char *nickname; /* the nickname */
74 char *full_address; /* Some Body <someb@there.org> */
75 char *addr; /* someb@there.org (costs extra) */
76 char *rev_fullname; /* optional Last, First version of fullname */
77 char *fcc; /* optional fcc associated with address */
78 unsigned matches_bitmap;
79 struct completelist *next;
80 } COMPLETE_S;
83 /* exported protoypes */
84 char *get_nickname_from_addr(ADDRESS *, char *, size_t);
85 char *get_fcc_from_addr(ADDRESS *, char *, size_t);
86 int get_contactinfo_from_addr(ADDRESS *, char **, char **, char **, char **);
87 void address_in_abook(MAILSTREAM *, SEARCHSET *, int, PATTERN_S *);
88 ADDRESS *abe_to_address(AdrBk_Entry *, AddrScrn_Disp *, AdrBk *, int *);
89 char *abe_to_nick_or_addr_string(AdrBk_Entry *, AddrScrn_Disp *, int);
90 int address_is_us(ADDRESS *, struct pine *);
91 int address_is_same(ADDRESS *, ADDRESS *);
92 int abes_are_equal(AdrBk_Entry *, AdrBk_Entry *);
93 char *addr_lookup(char *, int *, int);
94 AdrBk_Entry *adrbk_lookup_with_opens_by_nick(char *, int, int *, int);
95 AdrBk_Entry *address_to_abe(ADDRESS *);
96 int contains_regex_special_chars(char *str);
97 COMPLETE_S *adrbk_list_of_completions(char *, MAILSTREAM *, imapuid_t, int);
98 COMPLETE_S *new_complete_s(char *, char *, char *, char *, char *, unsigned);
99 void free_complete_s(COMPLETE_S **);
100 ABOOK_ENTRY_S *new_abook_entry_s(AdrBk *, a_c_arg_t, unsigned);
101 void free_abook_entry_s(ABOOK_ENTRY_S **);
102 void combine_abook_entry_lists(ABOOK_ENTRY_S **, ABOOK_ENTRY_S *);
103 ABOOK_ENTRY_S *adrbk_list_of_possible_completions(AdrBk *, char *);
106 #endif /* PITH_ABLOOKUP_INCLUDED */