comparison libpurple/plugins/perl/common/Conversation.xs @ 16739:39c7bb133a9f

Remove the const-c and const-xs stuff and replace it with real constants exposed to perl.
author Etan Reisner <pidgin@unreliablesource.net>
date Tue, 01 May 2007 02:34:22 +0000
parents 2f8274ce570a
children 1724f68245af
comparison
equal deleted inserted replaced
16700:79bc35a19de5 16739:39c7bb133a9f
1 #include "module.h" 1 #include "module.h"
2 2
3 MODULE = Purple::Conversation PACKAGE = Purple PREFIX = purple_ 3 MODULE = Purple::Conversation PACKAGE = Purple PREFIX = purple_
4 PROTOTYPES: ENABLE 4 PROTOTYPES: ENABLE
5
6 BOOT:
7 {
8 HV *type_stash = gv_stashpv("Purple::Conversation::Type", 1);
9 HV *update_stash = gv_stashpv("Purple::Conversation::Update::Type", 1);
10 HV *typing_stash = gv_stashpv("Purple::Conversation::TypingState", 1);
11 HV *flags_stash = gv_stashpv("Purple::Conversation::Flags", 1);
12 HV *cbflags_stash = gv_stashpv("Purple::Conversation::ChatBuddy::Flags", 1);
13
14 static const constiv *civ, type_const_iv[] = {
15 #define const_iv(name) {#name, (IV)PURPLE_CONV_TYPE_##name}
16 const_iv(UNKNOWN),
17 const_iv(IM),
18 const_iv(CHAT),
19 const_iv(MISC),
20 const_iv(ANY),
21 };
22 static const constiv update_const_iv[] = {
23 #undef const_iv
24 #define const_iv(name) {#name, (IV)PURPLE_CONV_UPDATE_##name}
25 const_iv(ADD),
26 const_iv(REMOVE),
27 const_iv(ACCOUNT),
28 const_iv(TYPING),
29 const_iv(UNSEEN),
30 const_iv(LOGGING),
31 const_iv(TOPIC),
32 /*
33 const_iv(ONLINE),
34 const_iv(OFFLINE),
35 */
36 const_iv(AWAY),
37 const_iv(ICON),
38 const_iv(TITLE),
39 const_iv(CHATLEFT),
40 const_iv(FEATURES),
41 };
42 static const constiv typing_const_iv[] = {
43 #undef const_iv
44 #define const_iv(name) {#name, (IV)PURPLE_##name}
45 const_iv(NOT_TYPING),
46 const_iv(TYPING),
47 const_iv(TYPED),
48 };
49 static const constiv flags_const_iv[] = {
50 #undef const_iv
51 #define const_iv(name) {#name, (IV)PURPLE_MESSAGE_##name}
52 const_iv(SEND),
53 const_iv(RECV),
54 const_iv(SYSTEM),
55 const_iv(AUTO_RESP),
56 const_iv(ACTIVE_ONLY),
57 const_iv(NICK),
58 const_iv(NO_LOG),
59 const_iv(WHISPER),
60 const_iv(ERROR),
61 const_iv(DELAYED),
62 const_iv(RAW),
63 const_iv(IMAGES),
64 const_iv(NOTIFY),
65 };
66 static const constiv cbflags_const_iv[] = {
67 #undef const_iv
68 #define const_iv(name) {#name, (IV)PURPLE_CBFLAGS_##name}
69 const_iv(NONE),
70 const_iv(VOICE),
71 const_iv(HALFOP),
72 const_iv(OP),
73 const_iv(FOUNDER),
74 const_iv(TYPING),
75 };
76
77 for (civ = type_const_iv + sizeof(type_const_iv) / sizeof(type_const_iv[0]); civ-- > type_const_iv; )
78 newCONSTSUB(type_stash, (char *)civ->name, newSViv(civ->iv));
79
80 for (civ = update_const_iv + sizeof(update_const_iv) / sizeof(update_const_iv[0]); civ-- > update_const_iv; )
81 newCONSTSUB(update_stash, (char *)civ->name, newSViv(civ->iv));
82
83 for (civ = typing_const_iv + sizeof(typing_const_iv) / sizeof(typing_const_iv[0]); civ-- > typing_const_iv; )
84 newCONSTSUB(typing_stash, (char *)civ->name, newSViv(civ->iv));
85
86 for (civ = flags_const_iv + sizeof(flags_const_iv) / sizeof(flags_const_iv[0]); civ-- > flags_const_iv; )
87 newCONSTSUB(flags_stash, (char *)civ->name, newSViv(civ->iv));
88
89 for (civ = cbflags_const_iv + sizeof(cbflags_const_iv) / sizeof(cbflags_const_iv[0]); civ-- > cbflags_const_iv; )
90 newCONSTSUB(cbflags_stash, (char *)civ->name, newSViv(civ->iv));
91 }
5 92
6 void 93 void
7 purple_get_ims() 94 purple_get_ims()
8 PREINIT: 95 PREINIT:
9 GList *l; 96 GList *l;