libpurple/notify.c

changeset 41231
4fd76e8dedf8
parent 40079
a37a1e349491
child 41685
ca22b00972d4
equal deleted inserted replaced
41230:a197d870fc0b 41231:4fd76e8dedf8
95 95
96 return NULL; 96 return NULL;
97 } 97 }
98 98
99 void * 99 void *
100 purple_notify_email(void *handle, const char *subject, const char *from,
101 const char *to, const char *url, PurpleNotifyCloseCallback cb,
102 gpointer user_data)
103 {
104 PurpleNotifyUiOps *ops;
105
106 ops = purple_notify_get_ui_ops();
107
108 if (ops != NULL && ops->notify_email != NULL) {
109 void *ui_handle;
110
111 purple_signal_emit(purple_notify_get_handle(), "displaying-email-notification",
112 subject, from, to, url);
113
114 ui_handle = ops->notify_email(handle, subject, from, to, url);
115
116 if (ui_handle != NULL) {
117
118 PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1);
119 info->type = PURPLE_NOTIFY_EMAIL;
120 info->handle = handle;
121 info->ui_handle = ui_handle;
122 info->cb = cb;
123 info->cb_user_data = user_data;
124
125 handles = g_list_append(handles, info);
126
127 return info->ui_handle;
128 }
129 }
130
131 if (cb != NULL)
132 cb(user_data);
133
134 return NULL;
135 }
136
137 void *
138 purple_notify_emails(void *handle, size_t count, gboolean detailed,
139 const char **subjects, const char **froms,
140 const char **tos, const char **urls,
141 PurpleNotifyCloseCallback cb, gpointer user_data)
142 {
143 PurpleNotifyUiOps *ops;
144
145 if (count == 1) {
146 return purple_notify_email(handle,
147 (subjects == NULL ? NULL : *subjects),
148 (froms == NULL ? NULL : *froms),
149 (tos == NULL ? NULL : *tos),
150 (urls == NULL ? NULL : *urls),
151 cb, user_data);
152 }
153
154 ops = purple_notify_get_ui_ops();
155
156 if (ops != NULL && ops->notify_emails != NULL) {
157 void *ui_handle;
158
159 purple_signal_emit(purple_notify_get_handle(), "displaying-emails-notification",
160 subjects, froms, tos, urls, count);
161
162 ui_handle = ops->notify_emails(handle, count, detailed, subjects,
163 froms, tos, urls);
164
165 if (ui_handle != NULL) {
166 PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1);
167 info->type = PURPLE_NOTIFY_EMAILS;
168 info->handle = handle;
169 info->ui_handle = ui_handle;
170 info->cb = cb;
171 info->cb_user_data = user_data;
172
173 handles = g_list_append(handles, info);
174
175 return info->ui_handle;
176 }
177
178 }
179
180 if (cb != NULL)
181 cb(user_data);
182
183 return NULL;
184 }
185
186 void *
187 purple_notify_formatted(void *handle, const char *title, const char *primary, 100 purple_notify_formatted(void *handle, const char *title, const char *primary,
188 const char *secondary, const char *text, 101 const char *secondary, const char *text,
189 PurpleNotifyCloseCallback cb, gpointer user_data) 102 PurpleNotifyCloseCallback cb, gpointer user_data)
190 { 103 {
191 PurpleNotifyUiOps *ops; 104 PurpleNotifyUiOps *ops;

mercurial