Merge branch 'ical'
[alpine.git] / pith / handle.h
blobb1bf58764eca4b7b9fd8e42e709512ebb922502e
1 /*
2 * $Id: handle.h 814 2007-11-14 18:39:28Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyright 2013-2017 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"
27 typedef struct screen_position_list {
28 Pos where;
29 struct screen_position_list *next;
30 } POSLIST_S;
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, 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 */
45 union {
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 */
51 struct {
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 */
56 struct {
57 int index; /* folder's place in context's list */
58 CONTEXT_S *context; /* description of folders */
59 } f; /* stuff to describe Folder handle */
60 struct {
61 struct { /* function and args to pass it */
62 MAILSTREAM *stream;
63 MSGNO_S *msgmap;
64 long msgno;
65 } args;
66 void (*f)(MAILSTREAM *, MSGNO_S *, long);
67 } func;
68 } h;
69 POSLIST_S *loc; /* list of places it exists in text */
70 struct handle_s *next, *prev; /* next and previous in the list */
71 } HANDLE_S ;
76 * Function used to dispatch locally handled URL's
78 typedef int (*url_tool_t)(char *);
81 /* exported protoypes */
82 HANDLE_S *get_handle(HANDLE_S *, int);
83 void init_handles(HANDLE_S **);
84 HANDLE_S *new_handle(HANDLE_S **);
85 void delete_unused_handles(HANDLE_S **);
86 void free_handle(HANDLE_S **);
87 void free_handles(HANDLE_S **);
88 void free_handle_locations(POSLIST_S **);
91 #endif /* PITH_HANDLE_INCLUDED */