2 * $Id: handle.h 814 2007-11-14 18:39:28Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyright 2013-2021 Eduardo Chappa
6 * Copyright 2006-2007 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_HANDLE_INCLUDED
18 #define PITH_HANDLE_INCLUDED
21 #include "../pith/context.h"
22 #include "../pith/msgno.h"
23 #include "../pith/atttype.h"
24 #include "../pith/util.h"
25 #include "../pith/icaltype.h"
27 typedef struct screen_position_list
{
29 struct screen_position_list
*next
;
34 * Struct to help manage embedded urls (and anythin' else we might embed)
36 typedef struct handle_s
{
37 int key
; /* tag number embedded in text */
38 enum {URL
, iCal
, Attach
, Folder
, Function
, IMG
} type
;
39 unsigned force_display
:1; /* Don't ask before launching */
40 unsigned using_is_used
:1; /* bit below is being used */
41 unsigned is_used
:1; /* if not, remove it from list */
42 unsigned color_unseen
:1; /* we're coloring folders with unseen */
43 unsigned color_folder
:1; /* and just folders for that matter... */
44 unsigned is_dual_do_open
:1; /* choosing this handle means open */
46 struct { /* URL corresponding to this handle */
47 char *path
, /* Actual url string */
48 *tool
, /* displaying application */
49 *name
; /* URL's NAME attribute */
50 } url
; /* stuff to describe URL handle */
52 char *src
, /* src of image (CID: only?) */
53 *alt
; /* image alternate text */
54 } img
; /* stuff to describe img */
55 ATTACH_S
*attach
; /* Attachment struct for this handle */
57 ATTACH_S
*attach
; /* full Calendar entry */
58 int depth
; /* which event to display */
61 int index
; /* folder's place in context's list */
62 CONTEXT_S
*context
; /* description of folders */
63 } f
; /* stuff to describe Folder handle */
65 struct { /* function and args to pass it */
70 void (*f
)(MAILSTREAM
*, MSGNO_S
*, long);
73 POSLIST_S
*loc
; /* list of places it exists in text */
74 struct handle_s
*next
, *prev
; /* next and previous in the list */
80 * Function used to dispatch locally handled URL's
82 typedef int (*url_tool_t
)(char *);
85 /* exported prototypes */
86 HANDLE_S
*get_handle(HANDLE_S
*, int);
87 void init_handles(HANDLE_S
**);
88 HANDLE_S
*new_handle(HANDLE_S
**);
89 void delete_unused_handles(HANDLE_S
**);
90 void free_handle(HANDLE_S
**);
91 void free_handles(HANDLE_S
**);
92 void free_handle_locations(POSLIST_S
**);
95 #endif /* PITH_HANDLE_INCLUDED */