(address_get_nth): New function. Get Nth subaddress from an address.
Showing
2 changed files
with
12 additions
and
0 deletions
... | @@ -33,6 +33,8 @@ extern address_t address_dup __P ((address_t src)); | ... | @@ -33,6 +33,8 @@ extern address_t address_dup __P ((address_t src)); |
33 | /* Set FROM to null, after adding its addresses to TO. */ | 33 | /* Set FROM to null, after adding its addresses to TO. */ |
34 | extern int address_concatenate __P ((address_t to, address_t* from)); | 34 | extern int address_concatenate __P ((address_t to, address_t* from)); |
35 | 35 | ||
36 | extern int address_get_nth | ||
37 | __P ((address_t addr, size_t no, address_t *pret)); | ||
36 | extern int address_get_email | 38 | extern int address_get_email |
37 | __P ((address_t, size_t, char *, size_t, size_t *)); | 39 | __P ((address_t, size_t, char *, size_t, size_t *)); |
38 | extern int address_get_local_part | 40 | extern int address_get_local_part | ... | ... |
... | @@ -202,6 +202,16 @@ _address_get_nth (address_t addr, size_t no) | ... | @@ -202,6 +202,16 @@ _address_get_nth (address_t addr, size_t no) |
202 | } | 202 | } |
203 | 203 | ||
204 | int | 204 | int |
205 | address_get_nth (address_t addr, size_t no, address_t *pret) | ||
206 | { | ||
207 | address_t subaddr = _address_get_nth (addr, no); | ||
208 | if (!subaddr) | ||
209 | return ENOENT; | ||
210 | *pret = address_dup (subaddr); | ||
211 | return 0; | ||
212 | } | ||
213 | |||
214 | int | ||
205 | address_get_personal (address_t addr, size_t no, char *buf, size_t len, | 215 | address_get_personal (address_t addr, size_t no, char *buf, size_t len, |
206 | size_t * n) | 216 | size_t * n) |
207 | { | 217 | { | ... | ... |
-
Please register or sign in to post a comment