Mercurial > pidgin.yaz
annotate libpurple/plugins/tcl/tcl_cmds.c @ 32827:4a34689eeb33 default tip
merged from im.pidgin.pidgin
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 19 Nov 2011 14:42:54 +0900 |
parents | 80eabeb5b794 |
children |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /** |
15823 | 2 * @file tcl_cmds.c Commands for the Purple Tcl plugin bindings |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15823 | 4 * purple |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 * Copyright (C) 2003 Ethan Blanton <eblanton@cs.purdue.edu> |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
26708
diff
changeset
|
7 * |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19563
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 #include <tcl.h> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 #include "internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "conversation.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "connection.h" |
22227 | 28 #include "eventloop.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "account.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "server.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "blist.h" |
15697
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
33 #include "savedstatuses.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "prefs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "core.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 |
15823 | 38 #include "tcl_purple.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 |
15823 | 40 static PurpleAccount *tcl_validate_account(Tcl_Obj *obj, Tcl_Interp *interp); |
41 static PurpleConversation *tcl_validate_conversation(Tcl_Obj *obj, Tcl_Interp *interp); | |
42 static PurpleConnection *tcl_validate_gc(Tcl_Obj *obj, Tcl_Interp *interp); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 |
15823 | 44 static PurpleAccount *tcl_validate_account(Tcl_Obj *obj, Tcl_Interp *interp) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 { |
15823 | 46 PurpleAccount *account; |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
47 GList *cur; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 |
15823 | 49 account = purple_tcl_ref_get(interp, obj, PurpleTclRefAccount); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 if (account == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 |
15823 | 54 for (cur = purple_accounts_get_all(); cur != NULL; cur = g_list_next(cur)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 if (account == cur->data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 return account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 if (interp != NULL) |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
59 Tcl_SetObjResult(interp, Tcl_NewStringObj("invalid account", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 |
15823 | 63 static PurpleConversation *tcl_validate_conversation(Tcl_Obj *obj, Tcl_Interp *interp) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 { |
15823 | 65 PurpleConversation *convo; |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
66 GList *cur; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 |
15823 | 68 convo = purple_tcl_ref_get(interp, obj, PurpleTclRefConversation); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 if (convo == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 |
15823 | 73 for (cur = purple_get_conversations(); cur != NULL; cur = g_list_next(cur)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 if (convo == cur->data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 return convo; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 if (interp != NULL) |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
78 Tcl_SetObjResult(interp, Tcl_NewStringObj("invalid conversation", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 |
15823 | 82 static PurpleConnection *tcl_validate_gc(Tcl_Obj *obj, Tcl_Interp *interp) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 { |
15823 | 84 PurpleConnection *gc; |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
85 GList *cur; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 |
15823 | 87 gc = purple_tcl_ref_get(interp, obj, PurpleTclRefConnection); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 if (gc == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 |
15823 | 92 for (cur = purple_connections_get_all(); cur != NULL; cur = g_list_next(cur)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 if (gc == cur->data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 return gc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 int tcl_cmd_account(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
101 Tcl_Obj *result, *list, *elem; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 const char *cmds[] = { "alias", "connect", "connection", "disconnect", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 "enabled", "find", "handle", "isconnected", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 "list", "presence", "protocol", "status", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 "status_type", "status_types", "username", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 NULL }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 enum { CMD_ACCOUNT_ALIAS, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 CMD_ACCOUNT_CONNECT, CMD_ACCOUNT_CONNECTION, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 CMD_ACCOUNT_DISCONNECT, CMD_ACCOUNT_ENABLED, CMD_ACCOUNT_FIND, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 CMD_ACCOUNT_HANDLE, CMD_ACCOUNT_ISCONNECTED, CMD_ACCOUNT_LIST, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 CMD_ACCOUNT_PRESENCE, CMD_ACCOUNT_PROTOCOL, CMD_ACCOUNT_STATUS, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 CMD_ACCOUNT_STATUS_TYPE, CMD_ACCOUNT_STATUS_TYPES, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 CMD_ACCOUNT_USERNAME } cmd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 const char *listopts[] = { "-all", "-online", NULL }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 enum { CMD_ACCOUNTLIST_ALL, CMD_ACCOUNTLIST_ONLINE } listopt; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 const char *alias; |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
117 GList *cur; |
15823 | 118 PurpleAccount *account; |
119 PurpleStatus *status; | |
120 PurpleStatusType *status_type; | |
121 PurpleValue *value; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 char *attr_id; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 int error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 int b, i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 if (objc < 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 switch (cmd) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 case CMD_ACCOUNT_ALIAS: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 Tcl_WrongNumArgs(interp, 2, objv, "account"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 if ((account = tcl_validate_account(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 return TCL_ERROR; |
15823 | 142 alias = purple_account_get_alias(account); |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
143 Tcl_SetObjResult(interp, Tcl_NewStringObj(alias ? (char *)alias : "", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 case CMD_ACCOUNT_CONNECT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 Tcl_WrongNumArgs(interp, 2, objv, "account"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 if ((account = tcl_validate_account(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 return TCL_ERROR; |
15823 | 152 if (!purple_account_is_connected(account)) |
153 purple_account_connect(account); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 Tcl_SetObjResult(interp, |
15823 | 155 purple_tcl_ref_new(PurpleTclRefConnection, |
156 purple_account_get_connection(account))); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 case CMD_ACCOUNT_CONNECTION: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 Tcl_WrongNumArgs(interp, 2, objv, "account"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 if ((account = tcl_validate_account(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 Tcl_SetObjResult(interp, |
15823 | 167 purple_tcl_ref_new(PurpleTclRefConnection, |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
168 purple_account_get_connection(account))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 case CMD_ACCOUNT_DISCONNECT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 Tcl_WrongNumArgs(interp, 2, objv, "account"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 if ((account = tcl_validate_account(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 return TCL_ERROR; |
15823 | 177 purple_account_disconnect(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 case CMD_ACCOUNT_ENABLED: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 if (objc != 3 && objc != 4) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 Tcl_WrongNumArgs(interp, 2, objv, "account ?enabled?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 if ((account = tcl_validate_account(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 if (objc == 3) { |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
26708
diff
changeset
|
187 Tcl_SetObjResult(interp, |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
188 Tcl_NewBooleanObj( |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
189 purple_account_get_enabled(account, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
190 purple_core_get_ui()))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 if ((error = Tcl_GetBooleanFromObj(interp, objv[3], &b)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 return TCL_ERROR; |
15823 | 194 purple_account_set_enabled(account, purple_core_get_ui(), b); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 case CMD_ACCOUNT_FIND: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 if (objc != 4) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 Tcl_WrongNumArgs(interp, 2, objv, "username protocol"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 } |
15823 | 202 account = purple_accounts_find(Tcl_GetString(objv[2]), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 Tcl_GetString(objv[3])); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 Tcl_SetObjResult(interp, |
15823 | 205 purple_tcl_ref_new(PurpleTclRefAccount, account)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 case CMD_ACCOUNT_HANDLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 if (objc != 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 Tcl_WrongNumArgs(interp, 2, objv, ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 } |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
26708
diff
changeset
|
212 Tcl_SetObjResult(interp, |
20165
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
213 purple_tcl_ref_new(PurpleTclRefHandle, |
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
214 purple_accounts_get_handle())); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 case CMD_ACCOUNT_ISCONNECTED: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 Tcl_WrongNumArgs(interp, 2, objv, "account"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 if ((account = tcl_validate_account(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
223 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
224 Tcl_NewBooleanObj( |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
225 purple_account_is_connected(account))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 case CMD_ACCOUNT_LIST: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 listopt = CMD_ACCOUNTLIST_ALL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 if (objc > 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 Tcl_WrongNumArgs(interp, 2, objv, "?option?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 if (objc == 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 if ((error = Tcl_GetIndexFromObj(interp, objv[2], listopts, "option", 0, (int *)&listopt)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 list = Tcl_NewListObj(0, NULL); |
15823 | 238 for (cur = purple_accounts_get_all(); cur != NULL; cur = g_list_next(cur)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 account = cur->data; |
15823 | 240 if (listopt == CMD_ACCOUNTLIST_ONLINE && !purple_account_is_connected(account)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 continue; |
15823 | 242 elem = purple_tcl_ref_new(PurpleTclRefAccount, account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 Tcl_ListObjAppendElement(interp, list, elem); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 Tcl_SetObjResult(interp, list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 case CMD_ACCOUNT_PRESENCE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 Tcl_WrongNumArgs(interp, 2, objv, "account"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 if ((account = tcl_validate_account(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 return TCL_ERROR; |
15823 | 254 Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefPresence, |
255 purple_account_get_presence(account))); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 case CMD_ACCOUNT_PROTOCOL: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 Tcl_WrongNumArgs(interp, 2, objv, "account"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 if ((account = tcl_validate_account(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
264 Tcl_SetObjResult(interp, Tcl_NewStringObj((char *)purple_account_get_protocol_id(account), -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 case CMD_ACCOUNT_STATUS: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 if (objc < 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 Tcl_WrongNumArgs(interp, 2, objv, "account ?status_id name value ...?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 if ((account = tcl_validate_account(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 if (objc == 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 Tcl_SetObjResult(interp, |
15823 | 275 purple_tcl_ref_new(PurpleTclRefStatus, |
276 purple_account_get_active_status(account))); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 GList *l = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 if (objc % 2) { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
280 Tcl_SetObjResult(interp, Tcl_NewStringObj("name without value setting status", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 } |
15823 | 283 status = purple_account_get_status(account, Tcl_GetString(objv[3])); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 if (status == NULL) { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
285 Tcl_SetObjResult(interp, Tcl_NewStringObj("invalid status for account", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 for (i = 4; i < objc; i += 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 attr_id = Tcl_GetString(objv[i]); |
15823 | 290 value = purple_status_get_attr_value(status, attr_id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 if (value == NULL) { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
292 Tcl_SetObjResult(interp, Tcl_NewStringObj("invalid attribute for account", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 } |
15823 | 295 switch (purple_value_get_type(value)) { |
296 case PURPLE_TYPE_BOOLEAN: | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 error = Tcl_GetBooleanFromObj(interp, objv[i + 1], &b); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 if (error != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 l = g_list_append(l, attr_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 l = g_list_append(l, GINT_TO_POINTER(b)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 break; |
15823 | 303 case PURPLE_TYPE_INT: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 error = Tcl_GetIntFromObj(interp, objv[i + 1], &b); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 if (error != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 l = g_list_append(l, attr_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 l = g_list_append(l, GINT_TO_POINTER(b)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 break; |
15823 | 310 case PURPLE_TYPE_STRING: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 l = g_list_append(l, attr_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 l = g_list_append(l, Tcl_GetString(objv[i + 1])); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 default: |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
315 Tcl_SetObjResult(interp, Tcl_NewStringObj("unknown PurpleValue type", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 } |
15823 | 319 purple_account_set_status_list(account, Tcl_GetString(objv[3]), TRUE, l); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 g_list_free(l); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 case CMD_ACCOUNT_STATUS_TYPE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 if (objc != 4 && objc != 5) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 Tcl_WrongNumArgs(interp, 2, objv, "account ?statustype? ?-primitive primitive?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 if ((account = tcl_validate_account(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 if (objc == 4) { |
15823 | 331 status_type = purple_account_get_status_type(account, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 Tcl_GetString(objv[3])); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 } else { |
15823 | 334 PurpleStatusPrimitive primitive; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 if (strcmp(Tcl_GetString(objv[3]), "-primitive")) { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
336 result = Tcl_NewStringObj("bad option \"", -1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 Tcl_AppendObjToObj(result, objv[3]); |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
338 Tcl_AppendToObj(result, "\": should be -primitive", -1); |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
339 Tcl_SetObjResult(interp,result); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 } |
15823 | 342 primitive = purple_primitive_get_type_from_id(Tcl_GetString(objv[4])); |
343 status_type = purple_account_get_status_type_with_primitive(account, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 primitive); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 if (status_type == NULL) { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
347 Tcl_SetObjResult(interp, Tcl_NewStringObj("status type not found", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 Tcl_SetObjResult(interp, |
15823 | 351 purple_tcl_ref_new(PurpleTclRefStatusType, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 status_type)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
354 case CMD_ACCOUNT_STATUS_TYPES: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 Tcl_WrongNumArgs(interp, 2, objv, "account"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 if ((account = tcl_validate_account(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 list = Tcl_NewListObj(0, NULL); |
15823 | 362 for (cur = purple_account_get_status_types(account); cur != NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
363 cur = g_list_next(cur)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 Tcl_ListObjAppendElement(interp, list, |
15823 | 365 purple_tcl_ref_new(PurpleTclRefStatusType, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 cur->data)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 Tcl_SetObjResult(interp, list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
369 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 case CMD_ACCOUNT_USERNAME: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 Tcl_WrongNumArgs(interp, 2, objv, "account"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 if ((account = tcl_validate_account(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 return TCL_ERROR; |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
26708
diff
changeset
|
377 Tcl_SetObjResult(interp, |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
378 Tcl_NewStringObj((char *)purple_account_get_username(account), -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 |
15823 | 385 static PurpleBlistNode *tcl_list_to_buddy(Tcl_Interp *interp, int count, Tcl_Obj **elems) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 { |
15823 | 387 PurpleBlistNode *node = NULL; |
388 PurpleAccount *account; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 char *name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 char *type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 if (count < 3) { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
393 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
394 Tcl_NewStringObj("list too short", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 type = Tcl_GetString(elems[0]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 name = Tcl_GetString(elems[1]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 if ((account = tcl_validate_account(elems[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 if (!strcmp(type, "buddy")) { |
25318
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
24284
diff
changeset
|
404 node = PURPLE_BLIST_NODE(purple_find_buddy(account, name)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 } else if (!strcmp(type, "group")) { |
25318
0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@wiktel.com>
parents:
24284
diff
changeset
|
406 node = PURPLE_BLIST_NODE(purple_blist_find_chat(account, name)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 return node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 int tcl_cmd_buddy(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 Tcl_Obj *list, *tclgroup, *tclgrouplist, *tclcontact, *tclcontactlist, *tclbud, **elems, *result; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 const char *cmds[] = { "alias", "handle", "info", "list", NULL }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 enum { CMD_BUDDY_ALIAS, CMD_BUDDY_HANDLE, CMD_BUDDY_INFO, CMD_BUDDY_LIST } cmd; |
24279
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
417 PurpleBlistNodeType type; |
15823 | 418 PurpleBlistNode *node, *gnode, *bnode; |
419 PurpleAccount *account; | |
420 PurpleBuddy *bud; | |
421 PurpleChat *cnode; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 int error, all = 0, count; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 if (objc < 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 switch (cmd) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 case CMD_BUDDY_ALIAS: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 Tcl_WrongNumArgs(interp, 2, objv, "buddy"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 if ((error = Tcl_ListObjGetElements(interp, objv[2], &count, &elems)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 if ((node = tcl_list_to_buddy(interp, count, elems)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 return TCL_ERROR; |
24284 | 441 type = purple_blist_node_get_type(node); |
24279
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
442 if (type == PURPLE_BLIST_CHAT_NODE) |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
443 Tcl_SetObjResult(interp, |
24279
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
444 Tcl_NewStringObj(purple_chat_get_name((PurpleChat *)node), -1)); |
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
445 else if (type == PURPLE_BLIST_BUDDY_NODE) |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
446 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
447 Tcl_NewStringObj((char *)purple_buddy_get_alias((PurpleBuddy *)node), -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
449 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 case CMD_BUDDY_HANDLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 if (objc != 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 Tcl_WrongNumArgs(interp, 2, objv, ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 } |
20165
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
455 Tcl_SetObjResult(interp, |
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
456 purple_tcl_ref_new(PurpleTclRefHandle, |
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
457 purple_blist_get_handle())); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 case CMD_BUDDY_INFO: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
460 if (objc != 3 && objc != 4) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
461 Tcl_WrongNumArgs(interp, 2, objv, "( buddy | account username )"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
463 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 if (objc == 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 if ((error = Tcl_ListObjGetElements(interp, objv[2], &count, &elems)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 if (count < 3) { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
468 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
469 Tcl_NewStringObj("buddy too short", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 if (strcmp("buddy", Tcl_GetString(elems[0]))) { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
473 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
474 Tcl_NewStringObj("invalid buddy", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 if ((account = tcl_validate_account(elems[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 return TCL_ERROR; |
15823 | 479 serv_get_info(purple_account_get_connection(account), Tcl_GetString(elems[1])); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 if ((account = tcl_validate_account(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 return TCL_ERROR; |
15823 | 483 serv_get_info(purple_account_get_connection(account), Tcl_GetString(objv[3])); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
485 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 case CMD_BUDDY_LIST: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 if (objc == 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
488 if (!strcmp("-all", Tcl_GetString(objv[2]))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 all = 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
490 } else { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
491 result = Tcl_NewStringObj("",-1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
492 Tcl_AppendStringsToObj(result, "unknown option: ", Tcl_GetString(objv[2]), NULL); |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
493 Tcl_SetObjResult(interp,result); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
495 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
496 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 list = Tcl_NewListObj(0, NULL); |
24279
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
498 for (gnode = purple_blist_get_root(); gnode != NULL; gnode = purple_blist_node_get_sibling_next(gnode)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 tclgroup = Tcl_NewListObj(0, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 Tcl_ListObjAppendElement(interp, tclgroup, Tcl_NewStringObj("group", -1)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 Tcl_ListObjAppendElement(interp, tclgroup, |
24279
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
502 Tcl_NewStringObj(purple_group_get_name((PurpleGroup *)gnode), -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 tclgrouplist = Tcl_NewListObj(0, NULL); |
24279
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
504 for (node = purple_blist_node_get_first_child(gnode); node != NULL; node = purple_blist_node_get_sibling_next(node)) { |
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
505 PurpleAccount *account; |
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
506 |
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
507 type = purple_blist_node_get_type(node); |
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
508 switch (type) { |
15823 | 509 case PURPLE_BLIST_CONTACT_NODE: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 tclcontact = Tcl_NewListObj(0, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 Tcl_IncrRefCount(tclcontact); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 Tcl_ListObjAppendElement(interp, tclcontact, Tcl_NewStringObj("contact", -1)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 tclcontactlist = Tcl_NewListObj(0, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 Tcl_IncrRefCount(tclcontactlist); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 count = 0; |
24279
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
516 for (bnode = purple_blist_node_get_first_child(node); bnode != NULL; bnode = purple_blist_node_get_sibling_next(bnode)) { |
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
517 if (purple_blist_node_get_type(bnode) != PURPLE_BLIST_BUDDY_NODE) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 continue; |
15823 | 519 bud = (PurpleBuddy *)bnode; |
24279
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
520 account = purple_buddy_get_account(bud); |
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
521 if (!all && !purple_account_is_connected(account)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 count++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 tclbud = Tcl_NewListObj(0, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
525 Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj("buddy", -1)); |
24279
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
526 Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj(purple_buddy_get_name(bud), -1)); |
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
527 Tcl_ListObjAppendElement(interp, tclbud, purple_tcl_ref_new(PurpleTclRefAccount, account)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 Tcl_ListObjAppendElement(interp, tclcontactlist, tclbud); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
529 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 if (count) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 Tcl_ListObjAppendElement(interp, tclcontact, tclcontactlist); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 Tcl_ListObjAppendElement(interp, tclgrouplist, tclcontact); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
533 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 Tcl_DecrRefCount(tclcontact); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 Tcl_DecrRefCount(tclcontactlist); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 break; |
15823 | 537 case PURPLE_BLIST_CHAT_NODE: |
538 cnode = (PurpleChat *)node; | |
24279
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
539 account = purple_chat_get_account(cnode); |
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
540 if (!all && !purple_account_is_connected(account)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 tclbud = Tcl_NewListObj(0, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
543 Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj("chat", -1)); |
24279
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
544 Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj(purple_chat_get_name(cnode), -1)); |
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
545 Tcl_ListObjAppendElement(interp, tclbud, purple_tcl_ref_new(PurpleTclRefAccount, account)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
546 Tcl_ListObjAppendElement(interp, tclgrouplist, tclbud); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 default: |
24279
7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@wiktel.com>
parents:
22227
diff
changeset
|
549 purple_debug(PURPLE_DEBUG_WARNING, "tcl", "Unexpected buddy type %d", type); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
550 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 Tcl_ListObjAppendElement(interp, tclgroup, tclgrouplist); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 Tcl_ListObjAppendElement(interp, list, tclgroup); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 Tcl_SetObjResult(interp, list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 int tcl_cmd_cmd(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 { |
19563
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
565 const char *cmds[] = { "do", "help", "list", "register", "unregister", NULL }; |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
566 enum { CMD_CMD_DO, CMD_CMD_HELP, CMD_CMD_LIST, CMD_CMD_REGISTER, CMD_CMD_UNREGISTER } cmd; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 struct tcl_cmd_handler *handler; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
568 Tcl_Obj *list, *elem; |
19563
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
569 PurpleConversation *convo; |
15823 | 570 PurpleCmdId id; |
19563
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
571 PurpleCmdStatus status; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 int error; |
19563
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
573 GList *l, *cur; |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
574 gchar *escaped, *errstr = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 if (objc < 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
581 if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 switch (cmd) { |
19563
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
585 case CMD_CMD_DO: |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
586 if (objc != 4) { |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
587 Tcl_WrongNumArgs(interp, 2, objv, "conversation command"); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
588 return TCL_ERROR; |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
589 } |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
590 if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
591 return TCL_ERROR; |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
592 escaped = g_markup_escape_text(Tcl_GetString(objv[3]), -1); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
593 status = purple_cmd_do_command(convo, Tcl_GetString(objv[3]), |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
594 escaped, &errstr); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
595 g_free(escaped); |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
596 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
597 Tcl_NewStringObj(errstr ? (char *)errstr : "", -1)); |
19563
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
598 g_free(errstr); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
599 if (status != PURPLE_CMD_STATUS_OK) { |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
600 return TCL_ERROR; |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
601 } |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
602 break; |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
603 case CMD_CMD_HELP: |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
604 if (objc != 4) { |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
605 Tcl_WrongNumArgs(interp, 2, objv, "conversation name"); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
606 return TCL_ERROR; |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
607 } |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
608 if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
609 return TCL_ERROR; |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
610 l = cur = purple_cmd_help(convo, Tcl_GetString(objv[3])); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
611 list = Tcl_NewListObj(0, NULL); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
612 while (cur != NULL) { |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
613 elem = Tcl_NewStringObj((char *)cur->data, -1); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
614 Tcl_ListObjAppendElement(interp, list, elem); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
615 cur = g_list_next(cur); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
616 } |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
617 g_list_free(l); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
618 Tcl_SetObjResult(interp, list); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
619 break; |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
620 case CMD_CMD_LIST: |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
621 if (objc != 3) { |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
622 Tcl_WrongNumArgs(interp, 2, objv, "conversation"); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
623 return TCL_ERROR; |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
624 } |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
625 if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
626 return TCL_ERROR; |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
627 l = cur = purple_cmd_list(convo); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
628 list = Tcl_NewListObj(0, NULL); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
629 while (cur != NULL) { |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
630 elem = Tcl_NewStringObj((char *)cur->data, -1); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
631 Tcl_ListObjAppendElement(interp, list, elem); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
632 cur = g_list_next(cur); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
633 } |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
634 g_list_free(l); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
635 Tcl_SetObjResult(interp, list); |
3715a9411806
Patch from Dossy Shiobara which improves Tcl support for purple
Ethan Blanton <elb@pidgin.im>
parents:
18118
diff
changeset
|
636 break; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 case CMD_CMD_REGISTER: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 if (objc != 9) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 Tcl_WrongNumArgs(interp, 2, objv, "cmd arglist priority flags prpl_id proc helpstr"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
642 handler = g_new0(struct tcl_cmd_handler, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 handler->cmd = objv[2]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
644 handler->args = Tcl_GetString(objv[3]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 handler->nargs = strlen(handler->args); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 if ((error = Tcl_GetIntFromObj(interp, objv[4], |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 &handler->priority)) != TCL_OK) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 g_free(handler); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 if ((error = Tcl_GetIntFromObj(interp, objv[5], |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 &handler->flags)) != TCL_OK) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 g_free(handler); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 handler->prpl_id = Tcl_GetString(objv[6]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 handler->proc = objv[7]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 handler->helpstr = Tcl_GetString(objv[8]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 handler->interp = interp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 if ((id = tcl_cmd_register(handler)) == 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 tcl_cmd_handler_free(handler); |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
662 Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 handler->id = id; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
665 Tcl_SetObjResult(interp, Tcl_NewIntObj(id)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
666 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 case CMD_CMD_UNREGISTER: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 Tcl_WrongNumArgs(interp, 2, objv, "id"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 if ((error = Tcl_GetIntFromObj(interp, objv[2], |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
674 (int *)&id)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 tcl_cmd_unregister(id, interp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 int tcl_cmd_connection(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
685 Tcl_Obj *list, *elem; |
26708
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
686 const char *cmds[] = { "account", "displayname", "handle", "list", "state", NULL }; |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
687 enum { CMD_CONN_ACCOUNT, CMD_CONN_DISPLAYNAME, CMD_CONN_HANDLE, |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
688 CMD_CONN_LIST, CMD_CONN_STATE } cmd; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
689 int error; |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
690 GList *cur; |
15823 | 691 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 if (objc < 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
695 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
698 if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
699 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
700 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 switch (cmd) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
702 case CMD_CONN_ACCOUNT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 Tcl_WrongNumArgs(interp, 2, objv, "gc"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
705 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
706 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
707 if ((gc = tcl_validate_gc(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
708 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 Tcl_SetObjResult(interp, |
15823 | 710 purple_tcl_ref_new(PurpleTclRefAccount, |
711 purple_connection_get_account(gc))); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
713 case CMD_CONN_DISPLAYNAME: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 Tcl_WrongNumArgs(interp, 2, objv, "gc"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 if ((gc = tcl_validate_gc(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
720 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
721 Tcl_NewStringObj(purple_connection_get_display_name(gc), -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
722 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
723 case CMD_CONN_HANDLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 if (objc != 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 Tcl_WrongNumArgs(interp, 2, objv, ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 } |
20165
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
728 Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefHandle, |
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
729 purple_connections_get_handle())); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
731 case CMD_CONN_LIST: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 if (objc != 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 Tcl_WrongNumArgs(interp, 2, objv, ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
734 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
735 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
736 list = Tcl_NewListObj(0, NULL); |
15823 | 737 for (cur = purple_connections_get_all(); cur != NULL; cur = g_list_next(cur)) { |
738 elem = purple_tcl_ref_new(PurpleTclRefConnection, cur->data); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
739 Tcl_ListObjAppendElement(interp, list, elem); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
740 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
741 Tcl_SetObjResult(interp, list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
742 break; |
26708
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
743 case CMD_CONN_STATE: |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
744 if (objc != 3) { |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
745 Tcl_WrongNumArgs(interp, 2, objv, "gc"); |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
746 return TCL_ERROR; |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
747 } |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
748 if ((gc = tcl_validate_gc(objv[2], interp)) == NULL) |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
749 return TCL_ERROR; |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
750 switch (purple_connection_get_state(gc)) { |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
751 case PURPLE_DISCONNECTED: |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
752 Tcl_SetObjResult(interp, Tcl_NewStringObj("disconnected", -1)); |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
753 break; |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
754 case PURPLE_CONNECTED: |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
755 Tcl_SetObjResult(interp, Tcl_NewStringObj("connected", -1)); |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
756 break; |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
757 case PURPLE_CONNECTING: |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
758 Tcl_SetObjResult(interp, Tcl_NewStringObj("connecting", -1)); |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
759 break; |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
760 } |
e5ebf3abd9f8
Add the Tcl command purple::connection state (purple_connection_get_state).
Ethan Blanton <elb@pidgin.im>
parents:
25440
diff
changeset
|
761 break; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
762 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
763 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
764 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
765 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
766 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
767 int tcl_cmd_conversation(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
768 { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
769 Tcl_Obj *list, *elem; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
770 const char *cmds[] = { "find", "handle", "list", "new", "write", "name", "title", "send", NULL }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
771 enum { CMD_CONV_FIND, CMD_CONV_HANDLE, CMD_CONV_LIST, CMD_CONV_NEW, CMD_CONV_WRITE , CMD_CONV_NAME, CMD_CONV_TITLE, CMD_CONV_SEND } cmd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
772 const char *styles[] = { "send", "recv", "system", NULL }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
773 enum { CMD_CONV_WRITE_SEND, CMD_CONV_WRITE_RECV, CMD_CONV_WRITE_SYSTEM } style; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
774 const char *newopts[] = { "-chat", "-im" }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 enum { CMD_CONV_NEW_CHAT, CMD_CONV_NEW_IM } newopt; |
15823 | 776 PurpleConversation *convo; |
777 PurpleAccount *account; | |
778 PurpleConversationType type; | |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
779 GList *cur; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
780 char *opt, *from, *what; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
781 int error, argsused, flags = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
782 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 if (objc < 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
784 Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
785 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
786 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
787 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
788 if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
790 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
791 switch (cmd) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
792 case CMD_CONV_FIND: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
793 if (objc != 4) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
794 Tcl_WrongNumArgs(interp, 2, objv, "account name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
795 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
796 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
797 account = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
798 if ((account = tcl_validate_account(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
799 return TCL_ERROR; |
15823 | 800 convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
801 Tcl_GetString(objv[3]), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
802 account); |
15823 | 803 Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefConversation, convo)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
805 case CMD_CONV_HANDLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
806 if (objc != 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
807 Tcl_WrongNumArgs(interp, 2, objv, ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
808 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
809 } |
20165
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
810 Tcl_SetObjResult(interp, |
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
811 purple_tcl_ref_new(PurpleTclRefHandle, |
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
812 purple_conversations_get_handle())); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
813 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
814 case CMD_CONV_LIST: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
815 list = Tcl_NewListObj(0, NULL); |
15823 | 816 for (cur = purple_get_conversations(); cur != NULL; cur = g_list_next(cur)) { |
817 elem = purple_tcl_ref_new(PurpleTclRefConversation, cur->data); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
818 Tcl_ListObjAppendElement(interp, list, elem); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
820 Tcl_SetObjResult(interp, list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
821 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
822 case CMD_CONV_NEW: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
823 if (objc < 4) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
824 Tcl_WrongNumArgs(interp, 2, objv, "?options? account name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
825 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
826 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
827 argsused = 2; |
15823 | 828 type = PURPLE_CONV_TYPE_IM; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
829 while (argsused < objc) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
830 opt = Tcl_GetString(objv[argsused]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 if (*opt == '-') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
832 if ((error = Tcl_GetIndexFromObj(interp, objv[argsused], newopts, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 "option", 0, (int *)&newopt)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
834 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
835 argsused++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 switch (newopt) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
837 case CMD_CONV_NEW_CHAT: |
15823 | 838 type = PURPLE_CONV_TYPE_CHAT; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
839 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
840 case CMD_CONV_NEW_IM: |
15823 | 841 type = PURPLE_CONV_TYPE_IM; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
842 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
843 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
844 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
845 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
846 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
847 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
848 if (objc - argsused != 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 Tcl_WrongNumArgs(interp, 2, objv, "?options? account name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
850 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
852 if ((account = tcl_validate_account(objv[argsused++], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
853 return TCL_ERROR; |
15823 | 854 convo = purple_conversation_new(type, account, Tcl_GetString(objv[argsused])); |
855 Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefConversation, convo)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
856 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 case CMD_CONV_WRITE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
858 if (objc != 6) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
859 Tcl_WrongNumArgs(interp, 2, objv, "conversation style from what"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
860 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
862 if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
863 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
864 if ((error = Tcl_GetIndexFromObj(interp, objv[3], styles, "style", 0, (int *)&style)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
865 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
866 from = Tcl_GetString(objv[4]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
867 what = Tcl_GetString(objv[5]); |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
26708
diff
changeset
|
868 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
869 switch (style) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
870 case CMD_CONV_WRITE_SEND: |
15823 | 871 flags = PURPLE_MESSAGE_SEND; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
872 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
873 case CMD_CONV_WRITE_RECV: |
15823 | 874 flags = PURPLE_MESSAGE_RECV; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
875 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
876 case CMD_CONV_WRITE_SYSTEM: |
15823 | 877 flags = PURPLE_MESSAGE_SYSTEM; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
878 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
879 } |
15823 | 880 if (purple_conversation_get_type(convo) == PURPLE_CONV_TYPE_CHAT) |
881 purple_conv_chat_write(PURPLE_CONV_CHAT(convo), from, what, flags, time(NULL)); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
882 else |
15823 | 883 purple_conv_im_write(PURPLE_CONV_IM(convo), from, what, flags, time(NULL)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
884 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
885 case CMD_CONV_NAME: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
886 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
887 Tcl_WrongNumArgs(interp, 2, objv, "conversation"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
888 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
889 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
890 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
891 if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
892 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
893 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
894 Tcl_NewStringObj((char *)purple_conversation_get_name(convo), -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
895 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
896 case CMD_CONV_TITLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
897 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
898 Tcl_WrongNumArgs(interp, 2, objv, "conversation"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
899 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
900 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
901 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
902 if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
903 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
904 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
905 Tcl_NewStringObj((char *)purple_conversation_get_title(convo), -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
906 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
907 case CMD_CONV_SEND: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
908 if (objc != 4) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
909 Tcl_WrongNumArgs(interp, 2, objv, "conversation message"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
910 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
911 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
912 if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
913 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
914 what = Tcl_GetString(objv[3]); |
15823 | 915 if (purple_conversation_get_type(convo) == PURPLE_CONV_TYPE_CHAT) |
916 purple_conv_chat_send(PURPLE_CONV_CHAT(convo), what); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
917 else |
15823 | 918 purple_conv_im_send(PURPLE_CONV_IM(convo), what); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
919 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
920 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
921 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
922 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
923 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
924 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
925 int tcl_cmd_core(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
926 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
927 const char *cmds[] = { "handle", "quit", NULL }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
928 enum { CMD_CORE_HANDLE, CMD_CORE_QUIT } cmd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
929 int error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
930 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
931 if (objc < 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
932 Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
933 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
934 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
935 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
936 if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
937 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
938 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
939 switch (cmd) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
940 case CMD_CORE_HANDLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
941 if (objc != 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
942 Tcl_WrongNumArgs(interp, 2, objv, ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
943 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
944 } |
20165
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
945 Tcl_SetObjResult(interp, |
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
946 purple_tcl_ref_new(PurpleTclRefHandle, |
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
947 purple_get_core())); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
948 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
949 case CMD_CORE_QUIT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
950 if (objc != 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
951 Tcl_WrongNumArgs(interp, 2, objv, ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
952 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
953 } |
15823 | 954 purple_core_quit(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
955 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
956 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
957 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
958 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
959 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
960 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
961 int tcl_cmd_debug(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
962 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
963 char *category, *message; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
964 int lev; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
965 const char *levels[] = { "-misc", "-info", "-warning", "-error", NULL }; |
15823 | 966 PurpleDebugLevel levelind[] = { PURPLE_DEBUG_MISC, PURPLE_DEBUG_INFO, PURPLE_DEBUG_WARNING, PURPLE_DEBUG_ERROR }; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
967 int error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
968 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
969 if (objc != 4) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
970 Tcl_WrongNumArgs(interp, 1, objv, "level category message"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
971 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
972 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
973 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
974 error = Tcl_GetIndexFromObj(interp, objv[1], levels, "debug level", 0, &lev); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
975 if (error != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
976 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
977 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
978 category = Tcl_GetString(objv[2]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
979 message = Tcl_GetString(objv[3]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
980 |
15823 | 981 purple_debug(levelind[lev], category, "%s\n", message); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
982 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
983 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
984 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
985 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
986 int tcl_cmd_notify(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
987 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
988 int error, type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
989 const char *opts[] = { "-error", "-warning", "-info", NULL }; |
15823 | 990 PurpleNotifyMsgType optind[] = { PURPLE_NOTIFY_MSG_ERROR, PURPLE_NOTIFY_MSG_WARNING, PURPLE_NOTIFY_MSG_INFO }; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
991 char *title, *msg1, *msg2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
992 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
993 if (objc < 4 || objc > 5) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
994 Tcl_WrongNumArgs(interp, 1, objv, "?type? title primary secondary"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
995 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
996 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
997 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
998 if (objc == 4) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
999 type = 1; /* Default to warning */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1000 title = Tcl_GetString(objv[1]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1001 msg1 = Tcl_GetString(objv[2]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1002 msg2 = Tcl_GetString(objv[3]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1003 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1004 error = Tcl_GetIndexFromObj(interp, objv[1], opts, "message type", 0, &type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1005 if (error != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1006 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1007 title = Tcl_GetString(objv[2]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1008 msg1 = Tcl_GetString(objv[3]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1009 msg2 = Tcl_GetString(objv[4]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1010 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1011 |
15823 | 1012 purple_notify_message(_tcl_plugin, optind[type], title, msg1, msg2, NULL, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1013 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1014 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1015 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1016 |
15687
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1017 int tcl_cmd_plugins(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1018 { |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1019 const char *cmds[] = { "handle", NULL }; |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1020 enum { CMD_PLUGINS_HANDLE } cmd; |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1021 int error; |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1022 |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1023 if (objc < 2) { |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1024 Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1025 return TCL_ERROR; |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1026 } |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1027 |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1028 if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1029 return error; |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1030 |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1031 switch (cmd) { |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1032 case CMD_PLUGINS_HANDLE: |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1033 if (objc != 2) { |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1034 Tcl_WrongNumArgs(interp, 2, objv, ""); |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1035 return TCL_ERROR; |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1036 } |
20165
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
1037 Tcl_SetObjResult(interp, |
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
1038 purple_tcl_ref_new(PurpleTclRefHandle, |
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
1039 purple_plugins_get_handle())); |
15687
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1040 break; |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1041 } |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1042 |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1043 return TCL_OK; |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1044 } |
d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
Ethan Blanton <elb@pidgin.im>
parents:
15374
diff
changeset
|
1045 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1046 int tcl_cmd_prefs(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1047 { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1048 Tcl_Obj *list, *elem, **elems; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1049 const char *cmds[] = { "get", "set", "type", NULL }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1050 enum { CMD_PREFS_GET, CMD_PREFS_SET, CMD_PREFS_TYPE } cmd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1051 /* char *types[] = { "none", "boolean", "int", "string", "stringlist", NULL }; */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1052 /* enum { TCL_PREFS_NONE, TCL_PREFS_BOOL, TCL_PREFS_INT, TCL_PREFS_STRING, TCL_PREFS_STRINGLIST } type; */ |
15823 | 1053 PurplePrefType preftype; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1054 GList *cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1055 int error, intval, nelem, i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1056 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1057 if (objc < 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1058 Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1059 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1060 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1061 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1062 if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1063 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1064 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1065 switch (cmd) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1066 case CMD_PREFS_GET: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1067 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1068 Tcl_WrongNumArgs(interp, 1, objv, "path"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1069 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1070 } |
15823 | 1071 preftype = purple_prefs_get_type(Tcl_GetString(objv[2])); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1072 switch (preftype) { |
15823 | 1073 case PURPLE_PREF_NONE: |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1074 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1075 Tcl_NewStringObj("pref type none", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1076 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1077 break; |
15823 | 1078 case PURPLE_PREF_BOOLEAN: |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1079 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1080 Tcl_NewBooleanObj( |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1081 purple_prefs_get_bool(Tcl_GetString(objv[2])))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1082 break; |
15823 | 1083 case PURPLE_PREF_INT: |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1084 Tcl_SetObjResult(interp, Tcl_NewIntObj(purple_prefs_get_int(Tcl_GetString(objv[2])))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1085 break; |
15823 | 1086 case PURPLE_PREF_STRING: |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1087 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1088 Tcl_NewStringObj((char *)purple_prefs_get_string(Tcl_GetString(objv[2])), -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1089 break; |
15823 | 1090 case PURPLE_PREF_STRING_LIST: |
1091 cur = purple_prefs_get_string_list(Tcl_GetString(objv[2])); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1092 list = Tcl_NewListObj(0, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1093 while (cur != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1094 elem = Tcl_NewStringObj((char *)cur->data, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1095 Tcl_ListObjAppendElement(interp, list, elem); |
22113
3afd04d5f9d6
disapproval of revision '55eb5e28f52c9cdccc6229a8314ffbdac2260843'
Etan Reisner <pidgin@unreliablesource.net>
parents:
22112
diff
changeset
|
1096 cur = g_list_next(cur); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1097 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1098 Tcl_SetObjResult(interp, list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1099 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1100 default: |
15823 | 1101 purple_debug(PURPLE_DEBUG_ERROR, "tcl", "tcl does not know about pref type %d\n", preftype); |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1102 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1103 Tcl_NewStringObj("unknown pref type", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1104 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1105 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1106 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1107 case CMD_PREFS_SET: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1108 if (objc != 4) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1109 Tcl_WrongNumArgs(interp, 1, objv, "path value"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1110 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1111 } |
15823 | 1112 preftype = purple_prefs_get_type(Tcl_GetString(objv[2])); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1113 switch (preftype) { |
15823 | 1114 case PURPLE_PREF_NONE: |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1115 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1116 Tcl_NewStringObj("bad path or pref type none", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1117 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1118 break; |
15823 | 1119 case PURPLE_PREF_BOOLEAN: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1120 if ((error = Tcl_GetBooleanFromObj(interp, objv[3], &intval)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1121 return error; |
15823 | 1122 purple_prefs_set_bool(Tcl_GetString(objv[2]), intval); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1123 break; |
15823 | 1124 case PURPLE_PREF_INT: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1125 if ((error = Tcl_GetIntFromObj(interp, objv[3], &intval)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1126 return error; |
15823 | 1127 purple_prefs_set_int(Tcl_GetString(objv[2]), intval); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1128 break; |
15823 | 1129 case PURPLE_PREF_STRING: |
1130 purple_prefs_set_string(Tcl_GetString(objv[2]), Tcl_GetString(objv[3])); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1131 break; |
15823 | 1132 case PURPLE_PREF_STRING_LIST: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1133 if ((error = Tcl_ListObjGetElements(interp, objv[3], &nelem, &elems)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1134 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1135 cur = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1136 for (i = 0; i < nelem; i++) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1137 cur = g_list_append(cur, (gpointer)Tcl_GetString(elems[i])); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1138 } |
15823 | 1139 purple_prefs_set_string_list(Tcl_GetString(objv[2]), cur); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1140 g_list_free(cur); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1141 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1142 default: |
15823 | 1143 purple_debug(PURPLE_DEBUG_ERROR, "tcl", "tcl does not know about pref type %d\n", preftype); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1144 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1145 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1146 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1147 case CMD_PREFS_TYPE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1148 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1149 Tcl_WrongNumArgs(interp, 1, objv, "path"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1150 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1151 } |
15823 | 1152 preftype = purple_prefs_get_type(Tcl_GetString(objv[2])); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1153 switch (preftype) { |
15823 | 1154 case PURPLE_PREF_NONE: |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1155 Tcl_SetObjResult(interp, Tcl_NewStringObj("none", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1156 break; |
15823 | 1157 case PURPLE_PREF_BOOLEAN: |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1158 Tcl_SetObjResult(interp, Tcl_NewStringObj("boolean", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1159 break; |
15823 | 1160 case PURPLE_PREF_INT: |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1161 Tcl_SetObjResult(interp, Tcl_NewStringObj("int", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1162 break; |
15823 | 1163 case PURPLE_PREF_STRING: |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1164 Tcl_SetObjResult(interp, Tcl_NewStringObj("string", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1165 break; |
15823 | 1166 case PURPLE_PREF_STRING_LIST: |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1167 Tcl_SetObjResult(interp, Tcl_NewStringObj("stringlist", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1168 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1169 default: |
15823 | 1170 purple_debug(PURPLE_DEBUG_ERROR, "tcl", "tcl does not know about pref type %d\n", preftype); |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1171 Tcl_SetObjResult(interp, Tcl_NewStringObj("unknown", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1172 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1173 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1174 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1175 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1176 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1177 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1178 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1179 int tcl_cmd_presence(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1180 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1181 const char *cmds[] = { "account", "active_status", "available", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1182 "chat_user", "context", "conversation", "idle", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1183 "login", "online", "status", "statuses", NULL }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1184 enum { CMD_PRESENCE_ACCOUNT, CMD_PRESENCE_ACTIVE_STATUS, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1185 CMD_PRESENCE_AVAILABLE, CMD_PRESENCE_CHAT_USER, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1186 CMD_PRESENCE_CONTEXT, CMD_PRESENCE_CONVERSATION, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1187 CMD_PRESENCE_IDLE, CMD_PRESENCE_LOGIN, CMD_PRESENCE_ONLINE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1188 CMD_PRESENCE_STATUS, CMD_PRESENCE_STATUSES } cmd; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1189 Tcl_Obj *result; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1190 Tcl_Obj *list, *elem; |
15823 | 1191 PurplePresence *presence; |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
1192 GList *cur; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1193 int error, idle, idle_time, login_time; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1194 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1195 if (objc < 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1196 Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1197 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1198 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1199 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1200 if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1201 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1202 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1203 switch (cmd) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1204 case CMD_PRESENCE_ACCOUNT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1205 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1206 Tcl_WrongNumArgs(interp, 2, objv, "presence"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1207 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1208 } |
15823 | 1209 if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1210 return TCL_ERROR; |
15823 | 1211 Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefAccount, |
1212 purple_presence_get_account(presence))); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1213 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1214 case CMD_PRESENCE_ACTIVE_STATUS: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1215 if (objc != 3 && objc != 4 && objc != 5) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1216 Tcl_WrongNumArgs(interp, 2, objv, "presence [?status_id? | ?-primitive primitive?]"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1217 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1218 } |
15823 | 1219 if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1220 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1221 if (objc == 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1222 Tcl_SetObjResult(interp, |
15823 | 1223 purple_tcl_ref_new(PurpleTclRefStatus, |
1224 purple_presence_get_active_status(presence))); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1225 } else if (objc == 4) { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1226 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1227 Tcl_NewBooleanObj( |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1228 purple_presence_is_status_active(presence, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1229 Tcl_GetString(objv[3])))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1230 } else { |
15823 | 1231 PurpleStatusPrimitive primitive; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1232 if (strcmp(Tcl_GetString(objv[3]), "-primitive")) { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1233 result = Tcl_NewStringObj("bad option \"", -1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1234 Tcl_AppendObjToObj(result, objv[3]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1235 Tcl_AppendToObj(result, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1236 "\": should be -primitive", -1); |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1237 Tcl_SetObjResult(interp,result); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1238 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1239 } |
15823 | 1240 primitive = purple_primitive_get_type_from_id(Tcl_GetString(objv[4])); |
1241 if (primitive == PURPLE_STATUS_UNSET) { | |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1242 result = Tcl_NewStringObj("invalid primitive ", -1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1243 Tcl_AppendObjToObj(result, objv[4]); |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1244 Tcl_SetObjResult(interp,result); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1245 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1246 } |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1247 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1248 Tcl_NewBooleanObj( |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1249 purple_presence_is_status_primitive_active(presence, primitive))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1250 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1251 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1252 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1253 case CMD_PRESENCE_AVAILABLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1254 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1255 Tcl_WrongNumArgs(interp, 2, objv, "presence"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1256 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1257 } |
15823 | 1258 if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1259 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1260 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1261 Tcl_NewBooleanObj(purple_presence_is_available(presence))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1262 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1263 case CMD_PRESENCE_CHAT_USER: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1264 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1265 Tcl_WrongNumArgs(interp, 2, objv, "presence"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1266 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1267 } |
15823 | 1268 if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1269 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1270 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1271 Tcl_NewStringObj(purple_presence_get_chat_user(presence), -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1272 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1273 case CMD_PRESENCE_CONTEXT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1274 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1275 Tcl_WrongNumArgs(interp, 2, objv, "presence"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1276 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1277 } |
15823 | 1278 if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1279 return TCL_ERROR; |
15823 | 1280 switch (purple_presence_get_context(presence)) { |
1281 case PURPLE_PRESENCE_CONTEXT_UNSET: | |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1282 Tcl_SetObjResult(interp, Tcl_NewStringObj("unset", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1283 break; |
15823 | 1284 case PURPLE_PRESENCE_CONTEXT_ACCOUNT: |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1285 Tcl_SetObjResult(interp, Tcl_NewStringObj("account", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1286 break; |
15823 | 1287 case PURPLE_PRESENCE_CONTEXT_CONV: |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1288 Tcl_SetObjResult(interp, Tcl_NewStringObj("conversation", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1289 break; |
15823 | 1290 case PURPLE_PRESENCE_CONTEXT_BUDDY: |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1291 Tcl_SetObjResult(interp, Tcl_NewStringObj("buddy", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1292 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1293 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1294 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1295 case CMD_PRESENCE_CONVERSATION: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1296 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1297 Tcl_WrongNumArgs(interp, 2, objv, "presence"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1298 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1299 } |
15823 | 1300 if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1301 return TCL_ERROR; |
15823 | 1302 Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefConversation, |
1303 purple_presence_get_conversation(presence))); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1304 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1305 case CMD_PRESENCE_IDLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1306 if (objc < 3 || objc > 5) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1307 Tcl_WrongNumArgs(interp, 2, objv, "presence ?idle? ?time?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1308 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1309 } |
15823 | 1310 if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1311 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1312 if (objc == 3) { |
15823 | 1313 if (purple_presence_is_idle(presence)) { |
1314 idle_time = purple_presence_get_idle_time (presence); | |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1315 Tcl_SetObjResult(interp, Tcl_NewIntObj(idle_time)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1316 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1317 result = Tcl_NewListObj(0, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1318 Tcl_SetObjResult(interp, result); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1319 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1320 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1321 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1322 if ((error = Tcl_GetBooleanFromObj(interp, objv[3], &idle)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1323 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1324 if (objc == 4) { |
15823 | 1325 purple_presence_set_idle(presence, idle, time(NULL)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1326 } else if (objc == 5) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1327 if ((error = Tcl_GetIntFromObj(interp, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1328 objv[4], |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1329 &idle_time)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1330 return TCL_ERROR; |
15823 | 1331 purple_presence_set_idle(presence, idle, idle_time); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1332 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1333 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1334 case CMD_PRESENCE_LOGIN: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1335 if (objc != 3 && objc != 4) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1336 Tcl_WrongNumArgs(interp, 2, objv, "presence ?time?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1337 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1338 } |
15823 | 1339 if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1340 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1341 if (objc == 3) { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1342 Tcl_SetObjResult(interp, Tcl_NewIntObj(purple_presence_get_login_time(presence))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1343 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1344 if ((error == Tcl_GetIntFromObj(interp, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1345 objv[3], |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1346 &login_time)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1347 return TCL_ERROR; |
15823 | 1348 purple_presence_set_login_time(presence, login_time); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1349 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1350 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1351 case CMD_PRESENCE_ONLINE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1352 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1353 Tcl_WrongNumArgs(interp, 2, objv, "presence"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1354 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1355 } |
15823 | 1356 if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1357 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1358 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1359 Tcl_NewBooleanObj( |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1360 purple_presence_is_online(presence))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1361 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1362 case CMD_PRESENCE_STATUS: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1363 if (objc != 4) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1364 Tcl_WrongNumArgs(interp, 2, objv, "presence status_id"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1365 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1366 } |
15823 | 1367 if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1368 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1369 Tcl_SetObjResult(interp, |
15823 | 1370 purple_tcl_ref_new(PurpleTclRefStatus, |
1371 purple_presence_get_status(presence, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1372 Tcl_GetString(objv[3])))); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1373 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1374 case CMD_PRESENCE_STATUSES: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1375 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1376 Tcl_WrongNumArgs(interp, 2, objv, "presence"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1377 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1378 } |
15823 | 1379 if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1380 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1381 list = Tcl_NewListObj(0, NULL); |
15823 | 1382 for (cur = purple_presence_get_statuses(presence); cur != NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1383 cur = g_list_next(cur)) { |
15823 | 1384 elem = purple_tcl_ref_new(PurpleTclRefStatus, cur->data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1385 Tcl_ListObjAppendElement(interp, list, elem); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1386 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1387 Tcl_SetObjResult(interp, list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1388 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1389 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1390 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1391 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1392 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1393 |
15697
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1394 int tcl_cmd_savedstatus(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1395 { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1396 Tcl_Obj *result; |
15697
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1397 const char *cmds[] = { "current", "handle", NULL }; |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1398 enum { CMD_SAVEDSTATUS_CURRENT, CMD_SAVEDSTATUS_HANDLE } cmd; |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1399 int error; |
15823 | 1400 PurpleSavedStatus *saved_status; |
15697
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1401 |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1402 if (objc < 2) { |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1403 Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1404 return TCL_ERROR; |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1405 } |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1406 |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1407 if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1408 return error; |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1409 |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1410 switch (cmd) { |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1411 case CMD_SAVEDSTATUS_CURRENT: |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1412 if (objc != 2) { |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1413 Tcl_WrongNumArgs(interp, 2, objv, ""); |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1414 return TCL_ERROR; |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1415 } |
15823 | 1416 if ((saved_status = purple_savedstatus_get_current()) == NULL) |
15697
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1417 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1418 result = Tcl_NewListObj(0, NULL); |
15823 | 1419 Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(purple_savedstatus_get_title(saved_status), -1)); |
1420 Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(purple_savedstatus_get_type(saved_status))); | |
1421 Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(purple_savedstatus_get_message(saved_status), -1)); | |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1422 Tcl_SetObjResult(interp,result); |
15697
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1423 break; |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1424 case CMD_SAVEDSTATUS_HANDLE: |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1425 if (objc != 2) { |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1426 Tcl_WrongNumArgs(interp, 2, objv, ""); |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1427 return TCL_ERROR; |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1428 } |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
26708
diff
changeset
|
1429 Tcl_SetObjResult(interp, |
20165
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
1430 purple_tcl_ref_new(PurpleTclRefHandle, |
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
1431 purple_savedstatuses_get_handle())); |
15697
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1432 break; |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1433 } |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1434 |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1435 return TCL_OK; |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1436 } |
31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
Ethan Blanton <elb@pidgin.im>
parents:
15687
diff
changeset
|
1437 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1438 int tcl_cmd_send_im(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1439 { |
15823 | 1440 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1441 char *who, *text; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1442 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1443 if (objc != 4) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1444 Tcl_WrongNumArgs(interp, 1, objv, "gc who text"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1445 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1446 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1447 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1448 if ((gc = tcl_validate_gc(objv[1], interp)) == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1449 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1450 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1451 who = Tcl_GetString(objv[2]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1452 text = Tcl_GetString(objv[3]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1453 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1454 serv_send_im(gc, who, text, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1455 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1456 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1457 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1458 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1459 int tcl_cmd_signal(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1460 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1461 const char *cmds[] = { "connect", "disconnect", NULL }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1462 enum { CMD_SIGNAL_CONNECT, CMD_SIGNAL_DISCONNECT } cmd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1463 struct tcl_signal_handler *handler; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1464 void *instance; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1465 int error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1466 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1467 if (objc < 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1468 Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1469 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1470 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1471 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1472 if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1473 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1474 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1475 switch (cmd) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1476 case CMD_SIGNAL_CONNECT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1477 if (objc != 6) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1478 Tcl_WrongNumArgs(interp, 2, objv, "instance signal args proc"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1479 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1480 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1481 handler = g_new0(struct tcl_signal_handler, 1); |
20165
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
1482 if ((handler->instance = purple_tcl_ref_get(interp, objv[2],PurpleTclRefHandle)) == NULL) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1483 g_free(handler); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1484 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1485 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1486 handler->signal = objv[3]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1487 Tcl_IncrRefCount(handler->signal); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1488 handler->args = objv[4]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1489 handler->proc = objv[5]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1490 handler->interp = interp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1491 if (!tcl_signal_connect(handler)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1492 tcl_signal_handler_free(handler); |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1493 Tcl_SetObjResult(interp, Tcl_NewIntObj(1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1494 } else { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1495 Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1496 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1497 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1498 case CMD_SIGNAL_DISCONNECT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1499 if (objc != 4) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1500 Tcl_WrongNumArgs(interp, 2, objv, "instance signal"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1501 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1502 } |
20165
506f0f7f4f21
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
1503 if ((instance = purple_tcl_ref_get(interp, objv[2],PurpleTclRefHandle)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1504 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1505 tcl_signal_disconnect(instance, Tcl_GetString(objv[3]), interp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1506 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1507 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1508 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1509 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1510 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1511 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1512 int tcl_cmd_status(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1513 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1514 const char *cmds[] = { "attr", "type", NULL }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1515 enum { CMD_STATUS_ATTR, CMD_STATUS_TYPE } cmd; |
15823 | 1516 PurpleStatus *status; |
1517 PurpleStatusType *status_type; | |
25440
5725b3190905
Fix compile errors from the merge. Untested protocols: msnp9, sametime,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25318
diff
changeset
|
1518 int error; |
5725b3190905
Fix compile errors from the merge. Untested protocols: msnp9, sametime,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25318
diff
changeset
|
1519 #if !(defined PURPLE_DISABLE_DEPRECATED) |
15823 | 1520 PurpleValue *value; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1521 const char *attr; |
25440
5725b3190905
Fix compile errors from the merge. Untested protocols: msnp9, sametime,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25318
diff
changeset
|
1522 int v; |
5725b3190905
Fix compile errors from the merge. Untested protocols: msnp9, sametime,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25318
diff
changeset
|
1523 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1524 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1525 if (objc < 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1526 Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1527 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1528 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1529 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1530 if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1531 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1532 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1533 switch (cmd) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1534 case CMD_STATUS_ATTR: |
25440
5725b3190905
Fix compile errors from the merge. Untested protocols: msnp9, sametime,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25318
diff
changeset
|
1535 #if !(defined PURPLE_DISABLE_DEPRECATED) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1536 if (objc != 4 && objc != 5) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1537 Tcl_WrongNumArgs(interp, 2, objv, "status attr_id ?value?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1538 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1539 } |
15823 | 1540 if ((status = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatus)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1541 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1542 attr = Tcl_GetString(objv[3]); |
15823 | 1543 value = purple_status_get_attr_value(status, attr); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1544 if (value == NULL) { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1545 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1546 Tcl_NewStringObj("no such attribute", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1547 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1548 } |
15823 | 1549 switch (purple_value_get_type(value)) { |
1550 case PURPLE_TYPE_BOOLEAN: | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1551 if (objc == 4) { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1552 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1553 Tcl_NewBooleanObj(purple_value_get_boolean(value))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1554 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1555 if ((error = Tcl_GetBooleanFromObj(interp, objv[4], &v)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1556 return error; |
15823 | 1557 purple_status_set_attr_boolean(status, attr, v); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1558 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1559 break; |
15823 | 1560 case PURPLE_TYPE_INT: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1561 if (objc == 4) { |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1562 Tcl_SetObjResult(interp, Tcl_NewIntObj(purple_value_get_int(value))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1563 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1564 if ((error = Tcl_GetIntFromObj(interp, objv[4], &v)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1565 return error; |
15823 | 1566 purple_status_set_attr_int(status, attr, v ); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1567 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1568 break; |
15823 | 1569 case PURPLE_TYPE_STRING: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1570 if (objc == 4) |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1571 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1572 Tcl_NewStringObj(purple_value_get_string(value), -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1573 else |
15823 | 1574 purple_status_set_attr_string(status, attr, Tcl_GetString(objv[4])); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1575 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1576 default: |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1577 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1578 Tcl_NewStringObj("attribute has unknown type", -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1579 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1580 } |
25440
5725b3190905
Fix compile errors from the merge. Untested protocols: msnp9, sametime,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25318
diff
changeset
|
1581 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1582 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1583 case CMD_STATUS_TYPE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1584 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1585 Tcl_WrongNumArgs(interp, 2, objv, "status"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1586 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1587 } |
15823 | 1588 if ((status = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatus)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1589 return TCL_ERROR; |
15823 | 1590 status_type = purple_status_get_type(status); |
1591 Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefStatusType, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1592 status_type)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1593 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1594 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1595 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1596 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1597 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1598 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1599 int tcl_cmd_status_attr(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1600 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1601 const char *cmds[] = { "id", "name", NULL }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1602 enum { CMD_STATUS_ATTR_ID, CMD_STATUS_ATTR_NAME } cmd; |
15823 | 1603 PurpleStatusAttr *attr; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1604 int error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1605 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1606 if (objc < 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1607 Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1608 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1609 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1610 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1611 if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1612 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1613 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1614 switch (cmd) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1615 case CMD_STATUS_ATTR_ID: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1616 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1617 Tcl_WrongNumArgs(interp, 2, objv, "attr"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1618 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1619 } |
15823 | 1620 if ((attr = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusAttr)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1621 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1622 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1623 Tcl_NewStringObj(purple_status_attr_get_id(attr), -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1624 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1625 case CMD_STATUS_ATTR_NAME: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1626 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1627 Tcl_WrongNumArgs(interp, 2, objv, "attr"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1628 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1629 } |
15823 | 1630 if ((attr = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusAttr)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1631 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1632 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1633 Tcl_NewStringObj(purple_status_attr_get_name(attr), -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1634 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1635 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1636 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1637 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1638 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1639 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1640 int tcl_cmd_status_type(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1641 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1642 const char *cmds[] = { "attr", "attrs", "available", "exclusive", "id", |
32318
80eabeb5b794
Get rid of the wholly unused "primary attribute" thing in PurpleStatusTypes
Mark Doliner <mark@kingant.net>
parents:
31534
diff
changeset
|
1643 "independent", "name", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1644 "primitive", "saveable", "user_settable", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1645 NULL }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1646 enum { CMD_STATUS_TYPE_ATTR, CMD_STATUS_TYPE_ATTRS, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1647 CMD_STATUS_TYPE_AVAILABLE, CMD_STATUS_TYPE_EXCLUSIVE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1648 CMD_STATUS_TYPE_ID, CMD_STATUS_TYPE_INDEPENDENT, |
32318
80eabeb5b794
Get rid of the wholly unused "primary attribute" thing in PurpleStatusTypes
Mark Doliner <mark@kingant.net>
parents:
31534
diff
changeset
|
1649 CMD_STATUS_TYPE_NAME, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1650 CMD_STATUS_TYPE_PRIMITIVE, CMD_STATUS_TYPE_SAVEABLE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1651 CMD_STATUS_TYPE_USER_SETTABLE } cmd; |
15823 | 1652 PurpleStatusType *status_type; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1653 Tcl_Obj *list, *elem; |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
1654 GList *cur; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1655 int error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1656 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1657 if (objc < 2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1658 Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1659 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1660 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1661 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1662 if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1663 return error; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1664 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1665 switch (cmd) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1666 case CMD_STATUS_TYPE_AVAILABLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1667 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1668 Tcl_WrongNumArgs(interp, 2, objv, "statustype"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1669 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1670 } |
15823 | 1671 if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1672 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1673 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1674 Tcl_NewBooleanObj(purple_status_type_is_available(status_type))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1675 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1676 case CMD_STATUS_TYPE_ATTR: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1677 if (objc != 4) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1678 Tcl_WrongNumArgs(interp, 2, objv, "statustype attr"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1679 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1680 } |
15823 | 1681 if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1682 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1683 Tcl_SetObjResult(interp, |
15823 | 1684 purple_tcl_ref_new(PurpleTclRefStatusAttr, |
1685 purple_status_type_get_attr(status_type, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1686 Tcl_GetStringFromObj(objv[3], NULL)))); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1687 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1688 case CMD_STATUS_TYPE_ATTRS: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1689 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1690 Tcl_WrongNumArgs(interp, 2, objv, "statustype"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1691 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1692 } |
15823 | 1693 if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1694 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1695 list = Tcl_NewListObj(0, NULL); |
15823 | 1696 for (cur = purple_status_type_get_attrs(status_type); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1697 cur != NULL; cur = g_list_next(cur)) { |
15823 | 1698 elem = purple_tcl_ref_new(PurpleTclRefStatusAttr, cur->data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1699 Tcl_ListObjAppendElement(interp, list, elem); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1700 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1701 Tcl_SetObjResult(interp, list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1702 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1703 case CMD_STATUS_TYPE_EXCLUSIVE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1704 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1705 Tcl_WrongNumArgs(interp, 2, objv, "statustype"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1706 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1707 } |
15823 | 1708 if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1709 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1710 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1711 Tcl_NewBooleanObj(purple_status_type_is_exclusive(status_type))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1712 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1713 case CMD_STATUS_TYPE_ID: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1714 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1715 Tcl_WrongNumArgs(interp, 2, objv, "statustype"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1716 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1717 } |
15823 | 1718 if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1719 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1720 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1721 Tcl_NewStringObj(purple_status_type_get_id(status_type), -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1722 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1723 case CMD_STATUS_TYPE_INDEPENDENT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1724 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1725 Tcl_WrongNumArgs(interp, 2, objv, "statustype"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1726 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1727 } |
15823 | 1728 if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1729 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1730 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1731 Tcl_NewBooleanObj(purple_status_type_is_independent(status_type))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1732 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1733 case CMD_STATUS_TYPE_NAME: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1734 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1735 Tcl_WrongNumArgs(interp, 2, objv, "statustype"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1736 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1737 } |
15823 | 1738 if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1739 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1740 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1741 Tcl_NewStringObj(purple_status_type_get_name(status_type), -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1742 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1743 case CMD_STATUS_TYPE_PRIMITIVE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1744 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1745 Tcl_WrongNumArgs(interp, 2, objv, "statustype"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1746 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1747 } |
15823 | 1748 if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1749 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1750 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1751 Tcl_NewStringObj(purple_primitive_get_id_from_type |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1752 (purple_status_type_get_primitive(status_type)), -1)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1753 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1754 case CMD_STATUS_TYPE_SAVEABLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1755 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1756 Tcl_WrongNumArgs(interp, 2, objv, "statustype"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1757 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1758 } |
15823 | 1759 if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1760 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1761 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1762 Tcl_NewBooleanObj( |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1763 purple_status_type_is_saveable(status_type))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1764 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1765 case CMD_STATUS_TYPE_USER_SETTABLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1766 if (objc != 3) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1767 Tcl_WrongNumArgs(interp, 2, objv, "statustype"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1768 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1769 } |
15823 | 1770 if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1771 return TCL_ERROR; |
20166
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1772 Tcl_SetObjResult(interp, |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1773 Tcl_NewBooleanObj( |
3287445c05a8
The second in a series of Tcl-fixing patches from venks on
Ethan Blanton <elb@pidgin.im>
parents:
20165
diff
changeset
|
1774 purple_status_type_is_user_settable(status_type))); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1775 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1776 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1777 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1778 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1779 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1780 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1781 static gboolean unload_self(gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1782 { |
15823 | 1783 PurplePlugin *plugin = data; |
1784 purple_plugin_unload(plugin); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1785 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1786 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1787 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1788 int tcl_cmd_unload(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1789 { |
15823 | 1790 PurplePlugin *plugin; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1791 if (objc != 1) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1792 Tcl_WrongNumArgs(interp, 1, objv, ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1793 return TCL_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1794 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1795 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1796 if ((plugin = tcl_interp_get_plugin(interp)) == NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1797 /* This isn't exactly OK, but heh. What do you do? */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1798 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1799 } |
31534
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
26708
diff
changeset
|
1800 /* We can't unload immediately, but we can unload at the first |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1801 * known safe opportunity. */ |
22227 | 1802 purple_timeout_add(0, unload_self, (gpointer)plugin); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1803 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1804 return TCL_OK; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1805 } |