1 #include "module.h"
2 
3 MODULE = Purple::Notify  PACKAGE = Purple::Notify  PREFIX = purple_notify_
4 PROTOTYPES: ENABLE
5 
6 BOOT:
7 {
8 	HV *type_stash = gv_stashpv("Purple::Notify::Type", 1);
9 	HV *msg_type_stash = gv_stashpv("Purple::Notify::Msg", 1);
10 	HV *user_info_stash = gv_stashpv("Purple::NotifyUserInfo::Type", 1);
11 
12 	static const constiv *civ, type_const_iv[] = {
13 #define const_iv(name) {#name, (IV)PURPLE_NOTIFY_##name}
14 		const_iv(MESSAGE),
15 		const_iv(EMAIL),
16 		const_iv(EMAILS),
17 		const_iv(FORMATTED),
18 		const_iv(SEARCHRESULTS),
19 		const_iv(USERINFO),
20 		const_iv(URI),
21 	};
22 	static const constiv msg_type_const_iv[] = {
23 #undef const_iv
24 #define const_iv(name) {#name, (IV)PURPLE_NOTIFY_MSG_##name}
25 		const_iv(ERROR),
26 		const_iv(WARNING),
27 		const_iv(INFO),
28 	};
29 	static const constiv user_info_const_iv[] = {
30 #undef const_iv
31 #define const_iv(name) {#name, (IV)PURPLE_NOTIFY_USER_INFO_ENTRY_##name}
32 		const_iv(PAIR),
33 		const_iv(SECTION_BREAK),
34 		const_iv(SECTION_HEADER),
35 	};
36 
37 	for (civ = type_const_iv + sizeof(type_const_iv) / sizeof(type_const_iv[0]); civ-- > type_const_iv; )
38 		newCONSTSUB(type_stash, (char *)civ->name, newSViv(civ->iv));
39 
40 	for (civ = msg_type_const_iv + sizeof(msg_type_const_iv) / sizeof(msg_type_const_iv[0]); civ-- > msg_type_const_iv; )
41 		newCONSTSUB(msg_type_stash, (char *)civ->name, newSViv(civ->iv));
42 
43 	for (civ = user_info_const_iv + sizeof(user_info_const_iv) / sizeof(user_info_const_iv[0]); civ-- > user_info_const_iv; )
44 		newCONSTSUB(user_info_stash, (char *)civ->name, newSViv(civ->iv));
45 }
46 
47 void
48 purple_notify_close(type, ui_handle)
49 	Purple::NotifyType type
50 	void * ui_handle
51 
52 void
53 purple_notify_close_with_handle(handle)
54 	void * handle
55 
56 void *
57 purple_notify_email(handle, subject, from, to, url, cb, user_data)
58 	void * handle
59 	const char *subject
60 	const char *from
61 	const char *to
62 	const char *url
63 	Purple::NotifyCloseCallback cb
64 	gpointer user_data
65 
66 void *
67 purple_notify_emails(handle, count, detailed, subjects, froms, tos, urls, cb, user_data)
68 	void * handle
69 	size_t count
70 	gboolean detailed
71 	const char **subjects
72 	const char **froms
73 	const char **tos
74 	const char **urls
75 	Purple::NotifyCloseCallback cb
76 	gpointer user_data
77 
78 void *
79 purple_notify_formatted(handle, title, primary, secondary, text, cb, user_data)
80 	void * handle
81 	const char *title
82 	const char *primary
83 	const char *secondary
84 	const char *text
85 	Purple::NotifyCloseCallback cb
86 	gpointer user_data
87 
88 void *
89 purple_notify_userinfo(gc, who, user_info, cb, user_data)
90 	Purple::Connection gc
91 	const char *who
92 	Purple::NotifyUserInfo user_info
93 	Purple::NotifyCloseCallback cb
94 	gpointer user_data
95 
96 void *
97 purple_notify_message(handle, type, title, primary, secondary, cb, user_data)
98 	void * handle
99 	Purple::NotifyMsgType type
100 	const char *title
101 	const char *primary
102 	const char *secondary
103 	Purple::NotifyCloseCallback cb
104 	gpointer user_data
105 
106 void *
107 purple_notify_searchresults(gc, title, primary, secondary, results, cb, user_data)
108 	Purple::Connection gc
109 	const char *title
110 	const char *primary
111 	const char *secondary
112 	Purple::NotifySearchResults results
113 	Purple::NotifyCloseCallback cb
114 	gpointer user_data
115 
116 void *
117 purple_notify_uri(handle, uri)
118 	void * handle
119 	const char *uri
120 
121 MODULE = Purple::Notify  PACKAGE = Purple::NotifyUserInfo  PREFIX = purple_notify_user_info_
122 PROTOTYPES: ENABLE
123 
124 Purple::NotifyUserInfo
125 purple_notify_user_info_new(class)
126 	C_ARGS: /* void */
127 
128 void
129 purple_notify_user_info_destroy(user_info)
130 	Purple::NotifyUserInfo user_info
131 
132 void
133 purple_notify_user_info_get_entries(user_info)
134 	Purple::NotifyUserInfo user_info
135 PREINIT:
136 	GList *l;
137 PPCODE:
138 	l = purple_notify_user_info_get_entries(user_info);
139 	for (; l != NULL; l = l->next) {
140 		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::NotifyUserInfoEntry")));
141 	}
142 
143 gchar_own *
144 purple_notify_user_info_get_text_with_newline(user_info, newline)
145 	Purple::NotifyUserInfo user_info
146 	const char *newline
147 
148 void purple_notify_user_info_add_pair(user_info, label, value)
149 	Purple::NotifyUserInfo user_info
150 	const char *label
151 	const char *value
152 
153 void purple_notify_user_info_prepend_pair(user_info, label, value)
154 	Purple::NotifyUserInfo user_info
155 	const char *label
156 	const char *value
157 
158 void purple_notify_user_info_add_section_break(user_info)
159 	Purple::NotifyUserInfo user_info
160 
161 void purple_notify_user_info_add_section_header(user_info, label)
162 	Purple::NotifyUserInfo user_info
163 	const char *label
164 
165 void purple_notify_user_info_remove_last_item(user_info)
166 	Purple::NotifyUserInfo user_info
167 
168 const gchar *
169 purple_notify_user_info_entry_get_label(user_info_entry)
170 	Purple::NotifyUserInfoEntry user_info_entry
171 
172 const gchar *
173 purple_notify_user_info_entry_get_value(user_info_entry)
174 	Purple::NotifyUserInfoEntry user_info_entry
175