libpurple/plugins/perl/common/Roomlist.xs

Wed, 13 May 2009 20:29:03 +0000

author
Marcus Lundblad <malu@pidgin.im>
date
Wed, 13 May 2009 20:29:03 +0000
changeset 27110
05ca719b901b
parent 25122
56e73606e2b2
child 34931
6ea8ce77ec34
permissions
-rw-r--r--

Support custom smileys in MUCs (when all participants support BoB and a maximum
of 10 participants are in the chat).
Always announce support for BoB, since disable custom smileys will still turn
off fetching them, and BoB can be used for other purposes further on.

11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
1 #include "module.h"
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
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::Roomlist PACKAGE = Purple::Roomlist PREFIX = purple_roomlist_
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
4 PROTOTYPES: ENABLE
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
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 *room_stash = gv_stashpv("Purple::Roomlist::Room::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 HV *field_stash = gv_stashpv("Purple::Roomlist::Field::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
10
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 static const constiv *civ, room_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
12 #define const_iv(name) {#name, (IV)PURPLE_ROOMLIST_ROOMTYPE_##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
13 const_iv(CATEGORY),
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(ROOM),
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 };
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 static const constiv field_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
17 #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
18 #define const_iv(name) {#name, (IV)PURPLE_ROOMLIST_FIELD_##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
19 const_iv(BOOL),
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(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
21 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
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
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 for (civ = room_const_iv + sizeof(room_const_iv) / sizeof(room_const_iv[0]); civ-- > room_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 newCONSTSUB(room_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
26
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 for (civ = field_const_iv + sizeof(field_const_iv) / sizeof(field_const_iv[0]); civ-- > field_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
28 newCONSTSUB(field_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
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
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
31 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
32 purple_roomlist_cancel_get_list(list)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
33 Purple::Roomlist list
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
34
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
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_roomlist_expand_category(list, category)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
37 Purple::Roomlist list
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
38 Purple::Roomlist::Room category
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
39
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
40 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
41 purple_roomlist_get_in_progress(list)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
42 Purple::Roomlist list
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
43
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
44 Purple::Roomlist
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_roomlist_get_list(gc)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
46 Purple::Connection gc
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
47
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
48 Purple::Roomlist
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
49 purple_roomlist_new(account)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
50 Purple::Account account
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
51
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
52 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
53 purple_roomlist_ref(list)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
54 Purple::Roomlist list
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
55
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
56 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
57 purple_roomlist_room_add(list, room)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
58 Purple::Roomlist list
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::Roomlist::Room room
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
60
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
61 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
62 purple_roomlist_room_add_field(list, room, field)
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::Roomlist list
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
64 Purple::Roomlist::Room room
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
65 gconstpointer field
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
66
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
67 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
68 purple_roomlist_room_join(list, room)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
69 Purple::Roomlist list
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::Roomlist::Room room
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
71
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
72 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
73 purple_roomlist_set_fields(list, fields)
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::Roomlist list
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
75 SV *fields
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
76 PREINIT:
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
77 GList *t_GL;
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
78 int i, t_len;
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
79 PPCODE:
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
80 t_GL = NULL;
25112
4e9dba9e28e6 disapproval of revision '2d9389f32256ca757b17d7cabe9d9beebce0d311'
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 25106
diff changeset
81 t_len = av_len((AV *)SvRV(fields));
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
82
25107
bd102c539600 Tweak a few for loop conditions in the Perl bindings per Etan's suggestion.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 25106
diff changeset
83 for (i = 0; i <= t_len; i++)
23980
a38cbb35eecf Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 16773
diff changeset
84 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(fields), i, 0)));
a38cbb35eecf Some cleanup and a couple leak fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 16773
diff changeset
85
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
86 purple_roomlist_set_fields(list, t_GL);
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
87
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
88 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
89 purple_roomlist_set_in_progress(list, in_progress)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
90 Purple::Roomlist list
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
91 gboolean in_progress
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
92
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
93 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
94 purple_roomlist_show_with_account(account)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
95 Purple::Account account
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
96
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
97 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
98 purple_roomlist_unref(list)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
99 Purple::Roomlist list
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
100

mercurial