Wed, 23 Apr 2008 02:29:39 +0000
Use the same fix for Purple::Util::fetch_url (from 4b6378d5e) for
Purple::Request:: functions as well. This allows the callbacks to be
specified both as coderefs or as strings (name of the callback function).
| 11118 | 1 | #include "module.h" |
| 2 | ||
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
3 | MODULE = Purple::Prefs PACKAGE = Purple::Prefs PREFIX = purple_prefs_ |
| 11118 | 4 | PROTOTYPES: ENABLE |
| 5 | ||
|
16773
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
6 | BOOT: |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
7 | { |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
8 | HV *stash = gv_stashpv("Purple::Pref::Type", 1); |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
9 | |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
10 | static const constiv *civ, const_iv[] = { |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
11 | #define const_iv(name) {#name, (IV)PURPLE_PREF_##name} |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
12 | const_iv(NONE), |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
13 | const_iv(BOOLEAN), |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
14 | const_iv(INT), |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
15 | const_iv(STRING), |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
16 | const_iv(STRING_LIST), |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
17 | const_iv(PATH), |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
18 | const_iv(PATH_LIST), |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
19 | }; |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
20 | |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
21 | for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
22 | newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
23 | } |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
24 | |
| 12780 | 25 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
26 | purple_prefs_add_bool(name, value) |
| 11118 | 27 | const char *name |
| 28 | gboolean value | |
| 29 | ||
| 12780 | 30 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
31 | purple_prefs_add_int(name, value) |
| 11118 | 32 | const char *name |
| 33 | int value | |
| 34 | ||
| 12780 | 35 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
36 | purple_prefs_add_none(name) |
| 11118 | 37 | const char *name |
| 38 | ||
| 12780 | 39 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
40 | purple_prefs_add_string(name, value) |
| 11118 | 41 | const char *name |
| 42 | const char *value | |
| 43 | ||
| 12780 | 44 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
45 | purple_prefs_add_string_list(name, value) |
| 11118 | 46 | const char *name |
| 47 | SV *value | |
| 48 | PREINIT: | |
| 12780 | 49 | GList *t_GL; |
| 50 | int i, t_len; | |
| 11118 | 51 | PPCODE: |
| 12780 | 52 | t_GL = NULL; |
| 53 | t_len = av_len((AV *)SvRV(value)); | |
| 11118 | 54 | |
| 12780 | 55 | for (i = 0; i < t_len; i++) { |
| 56 | STRLEN t_sl; | |
| 57 | t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(value), i, 0), t_sl)); | |
| 58 | } | |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
59 | purple_prefs_add_string_list(name, t_GL); |
|
21737
fa92350ed598
applied changes from 8d953d5714cb202c5fa66fda1b0f31f01a969622
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17283
diff
changeset
|
60 | g_list_free(t_GL); |
| 11118 | 61 | |
| 12780 | 62 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
63 | purple_prefs_destroy() |
| 11118 | 64 | |
| 12780 | 65 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
66 | purple_prefs_disconnect_by_handle(handle) |
| 12780 | 67 | void * handle |
| 11118 | 68 | |
| 12780 | 69 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
70 | purple_prefs_disconnect_callback(callback_id) |
| 11118 | 71 | guint callback_id |
| 72 | ||
| 12780 | 73 | gboolean |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
74 | purple_prefs_exists(name) |
| 11118 | 75 | const char *name |
| 76 | ||
| 12780 | 77 | gboolean |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
78 | purple_prefs_get_bool(name) |
| 11118 | 79 | const char *name |
| 80 | ||
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
81 | Purple::Handle |
|
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
82 | purple_prefs_get_handle() |
| 11118 | 83 | |
| 12780 | 84 | int |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
85 | purple_prefs_get_int(name) |
| 11118 | 86 | const char *name |
| 87 | ||
| 88 | const char * | |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
89 | purple_prefs_get_string(name) |
| 11118 | 90 | const char *name |
| 91 | ||
| 92 | void | |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
93 | purple_prefs_get_string_list(name) |
| 11118 | 94 | const char *name |
| 95 | PREINIT: | |
| 12780 | 96 | GList *l; |
| 11118 | 97 | PPCODE: |
|
17283
ceb0e3374ddf
Plug a few more memory leaks for some perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17282
diff
changeset
|
98 | for (l = purple_prefs_get_string_list(name); l != NULL; l = g_list_delete_link(l, l)) { |
|
17282
7d015f747d02
Fix _prefs_get_string_list for perl.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16773
diff
changeset
|
99 | XPUSHs(sv_2mortal(newSVpv(l->data, 0))); |
|
17283
ceb0e3374ddf
Plug a few more memory leaks for some perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17282
diff
changeset
|
100 | g_free(l->data); |
| 12780 | 101 | } |
| 11118 | 102 | |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
103 | Purple::PrefType |
|
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
104 | purple_prefs_get_type(name) |
| 11118 | 105 | const char *name |
| 106 | ||
| 12780 | 107 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
108 | purple_prefs_init() |
| 11118 | 109 | |
| 12780 | 110 | gboolean |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
111 | purple_prefs_load() |
| 11118 | 112 | |
| 12780 | 113 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
114 | purple_prefs_remove(name) |
| 11118 | 115 | const char *name |
| 116 | ||
| 12780 | 117 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
118 | purple_prefs_rename(oldname, newname) |
| 11118 | 119 | const char *oldname |
| 120 | const char *newname | |
| 121 | ||
| 12780 | 122 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
123 | purple_prefs_rename_boolean_toggle(oldname, newname) |
| 11118 | 124 | const char *oldname |
| 125 | const char *newname | |
| 126 | ||
| 12780 | 127 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
128 | purple_prefs_set_bool(name, value) |
| 11118 | 129 | const char *name |
| 130 | gboolean value | |
| 131 | ||
| 12780 | 132 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
133 | purple_prefs_set_generic(name, value) |
| 11118 | 134 | const char *name |
| 135 | gpointer value | |
| 136 | ||
| 12780 | 137 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
138 | purple_prefs_set_int(name, value) |
| 11118 | 139 | const char *name |
| 140 | int value | |
| 141 | ||
| 12780 | 142 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
143 | purple_prefs_set_string(name, value) |
| 11118 | 144 | const char *name |
| 145 | const char *value | |
| 146 | ||
| 12780 | 147 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
148 | purple_prefs_set_string_list(name, value) |
| 11118 | 149 | const char *name |
| 150 | SV *value | |
| 151 | PREINIT: | |
| 12780 | 152 | GList *t_GL; |
| 153 | int i, t_len; | |
| 11118 | 154 | PPCODE: |
| 12780 | 155 | t_GL = NULL; |
| 156 | t_len = av_len((AV *)SvRV(value)); | |
| 11118 | 157 | |
| 12780 | 158 | for (i = 0; i < t_len; i++) { |
| 159 | STRLEN t_sl; | |
| 160 | t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(value), i, 0), t_sl)); | |
| 161 | } | |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
162 | purple_prefs_set_string_list(name, t_GL); |
|
21737
fa92350ed598
applied changes from 8d953d5714cb202c5fa66fda1b0f31f01a969622
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17283
diff
changeset
|
163 | g_list_free(t_GL); |
| 11118 | 164 | |
| 12780 | 165 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
166 | purple_prefs_trigger_callback(name) |
| 11118 | 167 | const char *name |
| 168 | ||
| 12780 | 169 | void |
|
22835
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
170 | purple_prefs_get_children_names(name) |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
171 | const char *name |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
172 | PREINIT: |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
173 | GList *l; |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
174 | PPCODE: |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
175 | for (l = purple_prefs_get_children_names(name); l != NULL; l = g_list_delete_link(l, l)) { |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
176 | XPUSHs(sv_2mortal(newSVpv(l->data, 0))); |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
177 | g_free(l->data); |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
178 | } |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
179 | |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
180 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
181 | purple_prefs_uninit() |
| 11118 | 182 | |
| 12780 | 183 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
184 | purple_prefs_update_old() |