libpurple/plugins/perl/common/Cmds.xs

Thu, 30 Oct 2008 22:40:49 +0000

author
Richard Laager <rlaager@pidgin.im>
date
Thu, 30 Oct 2008 22:40:49 +0000
changeset 24569
5dbd0617a27d
parent 21737
fa92350ed598
child 36545
23b59a16c808
permissions
-rw-r--r--

Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
to detect when we're still using deprecated functions internally (and by
extension, when we've deprecated something we shouldn't have). In the
course of developing this changeset, I fixed a few such cases.

Given that the plan is to switch from PURPLE_HIDE_STRUCTS to
PURPLE_DISABLE_DEPRECATED as each struct is fully dealt with, this will
also ensure we have no regressions on the struct hiding work.

Deprecated functions are still available to the respective .c file, to
avoid missing prototype errors. Also, Perl and DBus undef the
*_DISABLE_DEPRECATED defines as appropriate so that deprecated functions
will still be exported to Perl plugins and via DBus. (Otherwise, we'd
be breaking backwards compatibility.)

11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
1 #include "module.h"
12882
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
2 #include "../perl-handlers.h"
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
3
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
4 MODULE = Purple::Cmd PACKAGE = Purple::Cmd PREFIX = purple_cmd_
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
5 PROTOTYPES: ENABLE
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
6
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
7 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
8 {
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 HV *status_stash = gv_stashpv("Purple::Cmd::Status", 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
10 HV *ret_stash = gv_stashpv("Purple::Cmd::Return", 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
11 HV *p_stash = gv_stashpv("Purple::Cmd::Priority", 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
12 HV *flag_stash = gv_stashpv("Purple::Cmd::Flag", 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
13
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 static const constiv *civ, status_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
15 #define const_iv(name) {#name, (IV)PURPLE_CMD_STATUS_##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
16 const_iv(OK),
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(FAILED),
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(NOT_FOUND),
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 const_iv(WRONG_ARGS),
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 const_iv(WRONG_PRPL),
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 const_iv(WRONG_TYPE),
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 };
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 static const constiv ret_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
24 #undef 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
25 #define const_iv(name) {#name, (IV)PURPLE_CMD_RET_##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
26 const_iv(OK),
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
27 const_iv(FAILED),
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
28 const_iv(CONTINUE),
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
29 };
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
30 static const constiv p_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
31 #undef 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
32 #define const_iv(name) {#name, (IV)PURPLE_CMD_P_##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
33 const_iv(VERY_LOW),
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
34 const_iv(LOW),
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
35 const_iv(DEFAULT),
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
36 const_iv(PRPL),
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
37 const_iv(PLUGIN),
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
38 const_iv(ALIAS),
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
39 const_iv(HIGH),
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
40 const_iv(VERY_HIGH),
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
41 };
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
42 static const constiv flag_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
43 #undef 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
44 #define const_iv(name) {#name, (IV)PURPLE_CMD_FLAG_##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
45 const_iv(IM),
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
46 const_iv(CHAT),
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
47 const_iv(PRPL_ONLY),
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
48 const_iv(ALLOW_WRONG_ARGS),
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
49 };
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
50
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
51 for (civ = status_const_iv + sizeof(status_const_iv) / sizeof(status_const_iv[0]); civ-- > status_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
52 newCONSTSUB(status_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
53
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
54 for (civ = ret_const_iv + sizeof(ret_const_iv) / sizeof(ret_const_iv[0]); civ-- > ret_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
55 newCONSTSUB(ret_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
56
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
57 for (civ = p_const_iv + sizeof(p_const_iv) / sizeof(p_const_iv[0]); civ-- > p_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
58 newCONSTSUB(p_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
59
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
60 for (civ = flag_const_iv + sizeof(flag_const_iv) / sizeof(flag_const_iv[0]); civ-- > flag_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
61 newCONSTSUB(flag_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
62 }
e1171eb45f07 Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents: 15894
diff changeset
63
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
64 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
65 purple_cmd_help(conv, command)
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::Conversation conv
12882
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
67 const gchar *command
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
68 PREINIT:
21737
fa92350ed598 applied changes from 8d953d5714cb202c5fa66fda1b0f31f01a969622
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16773
diff changeset
69 GList *l, *ll;
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
70 PPCODE:
21737
fa92350ed598 applied changes from 8d953d5714cb202c5fa66fda1b0f31f01a969622
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16773
diff changeset
71 for (l = ll = purple_cmd_help(conv, command); l != NULL; l = l->next) {
12892
aa322da897d6 [gaim-migrate @ 15245]
Etan Reisner <deryni@pidgin.im>
parents: 12882
diff changeset
72 XPUSHs(sv_2mortal(newSVpv(l->data, 0)));
12882
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
73 }
21737
fa92350ed598 applied changes from 8d953d5714cb202c5fa66fda1b0f31f01a969622
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16773
diff changeset
74 g_list_free(ll);
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
75
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
76 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
77 purple_cmd_list(conv)
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::Conversation conv
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
79 PREINIT:
21737
fa92350ed598 applied changes from 8d953d5714cb202c5fa66fda1b0f31f01a969622
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16773
diff changeset
80 GList *l, *ll;
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
81 PPCODE:
21737
fa92350ed598 applied changes from 8d953d5714cb202c5fa66fda1b0f31f01a969622
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16773
diff changeset
82 for (l = ll = purple_cmd_list(conv); l != NULL; l = l->next) {
12892
aa322da897d6 [gaim-migrate @ 15245]
Etan Reisner <deryni@pidgin.im>
parents: 12882
diff changeset
83 XPUSHs(sv_2mortal(newSVpv(l->data, 0)));
12882
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
84 }
21737
fa92350ed598 applied changes from 8d953d5714cb202c5fa66fda1b0f31f01a969622
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16773
diff changeset
85 g_list_free(ll);
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
86
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
87 Purple::Cmd::Id
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
88 purple_cmd_register(plugin, command, args, priority, flag, prpl_id, func, helpstr, data = 0)
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::Plugin plugin
12882
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
90 const gchar *command
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
91 const gchar *args
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
92 Purple::Cmd::Priority priority
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::Cmd::Flag flag
12882
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
94 const gchar *prpl_id
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
95 SV *func
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
96 const gchar *helpstr
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
97 SV *data
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
98 CODE:
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
99 RETVAL = purple_perl_cmd_register(plugin, command, args, priority, flag,
12882
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
100 prpl_id, func, helpstr, data);
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
101 OUTPUT:
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
102 RETVAL
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
103
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
104 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
105 purple_cmd_unregister(id)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
106 Purple::Cmd::Id id
12882
44dfc6467081 [gaim-migrate @ 15234]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
107 CODE:
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_perl_cmd_unregister(id);

mercurial