2 * $Id: handle.h 814 2007-11-14 18:39:28Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyright 2013-2022 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
, imgData
} 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:, data:] */
53 *alt
, /* image alternate text */
54 *tool
; /* program to display data: */
55 } img
; /* stuff to describe img */
56 ATTACH_S
*attach
; /* Attachment struct for this handle */
58 ATTACH_S
*attach
; /* full Calendar entry */
59 int depth
; /* which event to display */
62 int index
; /* folder's place in context's list */
63 CONTEXT_S
*context
; /* description of folders */
64 } f
; /* stuff to describe Folder handle */
66 struct { /* function and args to pass it */
71 void (*f
)(MAILSTREAM
*, MSGNO_S
*, long);
74 POSLIST_S
*loc
; /* list of places it exists in text */
75 struct handle_s
*next
, *prev
; /* next and previous in the list */
81 * Function used to dispatch locally handled URL's
83 typedef int (*url_tool_t
)(char *);
86 /* exported prototypes */
87 HANDLE_S
*get_handle(HANDLE_S
*, int);
88 void init_handles(HANDLE_S
**);
89 HANDLE_S
*new_handle(HANDLE_S
**);
90 void delete_unused_handles(HANDLE_S
**);
91 void free_handle(HANDLE_S
**);
92 void free_handles(HANDLE_S
**);
93 void free_handle_locations(POSLIST_S
**);
96 #endif /* PITH_HANDLE_INCLUDED */