Mercurial > pidgin
annotate libpurple/conversation.c @ 30327:06d8de5dd53c
yahoo: Avoid misuse of purple_normalize
purple_normalize returns a pointer into a static buffer, so
calling it twice in the arguments to another function is bad.
(It was OK in this case, since the two calls were identical, but
let's avoid bad idioms)
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sun, 01 Aug 2010 20:21:20 +0000 |
parents | 163f6c3cbdd9 |
children | 351d07aefb09 |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15822 | 2 * purple |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15822 | 4 * Purple is the legal property of its developers, whose names are too numerous |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
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 |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19606
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
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 #include "internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 #include "blist.h" |
17736
c9a046a7f326
New function purple_conversation_do_command. This is almost like
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17735
diff
changeset
|
24 #include "cmds.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 #include "conversation.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "dbus-maybe.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "imgstore.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "prefs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "prpl.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "request.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "signals.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 |
25576
7f552614ec8a
applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents:
23720
diff
changeset
|
36 #define SEND_TYPED_TIMEOUT_SECONDS 5 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 static GList *conversations = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 static GList *ims = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 static GList *chats = NULL; |
15822 | 41 static PurpleConversationUiOps *default_ops = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
43 /** |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
44 * A hash table used for efficient lookups of conversations by name. |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
45 * struct _purple_hconv => PurpleConversation* |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
46 */ |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
47 static GHashTable *conversation_cache = NULL; |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
48 |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
49 struct _purple_hconv { |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
50 PurpleConversationType type; |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
51 char *name; |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
52 const PurpleAccount *account; |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
53 }; |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
54 |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
55 static guint _purple_conversations_hconv_hash(struct _purple_hconv *hc) |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
56 { |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
57 return g_str_hash(hc->name) ^ hc->type ^ g_direct_hash(hc->account); |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
58 } |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
59 |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
60 static guint _purple_conversations_hconv_equal(struct _purple_hconv *hc1, struct _purple_hconv *hc2) |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
61 { |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
62 return (hc1->type == hc2->type && |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
63 hc1->account == hc2->account && |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
64 g_str_equal(hc1->name, hc2->name)); |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
65 } |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
66 |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
67 static void _purple_conversations_hconv_free_key(struct _purple_hconv *hc) |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
68 { |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
69 g_free(hc->name); |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
70 g_free(hc); |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
71 } |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
72 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 void |
15822 | 74 purple_conversations_set_ui_ops(PurpleConversationUiOps *ops) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 default_ops = ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 reset_typing_cb(gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 { |
15822 | 82 PurpleConversation *c = (PurpleConversation *)data; |
83 PurpleConvIm *im; | |
84 | |
85 im = PURPLE_CONV_IM(c); | |
86 | |
87 purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING); | |
88 purple_conv_im_stop_typing_timeout(im); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 send_typed_cb(gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 { |
15822 | 96 PurpleConversation *conv = (PurpleConversation *)data; |
97 PurpleConnection *gc; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 const char *name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 g_return_val_if_fail(conv != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 |
15822 | 102 gc = purple_conversation_get_gc(conv); |
103 name = purple_conversation_get_name(conv); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 if (gc != NULL && name != NULL) { |
15822 | 106 /* We set this to 1 so that PURPLE_TYPING will be sent |
107 * if the Purple user types anything else. | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 */ |
15822 | 109 purple_conv_im_set_type_again(PURPLE_CONV_IM(conv), 1); |
110 | |
111 serv_send_typing(gc, name, PURPLE_TYPED); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 |
15822 | 113 purple_debug(PURPLE_DEBUG_MISC, "conversation", "typed...\n"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 static void |
15822 | 120 common_send(PurpleConversation *conv, const char *message, PurpleMessageFlags msgflags) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 { |
15822 | 122 PurpleConversationType type; |
123 PurpleAccount *account; | |
124 PurpleConnection *gc; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 char *displayed = NULL, *sent = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 int err = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 |
23297
b2f91d7d3427
Don't use strlen() when we can just check the first character
Mark Doliner <mark@kingant.net>
parents:
23169
diff
changeset
|
128 if (*message == '\0') |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 |
15822 | 131 account = purple_conversation_get_account(conv); |
132 gc = purple_conversation_get_gc(conv); | |
15373
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 g_return_if_fail(account != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 g_return_if_fail(gc != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 |
15822 | 137 type = purple_conversation_get_type(conv); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 |
18025
7790021b1270
add a PURPLE_MESSAGE_NO_LINKIFY to prevent things from getting linkified
Nathan Walp <nwalp@pidgin.im>
parents:
18006
diff
changeset
|
139 /* Always linkfy the text for display, unless we're |
7790021b1270
add a PURPLE_MESSAGE_NO_LINKIFY to prevent things from getting linkified
Nathan Walp <nwalp@pidgin.im>
parents:
18006
diff
changeset
|
140 * explicitly asked to do otheriwse*/ |
19511
ea26d30449fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19509
diff
changeset
|
141 if (!(msgflags & PURPLE_MESSAGE_INVISIBLE)) { |
ea26d30449fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19509
diff
changeset
|
142 if(msgflags & PURPLE_MESSAGE_NO_LINKIFY) |
ea26d30449fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19509
diff
changeset
|
143 displayed = g_strdup(message); |
ea26d30449fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19509
diff
changeset
|
144 else |
ea26d30449fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19509
diff
changeset
|
145 displayed = purple_markup_linkify(message); |
ea26d30449fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19509
diff
changeset
|
146 } |
ea26d30449fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19509
diff
changeset
|
147 |
ea26d30449fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19509
diff
changeset
|
148 if (displayed && (conv->features & PURPLE_CONNECTION_HTML) && |
ea26d30449fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19509
diff
changeset
|
149 !(msgflags & PURPLE_MESSAGE_RAW)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 sent = g_strdup(displayed); |
19511
ea26d30449fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19509
diff
changeset
|
151 } else |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 sent = g_strdup(message); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 |
15822 | 154 msgflags |= PURPLE_MESSAGE_SEND; |
155 | |
156 if (type == PURPLE_CONV_TYPE_IM) { | |
157 PurpleConvIm *im = PURPLE_CONV_IM(conv); | |
158 | |
159 purple_signal_emit(purple_conversations_get_handle(), "sending-im-msg", | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 account, |
15822 | 161 purple_conversation_get_name(conv), &sent); |
15373
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 if (sent != NULL && sent[0] != '\0') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 |
15822 | 165 err = serv_send_im(gc, purple_conversation_get_name(conv), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 sent, msgflags); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 if ((err > 0) && (displayed != NULL)) |
15822 | 169 purple_conv_im_write(im, NULL, displayed, msgflags, time(NULL)); |
170 | |
171 purple_signal_emit(purple_conversations_get_handle(), "sent-im-msg", | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 account, |
15822 | 173 purple_conversation_get_name(conv), sent); |
15373
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 else { |
15822 | 177 purple_signal_emit(purple_conversations_get_handle(), "sending-chat-msg", |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 account, &sent, |
15822 | 179 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv))); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 if (sent != NULL && sent[0] != '\0') { |
15822 | 182 err = serv_chat_send(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), sent, msgflags); |
183 | |
184 purple_signal_emit(purple_conversations_get_handle(), "sent-chat-msg", | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 account, sent, |
15822 | 186 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv))); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 if (err < 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 const char *who; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 const char *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 |
15822 | 194 who = purple_conversation_get_name(conv); |
15373
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 if (err == -E2BIG) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 msg = _("Unable to send message: The message is too large."); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 |
15822 | 199 if (!purple_conv_present_error(who, account, msg)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 char *msg2 = g_strdup_printf(_("Unable to send message to %s."), who); |
15822 | 201 purple_notify_error(gc, NULL, msg2, _("The message is too large.")); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 g_free(msg2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 else if (err == -ENOTCONN) { |
15822 | 206 purple_debug(PURPLE_DEBUG_ERROR, "conversation", |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 "Not yet connected.\n"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 msg = _("Unable to send message."); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 |
15822 | 212 if (!purple_conv_present_error(who, account, msg)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 char *msg2 = g_strdup_printf(_("Unable to send message to %s."), who); |
15822 | 214 purple_notify_error(gc, NULL, msg2, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 g_free(msg2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 g_free(displayed); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 g_free(sent); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 static void |
15822 | 225 open_log(PurpleConversation *conv) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 { |
15822 | 227 conv->logs = g_list_append(NULL, purple_log_new(conv->type == PURPLE_CONV_TYPE_CHAT ? PURPLE_LOG_CHAT : |
228 PURPLE_LOG_IM, conv->name, conv->account, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 conv, time(NULL), NULL)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 |
19413
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
232 /* Functions that deal with PurpleConvMessage */ |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
233 |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
234 static void |
21263
1812b8ccfd7a
Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21244
diff
changeset
|
235 add_message_to_history(PurpleConversation *conv, const char *who, const char *alias, |
1812b8ccfd7a
Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21244
diff
changeset
|
236 const char *message, PurpleMessageFlags flags, time_t when) |
19413
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
237 { |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
238 PurpleConvMessage *msg; |
22327
6fc8f0c825e0
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22262
diff
changeset
|
239 PurpleConnection *gc; |
6fc8f0c825e0
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22262
diff
changeset
|
240 |
6fc8f0c825e0
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22262
diff
changeset
|
241 gc = purple_account_get_connection(conv->account); |
19424
c17e41049b61
Do not duplicate the same message in the history, and store the correct
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19418
diff
changeset
|
242 |
c17e41049b61
Do not duplicate the same message in the history, and store the correct
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19418
diff
changeset
|
243 if (flags & PURPLE_MESSAGE_SEND) { |
c17e41049b61
Do not duplicate the same message in the history, and store the correct
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19418
diff
changeset
|
244 const char *me = NULL; |
22327
6fc8f0c825e0
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22262
diff
changeset
|
245 if (gc) |
6fc8f0c825e0
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22262
diff
changeset
|
246 me = purple_connection_get_display_name(gc); |
19424
c17e41049b61
Do not duplicate the same message in the history, and store the correct
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19418
diff
changeset
|
247 if (!me) |
c17e41049b61
Do not duplicate the same message in the history, and store the correct
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19418
diff
changeset
|
248 me = conv->account->username; |
c17e41049b61
Do not duplicate the same message in the history, and store the correct
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19418
diff
changeset
|
249 who = me; |
c17e41049b61
Do not duplicate the same message in the history, and store the correct
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19418
diff
changeset
|
250 } |
21263
1812b8ccfd7a
Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21244
diff
changeset
|
251 |
19413
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
252 msg = g_new0(PurpleConvMessage, 1); |
19418
b33c2b085e78
DBus-ify the message history in a conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19416
diff
changeset
|
253 PURPLE_DBUS_REGISTER_POINTER(msg, PurpleConvMessage); |
19413
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
254 msg->who = g_strdup(who); |
21263
1812b8ccfd7a
Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21244
diff
changeset
|
255 msg->alias = g_strdup(alias); |
19413
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
256 msg->flags = flags; |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
257 msg->what = g_strdup(message); |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
258 msg->when = when; |
20179
bd7244f3d491
Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20174
diff
changeset
|
259 msg->conv = conv; |
19413
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
260 |
19706
7ea794e7cec3
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
261 conv->message_history = g_list_prepend(conv->message_history, msg); |
19413
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
262 } |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
263 |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
264 static void |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
265 free_conv_message(PurpleConvMessage *msg) |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
266 { |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
267 g_free(msg->who); |
21263
1812b8ccfd7a
Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21244
diff
changeset
|
268 g_free(msg->alias); |
19413
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
269 g_free(msg->what); |
19418
b33c2b085e78
DBus-ify the message history in a conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19416
diff
changeset
|
270 PURPLE_DBUS_UNREGISTER_POINTER(msg); |
19413
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
271 g_free(msg); |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
272 } |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
273 |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
274 static void |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
275 message_history_free(GList *list) |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
276 { |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
277 g_list_foreach(list, (GFunc)free_conv_message, NULL); |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
278 g_list_free(list); |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
279 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 /************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 * Conversation API |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 **************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 static void |
15822 | 285 purple_conversation_chat_cleanup_for_rejoin(PurpleConversation *conv) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 const char *disp; |
15822 | 288 PurpleAccount *account; |
289 PurpleConnection *gc; | |
290 | |
291 account = purple_conversation_get_account(conv); | |
292 | |
293 purple_conversation_close_logs(conv); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 open_log(conv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 |
15822 | 296 gc = purple_account_get_connection(account); |
297 | |
298 if ((disp = purple_connection_get_display_name(gc)) != NULL) | |
299 purple_conv_chat_set_nick(PURPLE_CONV_CHAT(conv), disp); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 { |
15822 | 302 purple_conv_chat_set_nick(PURPLE_CONV_CHAT(conv), |
303 purple_account_get_username(account)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 |
15822 | 306 purple_conv_chat_clear_users(PURPLE_CONV_CHAT(conv)); |
307 purple_conv_chat_set_topic(PURPLE_CONV_CHAT(conv), NULL, NULL); | |
308 PURPLE_CONV_CHAT(conv)->left = FALSE; | |
309 | |
310 purple_conversation_update(conv, PURPLE_CONV_UPDATE_CHATLEFT); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 |
15822 | 313 PurpleConversation * |
314 purple_conversation_new(PurpleConversationType type, PurpleAccount *account, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 const char *name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 { |
15822 | 317 PurpleConversation *conv; |
318 PurpleConnection *gc; | |
319 PurpleConversationUiOps *ops; | |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
320 struct _purple_hconv *hc; |
15822 | 321 |
322 g_return_val_if_fail(type != PURPLE_CONV_TYPE_UNKNOWN, NULL); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 g_return_val_if_fail(name != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 /* Check if this conversation already exists. */ |
15822 | 327 if ((conv = purple_find_conversation_with_account(type, name, account)) != NULL) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 { |
27689
1082e1c25b30
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
329 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && |
1082e1c25b30
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
330 !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) { |
1082e1c25b30
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
331 purple_debug_warning("conversation", "Trying to create multiple " |
1082e1c25b30
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
332 "chats (%s) with the same name is deprecated and will be " |
1082e1c25b30
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
333 "removed in libpurple 3.0.0", name); |
1082e1c25b30
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
334 } |
1082e1c25b30
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
335 |
1082e1c25b30
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
336 /* |
1082e1c25b30
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
337 * This hack is necessary because some prpls (MSN) have unnamed chats |
1082e1c25b30
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
338 * that all use the same name. A PurpleConversation for one of those |
1082e1c25b30
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
339 * is only ever re-used if the user has left, so calls to |
1082e1c25b30
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
340 * purple_conversation_new need to fall-through to creating a new |
1082e1c25b30
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
341 * chat. |
1082e1c25b30
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
342 * TODO 3.0.0: Remove this workaround and mandate unique names. |
1082e1c25b30
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <paul@darkrain42.org>
parents:
27137
diff
changeset
|
343 */ |
22029
fbef14f35c78
I am going to go ahead and commit+push this revision/fix of purple_conversation_new.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
344 if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_CHAT || |
21263
1812b8ccfd7a
Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21244
diff
changeset
|
345 purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) |
22029
fbef14f35c78
I am going to go ahead and commit+push this revision/fix of purple_conversation_new.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
346 { |
fbef14f35c78
I am going to go ahead and commit+push this revision/fix of purple_conversation_new.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
347 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
fbef14f35c78
I am going to go ahead and commit+push this revision/fix of purple_conversation_new.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
348 purple_conversation_chat_cleanup_for_rejoin(conv); |
fbef14f35c78
I am going to go ahead and commit+push this revision/fix of purple_conversation_new.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
349 |
fbef14f35c78
I am going to go ahead and commit+push this revision/fix of purple_conversation_new.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
350 return conv; |
fbef14f35c78
I am going to go ahead and commit+push this revision/fix of purple_conversation_new.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
351 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 |
15822 | 354 gc = purple_account_get_connection(account); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 g_return_val_if_fail(gc != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 |
15822 | 357 conv = g_new0(PurpleConversation, 1); |
358 PURPLE_DBUS_REGISTER_POINTER(conv, PurpleConversation); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 conv->type = type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 conv->account = account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
362 conv->name = g_strdup(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
363 conv->title = g_strdup(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 conv->data = g_hash_table_new_full(g_str_hash, g_str_equal, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 g_free, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 /* copy features from the connection. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 conv->features = gc->flags; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 |
15822 | 369 if (type == PURPLE_CONV_TYPE_IM) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 { |
15822 | 371 PurpleBuddyIcon *icon; |
372 conv->u.im = g_new0(PurpleConvIm, 1); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 conv->u.im->conv = conv; |
15822 | 374 PURPLE_DBUS_REGISTER_POINTER(conv->u.im, PurpleConvIm); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
376 ims = g_list_prepend(ims, conv); |
15822 | 377 if ((icon = purple_buddy_icons_find(account, name))) |
16817
56823a55581a
Rework purple_buddy_icons_find() to return a reference for the caller, which
Richard Laager <rlaager@wiktel.com>
parents:
16475
diff
changeset
|
378 { |
15822 | 379 purple_conv_im_set_icon(conv->u.im, icon); |
16817
56823a55581a
Rework purple_buddy_icons_find() to return a reference for the caller, which
Richard Laager <rlaager@wiktel.com>
parents:
16475
diff
changeset
|
380 /* purple_conv_im_set_icon refs the icon. */ |
56823a55581a
Rework purple_buddy_icons_find() to return a reference for the caller, which
Richard Laager <rlaager@wiktel.com>
parents:
16475
diff
changeset
|
381 purple_buddy_icon_unref(icon); |
56823a55581a
Rework purple_buddy_icons_find() to return a reference for the caller, which
Richard Laager <rlaager@wiktel.com>
parents:
16475
diff
changeset
|
382 } |
15822 | 383 |
16424
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15822
diff
changeset
|
384 if (purple_prefs_get_bool("/purple/logging/log_ims")) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 { |
15822 | 386 purple_conversation_set_logging(conv, TRUE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 open_log(conv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 } |
15822 | 390 else if (type == PURPLE_CONV_TYPE_CHAT) |
15373
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 const char *disp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 |
15822 | 394 conv->u.chat = g_new0(PurpleConvChat, 1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 conv->u.chat->conv = conv; |
15822 | 396 PURPLE_DBUS_REGISTER_POINTER(conv->u.chat, PurpleConvChat); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
398 chats = g_list_prepend(chats, conv); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 |
15822 | 400 if ((disp = purple_connection_get_display_name(account->gc))) |
401 purple_conv_chat_set_nick(conv->u.chat, disp); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 else |
15822 | 403 purple_conv_chat_set_nick(conv->u.chat, |
404 purple_account_get_username(account)); | |
405 | |
16424
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15822
diff
changeset
|
406 if (purple_prefs_get_bool("/purple/logging/log_chats")) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 { |
15822 | 408 purple_conversation_set_logging(conv, TRUE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 open_log(conv); |
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 |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
413 conversations = g_list_prepend(conversations, conv); |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
414 |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
415 hc = g_new(struct _purple_hconv, 1); |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
416 hc->name = g_strdup(purple_normalize(account, conv->name)); |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
417 hc->account = account; |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
418 hc->type = type; |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
419 |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
420 g_hash_table_insert(conversation_cache, hc, conv); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 /* Auto-set the title. */ |
15822 | 423 purple_conversation_autoset_title(conv); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 /* Don't move this.. it needs to be one of the last things done otherwise |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 * it causes mysterious crashes on my system. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 * -- Gary |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 ops = conv->ui_ops = default_ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 if (ops != NULL && ops->create_conversation != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 ops->create_conversation(conv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 |
15822 | 433 purple_signal_emit(purple_conversations_get_handle(), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 "conversation-created", conv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 return conv; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 void |
15822 | 440 purple_conversation_destroy(PurpleConversation *conv) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 { |
15822 | 442 PurplePluginProtocolInfo *prpl_info = NULL; |
443 PurpleConversationUiOps *ops; | |
444 PurpleConnection *gc; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 const char *name; |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
446 struct _purple_hconv hc; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 g_return_if_fail(conv != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
449 |
15822 | 450 purple_request_close_with_handle(conv); |
451 | |
452 ops = purple_conversation_get_ui_ops(conv); | |
453 gc = purple_conversation_get_gc(conv); | |
454 name = purple_conversation_get_name(conv); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 if (gc != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 /* Still connected */ |
22262
edca47ee06c5
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22029
diff
changeset
|
459 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
15822 | 460 |
461 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 { |
16424
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15822
diff
changeset
|
463 if (purple_prefs_get_bool("/purple/conversations/im/send_typing")) |
15822 | 464 serv_send_typing(gc, name, PURPLE_NOT_TYPING); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 if (gc && prpl_info->convo_closed != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 prpl_info->convo_closed(gc, name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
468 } |
15822 | 469 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 { |
15822 | 471 int chat_id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 #if 0 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 * This is unfortunately necessary, because calling |
15822 | 475 * serv_chat_leave() calls this purple_conversation_destroy(), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 * which leads to two calls here.. We can't just return after |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 * this, because then it'll return on the next pass. So, since |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 * serv_got_chat_left(), which is eventually called from the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 * prpl that serv_chat_leave() calls, removes this conversation |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 * from the gc's buddy_chats list, we're going to check to see |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 * if this exists in the list. If so, we want to return after |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 * calling this, because it'll be called again. If not, fall |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 * through, because it'll have already been removed, and we'd |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 * be on the 2nd pass. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
485 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 * Long paragraph. <-- Short sentence. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
488 * -- ChipX86 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
490 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
491 if (gc && g_slist_find(gc->buddy_chats, conv) != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
492 serv_chat_leave(gc, chat_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 return; |
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 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 * Instead of all of that, lets just close the window when |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 * the user tells us to, and let the prpl deal with the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 * internals on it's own time. Don't do this if the prpl already |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 * knows it left the chat. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
502 */ |
15822 | 503 if (!purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
504 serv_chat_leave(gc, chat_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
505 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 * If they didn't call serv_got_chat_left by now, it's too late. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 * So we better do it for them before we destroy the thing. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 */ |
15822 | 510 if (!purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 serv_got_chat_left(gc, chat_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 /* remove from conversations and im/chats lists prior to emit */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
516 conversations = g_list_remove(conversations, conv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 |
15822 | 518 if(conv->type==PURPLE_CONV_TYPE_IM) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 ims = g_list_remove(ims, conv); |
15822 | 520 else if(conv->type==PURPLE_CONV_TYPE_CHAT) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
521 chats = g_list_remove(chats, conv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
523 hc.name = (gchar *)purple_normalize(conv->account, conv->name); |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
524 hc.account = conv->account; |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
525 hc.type = conv->type; |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
526 |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
527 g_hash_table_remove(conversation_cache, &hc); |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
528 |
15822 | 529 purple_signal_emit(purple_conversations_get_handle(), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 "deleting-conversation", conv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 g_free(conv->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
533 g_free(conv->title); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 conv->name = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 conv->title = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 |
15822 | 538 if (conv->type == PURPLE_CONV_TYPE_IM) { |
539 purple_conv_im_stop_typing_timeout(conv->u.im); | |
540 purple_conv_im_stop_send_typed_timeout(conv->u.im); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 |
16373
c9b4ff420140
The buddy icon code as it stands, with lots of bugs and design flaws.
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
542 purple_buddy_icon_unref(conv->u.im->icon); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
543 conv->u.im->icon = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
544 |
15822 | 545 PURPLE_DBUS_UNREGISTER_POINTER(conv->u.im); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
546 g_free(conv->u.im); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 conv->u.im = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 } |
15822 | 549 else if (conv->type == PURPLE_CONV_TYPE_CHAT) { |
550 | |
551 g_list_foreach(conv->u.chat->in_room, (GFunc)purple_conv_chat_cb_destroy, NULL); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 g_list_free(conv->u.chat->in_room); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 g_list_foreach(conv->u.chat->ignored, (GFunc)g_free, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 g_list_free(conv->u.chat->ignored); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 conv->u.chat->in_room = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 conv->u.chat->ignored = NULL; |
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 g_free(conv->u.chat->who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 conv->u.chat->who = NULL; |
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 g_free(conv->u.chat->topic); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 conv->u.chat->topic = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 g_free(conv->u.chat->nick); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 |
15822 | 568 PURPLE_DBUS_UNREGISTER_POINTER(conv->u.chat); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 g_free(conv->u.chat); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 conv->u.chat = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 g_hash_table_destroy(conv->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 conv->data = NULL; |
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 (ops != NULL && ops->destroy_conversation != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 ops->destroy_conversation(conv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 |
15822 | 579 purple_conversation_close_logs(conv); |
580 | |
19413
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
581 purple_conversation_clear_message_history(conv); |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
582 |
15822 | 583 PURPLE_DBUS_UNREGISTER_POINTER(conv); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 g_free(conv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 conv = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
586 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
587 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
588 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 void |
15822 | 590 purple_conversation_present(PurpleConversation *conv) { |
591 PurpleConversationUiOps *ops; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
592 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 g_return_if_fail(conv != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 |
15822 | 595 ops = purple_conversation_get_ui_ops(conv); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 if(ops && ops->present) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 ops->present(conv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 void |
15822 | 602 purple_conversation_set_features(PurpleConversation *conv, PurpleConnectionFlags features) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 g_return_if_fail(conv != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 conv->features = features; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 |
15822 | 608 purple_conversation_update(conv, PURPLE_CONV_UPDATE_FEATURES); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 |
15822 | 612 PurpleConnectionFlags |
613 purple_conversation_get_features(PurpleConversation *conv) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 g_return_val_if_fail(conv != NULL, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 return conv->features; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 |
15822 | 620 PurpleConversationType |
621 purple_conversation_get_type(const PurpleConversation *conv) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 { |
15822 | 623 g_return_val_if_fail(conv != NULL, PURPLE_CONV_TYPE_UNKNOWN); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 return conv->type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 void |
15822 | 629 purple_conversation_set_ui_ops(PurpleConversation *conv, |
630 PurpleConversationUiOps *ops) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 g_return_if_fail(conv != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 if (conv->ui_ops == ops) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 if (conv->ui_ops != NULL && conv->ui_ops->destroy_conversation != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 conv->ui_ops->destroy_conversation(conv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 conv->ui_data = NULL; |
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 conv->ui_ops = ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
644 |
15822 | 645 PurpleConversationUiOps * |
646 purple_conversation_get_ui_ops(const PurpleConversation *conv) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 g_return_val_if_fail(conv != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 return conv->ui_ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 void |
15822 | 654 purple_conversation_set_account(PurpleConversation *conv, PurpleAccount *account) |
15373
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 g_return_if_fail(conv != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 |
15822 | 658 if (account == purple_conversation_get_account(conv)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 conv->account = account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 |
15822 | 663 purple_conversation_update(conv, PURPLE_CONV_UPDATE_ACCOUNT); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 |
15822 | 666 PurpleAccount * |
667 purple_conversation_get_account(const PurpleConversation *conv) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 g_return_val_if_fail(conv != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 return conv->account; |
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 |
15822 | 674 PurpleConnection * |
675 purple_conversation_get_gc(const PurpleConversation *conv) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 { |
15822 | 677 PurpleAccount *account; |
15373
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 g_return_val_if_fail(conv != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 |
15822 | 681 account = purple_conversation_get_account(conv); |
15373
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 if (account == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
685 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 return account->gc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
688 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
689 void |
15822 | 690 purple_conversation_set_title(PurpleConversation *conv, const char *title) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
691 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 g_return_if_fail(conv != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 g_return_if_fail(title != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
695 g_free(conv->title); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 conv->title = g_strdup(title); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 |
15822 | 698 purple_conversation_update(conv, PURPLE_CONV_UPDATE_TITLE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
699 } |
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 const char * |
15822 | 702 purple_conversation_get_title(const PurpleConversation *conv) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 g_return_val_if_fail(conv != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
705 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
706 return conv->title; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
707 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
708 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 void |
15822 | 710 purple_conversation_autoset_title(PurpleConversation *conv) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 { |
15822 | 712 PurpleAccount *account; |
713 PurpleBuddy *b; | |
714 PurpleChat *chat; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 const char *text = NULL, *name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 g_return_if_fail(conv != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 |
15822 | 719 account = purple_conversation_get_account(conv); |
720 name = purple_conversation_get_name(conv); | |
721 | |
722 if(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { | |
723 if(account && ((b = purple_find_buddy(account, name)) != NULL)) | |
724 text = purple_buddy_get_contact_alias(b); | |
725 } else if(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { | |
726 if(account && ((chat = purple_blist_find_chat(account, name)) != NULL)) | |
25808
5ebfa814b9e8
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
23720
diff
changeset
|
727 text = purple_chat_get_name(chat); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
728 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
731 if(text == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 text = name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 |
15822 | 734 purple_conversation_set_title(conv, text); |
15373
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
737 void |
15822 | 738 purple_conversation_foreach(void (*func)(PurpleConversation *conv)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
739 { |
15822 | 740 PurpleConversation *conv; |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
741 GList *l; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
742 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
743 g_return_if_fail(func != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
744 |
15822 | 745 for (l = purple_get_conversations(); l != NULL; l = l->next) { |
746 conv = (PurpleConversation *)l->data; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
748 func(conv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
749 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
750 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
751 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
752 void |
15822 | 753 purple_conversation_set_name(PurpleConversation *conv, const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
754 { |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
755 struct _purple_hconv *hc; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
756 g_return_if_fail(conv != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
757 |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
758 hc = g_new(struct _purple_hconv, 1); |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
759 hc->type = conv->type; |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
760 hc->account = conv->account; |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
761 hc->name = (gchar *)purple_normalize(conv->account, conv->name); |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
762 |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
763 g_hash_table_remove(conversation_cache, hc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
764 g_free(conv->name); |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
765 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
766 conv->name = g_strdup(name); |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
767 hc->name = g_strdup(purple_normalize(conv->account, conv->name)); |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
768 g_hash_table_insert(conversation_cache, hc, conv); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
769 |
15822 | 770 purple_conversation_autoset_title(conv); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
771 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
772 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
773 const char * |
15822 | 774 purple_conversation_get_name(const PurpleConversation *conv) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 g_return_val_if_fail(conv != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
777 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 return conv->name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
780 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
781 void |
15822 | 782 purple_conversation_set_logging(PurpleConversation *conv, gboolean log) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
784 g_return_if_fail(conv != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
785 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
786 if (conv->logging != log) |
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 conv->logging = log; |
15822 | 789 purple_conversation_update(conv, PURPLE_CONV_UPDATE_LOGGING); |
15373
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
792 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
793 gboolean |
15822 | 794 purple_conversation_is_logging(const PurpleConversation *conv) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
795 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
796 g_return_val_if_fail(conv != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
797 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
798 return conv->logging; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
799 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
800 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
801 void |
15822 | 802 purple_conversation_close_logs(PurpleConversation *conv) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
803 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 g_return_if_fail(conv != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
805 |
15822 | 806 g_list_foreach(conv->logs, (GFunc)purple_log_free, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
807 g_list_free(conv->logs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
808 conv->logs = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
809 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
810 |
15822 | 811 PurpleConvIm * |
812 purple_conversation_get_im_data(const PurpleConversation *conv) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
813 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
814 g_return_val_if_fail(conv != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
815 |
15822 | 816 if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_IM) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
817 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
818 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 return conv->u.im; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
820 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
821 |
15822 | 822 PurpleConvChat * |
823 purple_conversation_get_chat_data(const PurpleConversation *conv) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
824 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
825 g_return_val_if_fail(conv != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
826 |
15822 | 827 if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_CHAT) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
828 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
829 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
830 return conv->u.chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
832 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 void |
15822 | 834 purple_conversation_set_data(PurpleConversation *conv, const char *key, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
835 gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
837 g_return_if_fail(conv != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
838 g_return_if_fail(key != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
839 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
840 g_hash_table_replace(conv->data, g_strdup(key), data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
841 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
842 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
843 gpointer |
15822 | 844 purple_conversation_get_data(PurpleConversation *conv, const char *key) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
845 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
846 g_return_val_if_fail(conv != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
847 g_return_val_if_fail(key != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
848 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 return g_hash_table_lookup(conv->data, key); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
850 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
852 GList * |
15822 | 853 purple_get_conversations(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
854 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 return conversations; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
856 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
858 GList * |
15822 | 859 purple_get_ims(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
860 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 return ims; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
862 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
863 |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
864 GList * |
15822 | 865 purple_get_chats(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
866 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
867 return chats; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
868 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
869 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
870 |
15822 | 871 PurpleConversation * |
872 purple_find_conversation_with_account(PurpleConversationType type, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
873 const char *name, |
15822 | 874 const PurpleAccount *account) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
875 { |
15822 | 876 PurpleConversation *c = NULL; |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
877 struct _purple_hconv hc; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
878 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
879 g_return_val_if_fail(name != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
880 |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
881 hc.name = (gchar *)purple_normalize(account, name); |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
882 hc.account = account; |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
883 hc.type = type; |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
884 |
22839
f67edee0224e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22757
diff
changeset
|
885 switch (type) { |
f67edee0224e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22757
diff
changeset
|
886 case PURPLE_CONV_TYPE_IM: |
f67edee0224e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22757
diff
changeset
|
887 case PURPLE_CONV_TYPE_CHAT: |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
888 c = g_hash_table_lookup(conversation_cache, &hc); |
22839
f67edee0224e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22757
diff
changeset
|
889 break; |
f67edee0224e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22757
diff
changeset
|
890 case PURPLE_CONV_TYPE_ANY: |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
891 hc.type = PURPLE_CONV_TYPE_IM; |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
892 c = g_hash_table_lookup(conversation_cache, &hc); |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
893 if (!c) { |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
894 hc.type = PURPLE_CONV_TYPE_CHAT; |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
895 c = g_hash_table_lookup(conversation_cache, &hc); |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
896 } |
22839
f67edee0224e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22757
diff
changeset
|
897 break; |
f67edee0224e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22757
diff
changeset
|
898 default: |
f67edee0224e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22757
diff
changeset
|
899 g_return_val_if_reached(NULL); |
f67edee0224e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22757
diff
changeset
|
900 } |
f67edee0224e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22757
diff
changeset
|
901 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
902 return c; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
903 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
904 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
905 void |
15822 | 906 purple_conversation_write(PurpleConversation *conv, const char *who, |
907 const char *message, PurpleMessageFlags flags, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
908 time_t mtime) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
909 { |
15822 | 910 PurplePluginProtocolInfo *prpl_info = NULL; |
911 PurpleConnection *gc = NULL; | |
912 PurpleAccount *account; | |
913 PurpleConversationUiOps *ops; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
914 const char *alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
915 char *displayed = NULL; |
15822 | 916 PurpleBuddy *b; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
917 int plugin_return; |
15822 | 918 PurpleConversationType type; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
919 /* int logging_font_options = 0; */ |
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 g_return_if_fail(conv != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
922 g_return_if_fail(message != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
923 |
15822 | 924 ops = purple_conversation_get_ui_ops(conv); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
925 |
15822 | 926 account = purple_conversation_get_account(conv); |
927 type = purple_conversation_get_type(conv); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
928 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
929 if (account != NULL) |
15822 | 930 gc = purple_account_get_connection(account); |
931 | |
932 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && | |
22662
f75509f776cc
When you try to execute a command (e.g., /part etc.) in a chat on a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22327
diff
changeset
|
933 (gc != NULL && !g_slist_find(gc->buddy_chats, conv))) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
934 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
935 |
15822 | 936 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
937 !g_list_find(purple_get_conversations(), conv)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
938 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
939 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
940 displayed = g_strdup(message); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
941 |
19606
e918e38a56b0
writing-im-msg now receives the conversation name as the who argument if
Richard Laager <rlaager@wiktel.com>
parents:
19511
diff
changeset
|
942 if (who == NULL || *who == '\0') |
e918e38a56b0
writing-im-msg now receives the conversation name as the who argument if
Richard Laager <rlaager@wiktel.com>
parents:
19511
diff
changeset
|
943 who = purple_conversation_get_name(conv); |
e918e38a56b0
writing-im-msg now receives the conversation name as the who argument if
Richard Laager <rlaager@wiktel.com>
parents:
19511
diff
changeset
|
944 alias = who; |
e918e38a56b0
writing-im-msg now receives the conversation name as the who argument if
Richard Laager <rlaager@wiktel.com>
parents:
19511
diff
changeset
|
945 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
946 plugin_return = |
15822 | 947 GPOINTER_TO_INT(purple_signal_emit_return_1( |
948 purple_conversations_get_handle(), | |
949 (type == PURPLE_CONV_TYPE_IM ? "writing-im-msg" : "writing-chat-msg"), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
950 account, who, &displayed, conv, flags)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
951 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
952 if (displayed == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
953 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
954 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
955 if (plugin_return) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
956 g_free(displayed); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
957 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
958 } |
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 if (account != NULL) { |
15822 | 961 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(account))); |
962 | |
963 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM || | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
964 !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
965 |
15822 | 966 if (flags & PURPLE_MESSAGE_SEND) { |
967 b = purple_find_buddy(account, | |
968 purple_account_get_username(account)); | |
969 | |
970 if (purple_account_get_alias(account) != NULL) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
971 alias = account->alias; |
25894
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25808
diff
changeset
|
972 else if (b != NULL && !purple_strequal(purple_buddy_get_name(b), purple_buddy_get_contact_alias(b))) |
15822 | 973 alias = purple_buddy_get_contact_alias(b); |
974 else if (purple_connection_get_display_name(gc) != NULL) | |
975 alias = purple_connection_get_display_name(gc); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
976 else |
15822 | 977 alias = purple_account_get_username(account); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
978 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
979 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
980 { |
15822 | 981 b = purple_find_buddy(account, who); |
15373
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 if (b != NULL) |
15822 | 984 alias = purple_buddy_get_contact_alias(b); |
15373
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 } |
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 |
15822 | 989 if (!(flags & PURPLE_MESSAGE_NO_LOG) && purple_conversation_is_logging(conv)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
990 GList *log; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
991 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
992 if (conv->logs == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
993 open_log(conv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
994 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
995 log = conv->logs; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
996 while (log != NULL) { |
15822 | 997 purple_log_write((PurpleLog *)log->data, flags, alias, mtime, displayed); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
998 log = log->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
999 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1000 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1001 |
15822 | 1002 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
1003 if ((flags & PURPLE_MESSAGE_RECV) == PURPLE_MESSAGE_RECV) { | |
1004 purple_conv_im_set_typing_state(PURPLE_CONV_IM(conv), PURPLE_NOT_TYPING); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1005 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1006 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1007 |
19416
3489182dc187
A conversation shouldn't need ui-ops for logging the messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19413
diff
changeset
|
1008 if (ops && ops->write_conv) |
3489182dc187
A conversation shouldn't need ui-ops for logging the messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19413
diff
changeset
|
1009 ops->write_conv(conv, who, alias, displayed, flags, mtime); |
21263
1812b8ccfd7a
Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21244
diff
changeset
|
1010 |
1812b8ccfd7a
Show alias in restored conversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21244
diff
changeset
|
1011 add_message_to_history(conv, who, alias, message, flags, mtime); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1012 |
15822 | 1013 purple_signal_emit(purple_conversations_get_handle(), |
1014 (type == PURPLE_CONV_TYPE_IM ? "wrote-im-msg" : "wrote-chat-msg"), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1015 account, who, displayed, conv, flags); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1016 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1017 g_free(displayed); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1018 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1019 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1020 gboolean |
15822 | 1021 purple_conversation_has_focus(PurpleConversation *conv) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1022 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1023 gboolean ret = FALSE; |
15822 | 1024 PurpleConversationUiOps *ops; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1025 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1026 g_return_val_if_fail(conv != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1027 |
15822 | 1028 ops = purple_conversation_get_ui_ops(conv); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1029 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1030 if (ops != NULL && ops->has_focus != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1031 ret = ops->has_focus(conv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1032 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1033 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1034 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1035 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1036 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1037 * TODO: Need to make sure calls to this function happen in the core |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1038 * instead of the UI. That way UIs have less work to do, and the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1039 * core/UI split is cleaner. Also need to make sure this is called |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1040 * when chats are added/removed from the blist. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1041 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1042 void |
15822 | 1043 purple_conversation_update(PurpleConversation *conv, PurpleConvUpdateType type) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1044 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1045 g_return_if_fail(conv != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1046 |
15822 | 1047 purple_signal_emit(purple_conversations_get_handle(), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1048 "conversation-updated", conv, type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1049 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1050 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1051 /************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1052 * IM Conversation API |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1053 **************************************************************************/ |
15822 | 1054 PurpleConversation * |
1055 purple_conv_im_get_conversation(const PurpleConvIm *im) | |
15373
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 g_return_val_if_fail(im != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1058 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1059 return im->conv; |
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 void |
15822 | 1063 purple_conv_im_set_icon(PurpleConvIm *im, PurpleBuddyIcon *icon) |
15373
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 g_return_if_fail(im != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1066 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1067 if (im->icon != icon) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1068 { |
16373
c9b4ff420140
The buddy icon code as it stands, with lots of bugs and design flaws.
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
1069 purple_buddy_icon_unref(im->icon); |
15822 | 1070 |
1071 im->icon = (icon == NULL ? NULL : purple_buddy_icon_ref(icon)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1072 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1073 |
15822 | 1074 purple_conversation_update(purple_conv_im_get_conversation(im), |
1075 PURPLE_CONV_UPDATE_ICON); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1076 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1077 |
15822 | 1078 PurpleBuddyIcon * |
1079 purple_conv_im_get_icon(const PurpleConvIm *im) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1080 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1081 g_return_val_if_fail(im != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1082 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1083 return im->icon; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1084 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1085 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1086 void |
15822 | 1087 purple_conv_im_set_typing_state(PurpleConvIm *im, PurpleTypingState state) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1088 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1089 g_return_if_fail(im != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1090 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1091 if (im->typing_state != state) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1092 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1093 im->typing_state = state; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1094 |
17059
73556f13c3b5
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evan.s@dreskin.net>
parents:
16817
diff
changeset
|
1095 switch (state) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1096 { |
17059
73556f13c3b5
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evan.s@dreskin.net>
parents:
16817
diff
changeset
|
1097 case PURPLE_TYPING: |
73556f13c3b5
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evan.s@dreskin.net>
parents:
16817
diff
changeset
|
1098 purple_signal_emit(purple_conversations_get_handle(), |
73556f13c3b5
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evan.s@dreskin.net>
parents:
16817
diff
changeset
|
1099 "buddy-typing", im->conv->account, im->conv->name); |
73556f13c3b5
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evan.s@dreskin.net>
parents:
16817
diff
changeset
|
1100 break; |
73556f13c3b5
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evan.s@dreskin.net>
parents:
16817
diff
changeset
|
1101 case PURPLE_TYPED: |
73556f13c3b5
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evan.s@dreskin.net>
parents:
16817
diff
changeset
|
1102 purple_signal_emit(purple_conversations_get_handle(), |
73556f13c3b5
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evan.s@dreskin.net>
parents:
16817
diff
changeset
|
1103 "buddy-typed", im->conv->account, im->conv->name); |
73556f13c3b5
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evan.s@dreskin.net>
parents:
16817
diff
changeset
|
1104 break; |
73556f13c3b5
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evan.s@dreskin.net>
parents:
16817
diff
changeset
|
1105 case PURPLE_NOT_TYPING: |
73556f13c3b5
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evan.s@dreskin.net>
parents:
16817
diff
changeset
|
1106 purple_signal_emit(purple_conversations_get_handle(), |
73556f13c3b5
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evan.s@dreskin.net>
parents:
16817
diff
changeset
|
1107 "buddy-typing-stopped", im->conv->account, im->conv->name); |
73556f13c3b5
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evan.s@dreskin.net>
parents:
16817
diff
changeset
|
1108 break; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1109 } |
27033
2ab648c328cc
Consistently emit conversation-updated for typing state changes.
Florian Quèze <florian@instantbird.org>
parents:
26721
diff
changeset
|
1110 |
2ab648c328cc
Consistently emit conversation-updated for typing state changes.
Florian Quèze <florian@instantbird.org>
parents:
26721
diff
changeset
|
1111 purple_conv_im_update_typing(im); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1112 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1113 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1114 |
15822 | 1115 PurpleTypingState |
1116 purple_conv_im_get_typing_state(const PurpleConvIm *im) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1117 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1118 g_return_val_if_fail(im != NULL, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1119 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1120 return im->typing_state; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1121 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1122 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1123 void |
15822 | 1124 purple_conv_im_start_typing_timeout(PurpleConvIm *im, int timeout) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1125 { |
15822 | 1126 PurpleConversation *conv; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1127 const char *name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1128 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1129 g_return_if_fail(im != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1130 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1131 if (im->typing_timeout > 0) |
15822 | 1132 purple_conv_im_stop_typing_timeout(im); |
1133 | |
1134 conv = purple_conv_im_get_conversation(im); | |
1135 name = purple_conversation_get_name(conv); | |
1136 | |
18006
f2d8658b3a86
merge of '62e9d17cd37551991c5040ce6ca48e6d7578dde3'
Richard Laager <rlaager@wiktel.com>
parents:
17082
diff
changeset
|
1137 im->typing_timeout = purple_timeout_add_seconds(timeout, reset_typing_cb, conv); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1138 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1139 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1140 void |
15822 | 1141 purple_conv_im_stop_typing_timeout(PurpleConvIm *im) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1142 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1143 g_return_if_fail(im != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1144 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1145 if (im->typing_timeout == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1146 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1147 |
15822 | 1148 purple_timeout_remove(im->typing_timeout); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1149 im->typing_timeout = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1150 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1151 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1152 guint |
15822 | 1153 purple_conv_im_get_typing_timeout(const PurpleConvIm *im) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1154 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1155 g_return_val_if_fail(im != NULL, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1156 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1157 return im->typing_timeout; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1158 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1159 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1160 void |
15822 | 1161 purple_conv_im_set_type_again(PurpleConvIm *im, unsigned int val) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1162 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1163 g_return_if_fail(im != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1164 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1165 if (val == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1166 im->type_again = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1167 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1168 im->type_again = time(NULL) + val; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1169 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1170 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1171 time_t |
15822 | 1172 purple_conv_im_get_type_again(const PurpleConvIm *im) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1173 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1174 g_return_val_if_fail(im != NULL, 0); |
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 im->type_again; |
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 void |
15822 | 1180 purple_conv_im_start_send_typed_timeout(PurpleConvIm *im) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1181 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1182 g_return_if_fail(im != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1183 |
25576
7f552614ec8a
applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents:
23720
diff
changeset
|
1184 im->send_typed_timeout = purple_timeout_add_seconds(SEND_TYPED_TIMEOUT_SECONDS, |
7f552614ec8a
applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents:
23720
diff
changeset
|
1185 send_typed_cb, |
7f552614ec8a
applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents:
23720
diff
changeset
|
1186 purple_conv_im_get_conversation(im)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1187 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1188 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1189 void |
15822 | 1190 purple_conv_im_stop_send_typed_timeout(PurpleConvIm *im) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1191 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1192 g_return_if_fail(im != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1193 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1194 if (im->send_typed_timeout == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1195 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1196 |
15822 | 1197 purple_timeout_remove(im->send_typed_timeout); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1198 im->send_typed_timeout = 0; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1201 guint |
15822 | 1202 purple_conv_im_get_send_typed_timeout(const PurpleConvIm *im) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1203 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1204 g_return_val_if_fail(im != NULL, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1205 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1206 return im->send_typed_timeout; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1207 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1208 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1209 void |
15822 | 1210 purple_conv_im_update_typing(PurpleConvIm *im) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1211 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1212 g_return_if_fail(im != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1213 |
15822 | 1214 purple_conversation_update(purple_conv_im_get_conversation(im), |
1215 PURPLE_CONV_UPDATE_TYPING); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1216 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1217 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1218 void |
15822 | 1219 purple_conv_im_write(PurpleConvIm *im, const char *who, const char *message, |
1220 PurpleMessageFlags flags, time_t mtime) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1221 { |
15822 | 1222 PurpleConversation *c; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1223 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1224 g_return_if_fail(im != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1225 g_return_if_fail(message != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1226 |
15822 | 1227 c = purple_conv_im_get_conversation(im); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1228 |
18823
e1062ac14080
Correct an inaccurate comment.
Will Thompson <will.thompson@collabora.co.uk>
parents:
18496
diff
changeset
|
1229 /* Pass this on to either the ops structure or the default write func. */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1230 if (c->ui_ops != NULL && c->ui_ops->write_im != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1231 c->ui_ops->write_im(c, who, message, flags, mtime); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1232 else |
15822 | 1233 purple_conversation_write(c, who, message, flags, mtime); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1234 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1235 |
15822 | 1236 gboolean purple_conv_present_error(const char *who, PurpleAccount *account, const char *what) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1237 { |
15822 | 1238 PurpleConversation *conv; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1239 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1240 g_return_val_if_fail(who != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1241 g_return_val_if_fail(account !=NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1242 g_return_val_if_fail(what != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1243 |
15822 | 1244 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, who, account); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1245 if (conv != NULL) |
15822 | 1246 purple_conversation_write(conv, NULL, what, PURPLE_MESSAGE_ERROR, time(NULL)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1247 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1248 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1249 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1250 return TRUE; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1253 void |
15822 | 1254 purple_conv_im_send(PurpleConvIm *im, const char *message) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1255 { |
15822 | 1256 purple_conv_im_send_with_flags(im, message, 0); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1257 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1258 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1259 static void |
15822 | 1260 purple_conv_send_confirm_cb(gpointer *data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1261 { |
15822 | 1262 PurpleConversation *conv = data[0]; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1263 char *message = data[1]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1264 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1265 g_free(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1266 common_send(conv, message, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1267 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1268 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1269 void |
15822 | 1270 purple_conv_send_confirm(PurpleConversation *conv, const char *message) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1271 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1272 char *text; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1273 gpointer *data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1274 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1275 g_return_if_fail(conv != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1276 g_return_if_fail(message != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1277 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1278 if (conv->ui_ops != NULL && conv->ui_ops->send_confirm != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1279 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1280 conv->ui_ops->send_confirm(conv, message); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1281 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1282 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1283 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1284 text = g_strdup_printf("You are about to send the following message:\n%s", message); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1285 data = g_new0(gpointer, 2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1286 data[0] = conv; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1287 data[1] = (gpointer)message; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1288 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1289 purple_request_action(conv, NULL, _("Send Message"), text, 0, |
16439
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
1290 purple_conversation_get_account(conv), NULL, conv, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
1291 data, 2, |
16439
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
1292 _("_Send Message"), G_CALLBACK(purple_conv_send_confirm_cb), |
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
1293 _("Cancel"), NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1294 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1295 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1296 void |
15822 | 1297 purple_conv_im_send_with_flags(PurpleConvIm *im, const char *message, PurpleMessageFlags flags) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1298 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1299 g_return_if_fail(im != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1300 g_return_if_fail(message != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1301 |
15822 | 1302 common_send(purple_conv_im_get_conversation(im), message, flags); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1303 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1304 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1305 gboolean |
15822 | 1306 purple_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1307 const char *cksum_type, const char *chksum, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1308 gboolean remote) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1309 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1310 if (conv == NULL || smile == NULL || !*smile) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1311 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1312 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1313 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1314 /* TODO: check if the icon is in the cache and return false if so */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1315 /* TODO: add an icon cache (that doesn't suck) */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1316 if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_add !=NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1317 return conv->ui_ops->custom_smiley_add(conv, smile, remote); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1318 } else { |
15822 | 1319 purple_debug_info("conversation", "Could not find add custom smiley function"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1320 return FALSE; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1323 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1324 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1325 void |
15822 | 1326 purple_conv_custom_smiley_write(PurpleConversation *conv, const char *smile, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1327 const guchar *data, gsize size) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1328 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1329 g_return_if_fail(conv != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1330 g_return_if_fail(smile != NULL && *smile); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1331 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1332 if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_write != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1333 conv->ui_ops->custom_smiley_write(conv, smile, data, size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1334 else |
15822 | 1335 purple_debug_info("conversation", "Could not find the smiley write function"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1336 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1337 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1338 void |
15822 | 1339 purple_conv_custom_smiley_close(PurpleConversation *conv, const char *smile) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1340 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1341 g_return_if_fail(conv != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1342 g_return_if_fail(smile != NULL && *smile); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1343 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1344 if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_close != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1345 conv->ui_ops->custom_smiley_close(conv, smile); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1346 else |
15822 | 1347 purple_debug_info("conversation", "Could not find custom smiley close function"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1348 } |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1351 /************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1352 * Chat Conversation API |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1353 **************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1354 |
15822 | 1355 PurpleConversation * |
1356 purple_conv_chat_get_conversation(const PurpleConvChat *chat) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1357 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1358 g_return_val_if_fail(chat != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1359 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1360 return chat->conv; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1361 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1362 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1363 GList * |
15822 | 1364 purple_conv_chat_set_users(PurpleConvChat *chat, GList *users) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1365 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1366 g_return_val_if_fail(chat != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1367 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1368 chat->in_room = users; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1369 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1370 return users; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1371 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1372 |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
1373 GList * |
15822 | 1374 purple_conv_chat_get_users(const PurpleConvChat *chat) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1375 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1376 g_return_val_if_fail(chat != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1377 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1378 return chat->in_room; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1379 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1380 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1381 void |
15822 | 1382 purple_conv_chat_ignore(PurpleConvChat *chat, const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1383 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1384 g_return_if_fail(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1385 g_return_if_fail(name != NULL); |
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 /* Make sure the user isn't already ignored. */ |
15822 | 1388 if (purple_conv_chat_is_user_ignored(chat, name)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1389 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1390 |
15822 | 1391 purple_conv_chat_set_ignored(chat, |
18115
871d9aa8e51c
Re-apply a good change from 1411afd7660760db59966c3a9f18e2adab8eb27e:
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
1392 g_list_append(chat->ignored, g_strdup(name))); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1393 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1394 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1395 void |
15822 | 1396 purple_conv_chat_unignore(PurpleConvChat *chat, const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1397 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1398 GList *item; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1399 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1400 g_return_if_fail(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1401 g_return_if_fail(name != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1402 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1403 /* Make sure the user is actually ignored. */ |
15822 | 1404 if (!purple_conv_chat_is_user_ignored(chat, name)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1405 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1406 |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
1407 item = g_list_find(purple_conv_chat_get_ignored(chat), |
15822 | 1408 purple_conv_chat_get_ignored_user(chat, name)); |
1409 | |
1410 purple_conv_chat_set_ignored(chat, | |
18115
871d9aa8e51c
Re-apply a good change from 1411afd7660760db59966c3a9f18e2adab8eb27e:
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
1411 g_list_remove_link(chat->ignored, item)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1412 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1413 g_free(item->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1414 g_list_free_1(item); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1415 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1416 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1417 GList * |
15822 | 1418 purple_conv_chat_set_ignored(PurpleConvChat *chat, GList *ignored) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1419 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1420 g_return_val_if_fail(chat != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1421 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1422 chat->ignored = ignored; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1423 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1424 return ignored; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1425 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1426 |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
1427 GList * |
15822 | 1428 purple_conv_chat_get_ignored(const PurpleConvChat *chat) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1429 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1430 g_return_val_if_fail(chat != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1431 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1432 return chat->ignored; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1433 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1434 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1435 const char * |
15822 | 1436 purple_conv_chat_get_ignored_user(const PurpleConvChat *chat, const char *user) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1437 { |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
1438 GList *ignored; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1439 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1440 g_return_val_if_fail(chat != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1441 g_return_val_if_fail(user != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1442 |
15822 | 1443 for (ignored = purple_conv_chat_get_ignored(chat); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1444 ignored != NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1445 ignored = ignored->next) { |
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 const char *ign = (const char *)ignored->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1448 |
15822 | 1449 if (!purple_utf8_strcasecmp(user, ign) || |
1450 ((*ign == '+' || *ign == '%') && !purple_utf8_strcasecmp(user, ign + 1))) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1451 return ign; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1452 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1453 if (*ign == '@') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1454 ign++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1455 |
15822 | 1456 if ((*ign == '+' && !purple_utf8_strcasecmp(user, ign + 1)) || |
1457 (*ign != '+' && !purple_utf8_strcasecmp(user, ign))) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1458 return ign; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1459 } |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1462 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1463 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1464 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1465 gboolean |
15822 | 1466 purple_conv_chat_is_user_ignored(const PurpleConvChat *chat, const char *user) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1467 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1468 g_return_val_if_fail(chat != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1469 g_return_val_if_fail(user != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1470 |
15822 | 1471 return (purple_conv_chat_get_ignored_user(chat, user) != NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1472 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1473 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1474 void |
15822 | 1475 purple_conv_chat_set_topic(PurpleConvChat *chat, const char *who, const char *topic) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1476 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1477 g_return_if_fail(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1478 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1479 g_free(chat->who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1480 g_free(chat->topic); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1481 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1482 chat->who = g_strdup(who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1483 chat->topic = g_strdup(topic); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1484 |
15822 | 1485 purple_conversation_update(purple_conv_chat_get_conversation(chat), |
1486 PURPLE_CONV_UPDATE_TOPIC); | |
1487 | |
1488 purple_signal_emit(purple_conversations_get_handle(), "chat-topic-changed", | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1489 chat->conv, chat->who, chat->topic); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1490 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1491 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1492 const char * |
15822 | 1493 purple_conv_chat_get_topic(const PurpleConvChat *chat) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1494 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1495 g_return_val_if_fail(chat != NULL, NULL); |
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 return chat->topic; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1498 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1499 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1500 void |
15822 | 1501 purple_conv_chat_set_id(PurpleConvChat *chat, int id) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1502 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1503 g_return_if_fail(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1504 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1505 chat->id = id; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1506 } |
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 int |
15822 | 1509 purple_conv_chat_get_id(const PurpleConvChat *chat) |
15373
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 g_return_val_if_fail(chat != NULL, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1512 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1513 return chat->id; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1514 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1515 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1516 void |
15822 | 1517 purple_conv_chat_write(PurpleConvChat *chat, const char *who, const char *message, |
1518 PurpleMessageFlags flags, time_t mtime) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1519 { |
15822 | 1520 PurpleAccount *account; |
1521 PurpleConversation *conv; | |
1522 PurpleConnection *gc; | |
1523 PurplePluginProtocolInfo *prpl_info; | |
15373
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 g_return_if_fail(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1526 g_return_if_fail(who != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1527 g_return_if_fail(message != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1528 |
15822 | 1529 conv = purple_conv_chat_get_conversation(chat); |
1530 gc = purple_conversation_get_gc(conv); | |
1531 account = purple_connection_get_account(gc); | |
22262
edca47ee06c5
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22029
diff
changeset
|
1532 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1533 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1534 /* Don't display this if the person who wrote it is ignored. */ |
15822 | 1535 if (purple_conv_chat_is_user_ignored(chat, who)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1536 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1537 |
15822 | 1538 if (!(flags & PURPLE_MESSAGE_WHISPER)) { |
25581
1cf0b4f71d16
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25576
diff
changeset
|
1539 const char *str; |
1cf0b4f71d16
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25576
diff
changeset
|
1540 |
1cf0b4f71d16
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25576
diff
changeset
|
1541 str = purple_normalize(account, who); |
1cf0b4f71d16
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25576
diff
changeset
|
1542 |
26721
1ba4bbd3b0cd
Chat's nick is normalized. So normalize before comparing with it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26541
diff
changeset
|
1543 if (purple_strequal(str, chat->nick)) { |
15822 | 1544 flags |= PURPLE_MESSAGE_SEND; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1545 } else { |
15822 | 1546 flags |= PURPLE_MESSAGE_RECV; |
1547 | |
1548 if (purple_utf8_has_word(message, chat->nick)) | |
1549 flags |= PURPLE_MESSAGE_NICK; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1550 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1551 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1552 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1553 /* Pass this on to either the ops structure or the default write func. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1554 if (conv->ui_ops != NULL && conv->ui_ops->write_chat != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1555 conv->ui_ops->write_chat(conv, who, message, flags, mtime); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1556 else |
15822 | 1557 purple_conversation_write(conv, who, message, flags, mtime); |
15373
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1560 void |
15822 | 1561 purple_conv_chat_send(PurpleConvChat *chat, const char *message) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1562 { |
15822 | 1563 purple_conv_chat_send_with_flags(chat, message, 0); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1564 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1565 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1566 void |
15822 | 1567 purple_conv_chat_send_with_flags(PurpleConvChat *chat, const char *message, PurpleMessageFlags flags) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1568 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1569 g_return_if_fail(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1570 g_return_if_fail(message != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1571 |
15822 | 1572 common_send(purple_conv_chat_get_conversation(chat), message, flags); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1573 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1574 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1575 void |
15822 | 1576 purple_conv_chat_add_user(PurpleConvChat *chat, const char *user, |
1577 const char *extra_msg, PurpleConvChatBuddyFlags flags, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1578 gboolean new_arrival) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1579 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1580 GList *users = g_list_append(NULL, (char *)user); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1581 GList *extra_msgs = g_list_append(NULL, (char *)extra_msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1582 GList *flags2 = g_list_append(NULL, GINT_TO_POINTER(flags)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1583 |
15822 | 1584 purple_conv_chat_add_users(chat, users, extra_msgs, flags2, new_arrival); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1585 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1586 g_list_free(users); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1587 g_list_free(extra_msgs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1588 g_list_free(flags2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1589 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1590 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1591 static int |
15822 | 1592 purple_conv_chat_cb_compare(PurpleConvChatBuddy *a, PurpleConvChatBuddy *b) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1593 { |
15822 | 1594 PurpleConvChatBuddyFlags f1 = 0, f2 = 0; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1595 char *user1 = NULL, *user2 = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1596 gint ret = 0; |
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 if (a) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1599 f1 = a->flags; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1600 if (a->alias_key) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1601 user1 = a->alias_key; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1602 else if (a->name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1603 user1 = a->name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1604 } |
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 (b) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1607 f2 = b->flags; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1608 if (b->alias_key) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1609 user2 = b->alias_key; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1610 else if (b->name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1611 user2 = b->name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1612 } |
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 if (user1 == NULL || user2 == NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1615 if (!(user1 == NULL && user2 == NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1616 ret = (user1 == NULL) ? -1: 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1617 } else if (f1 != f2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1618 /* sort more important users first */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1619 ret = (f1 > f2) ? -1 : 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1620 } else if (a->buddy != b->buddy) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1621 ret = a->buddy ? -1 : 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1622 } else { |
17082
7ade887fd3f6
Replace strcasecmp() calls with glib equivalents.
Richard Laager <rlaager@wiktel.com>
parents:
17059
diff
changeset
|
1623 ret = purple_utf8_strcasecmp(user1, user2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1624 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1625 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1626 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1627 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1628 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1629 void |
15822 | 1630 purple_conv_chat_add_users(PurpleConvChat *chat, GList *users, GList *extra_msgs, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1631 GList *flags, gboolean new_arrivals) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1632 { |
15822 | 1633 PurpleConversation *conv; |
1634 PurpleConversationUiOps *ops; | |
1635 PurpleConvChatBuddy *cbuddy; | |
1636 PurpleConnection *gc; | |
1637 PurplePluginProtocolInfo *prpl_info; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1638 GList *ul, *fl; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1639 GList *cbuddies = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1640 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1641 g_return_if_fail(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1642 g_return_if_fail(users != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1643 |
15822 | 1644 conv = purple_conv_chat_get_conversation(chat); |
1645 ops = purple_conversation_get_ui_ops(conv); | |
1646 | |
1647 gc = purple_conversation_get_gc(conv); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1648 g_return_if_fail(gc != NULL); |
22262
edca47ee06c5
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22029
diff
changeset
|
1649 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1650 g_return_if_fail(prpl_info != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1651 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1652 ul = users; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1653 fl = flags; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1654 while ((ul != NULL) && (fl != NULL)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1655 const char *user = (const char *)ul->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1656 const char *alias = user; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1657 gboolean quiet; |
15822 | 1658 PurpleConvChatBuddyFlags flag = GPOINTER_TO_INT(fl->data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1659 const char *extra_msg = (extra_msgs ? extra_msgs->data : NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1660 |
17484
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1661 if(!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
25894
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25808
diff
changeset
|
1662 if (purple_strequal(chat->nick, purple_normalize(conv->account, user))) { |
17484
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1663 const char *alias2 = purple_account_get_alias(conv->account); |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1664 if (alias2 != NULL) |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1665 alias = alias2; |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1666 else |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1667 { |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1668 const char *display_name = purple_connection_get_display_name(gc); |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1669 if (display_name != NULL) |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1670 alias = display_name; |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1671 } |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1672 } else { |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1673 PurpleBuddy *buddy; |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1674 if ((buddy = purple_find_buddy(gc->account, user)) != NULL) |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1675 alias = purple_buddy_get_contact_alias(buddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1676 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1677 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1678 |
15822 | 1679 quiet = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_conversations_get_handle(), |
23415
1c6918e48104
This should be a boolean or, not a bitwise or.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23297
diff
changeset
|
1680 "chat-buddy-joining", conv, user, flag)) || |
15822 | 1681 purple_conv_chat_is_user_ignored(chat, user); |
1682 | |
1683 cbuddy = purple_conv_chat_cb_new(user, alias, flag); | |
18305
ffd706ec0220
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18121
diff
changeset
|
1684 cbuddy->buddy = purple_find_buddy(conv->account, user) != NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1685 /* This seems dumb. Why should we set users thousands of times? */ |
15822 | 1686 purple_conv_chat_set_users(chat, |
18115
871d9aa8e51c
Re-apply a good change from 1411afd7660760db59966c3a9f18e2adab8eb27e:
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
1687 g_list_prepend(chat->in_room, cbuddy)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1688 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1689 cbuddies = g_list_prepend(cbuddies, cbuddy); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1690 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1691 if (!quiet && new_arrivals) { |
23416
0b6475f97648
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23415
diff
changeset
|
1692 char *alias_esc = g_markup_escape_text(alias, -1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1693 char *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1694 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1695 if (extra_msg == NULL) |
23416
0b6475f97648
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23415
diff
changeset
|
1696 tmp = g_strdup_printf(_("%s entered the room."), alias_esc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1697 else { |
23416
0b6475f97648
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23415
diff
changeset
|
1698 char *extra_msg_esc = g_markup_escape_text(extra_msg, -1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1699 tmp = g_strdup_printf(_("%s [<I>%s</I>] entered the room."), |
23416
0b6475f97648
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23415
diff
changeset
|
1700 alias_esc, extra_msg_esc); |
0b6475f97648
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23415
diff
changeset
|
1701 g_free(extra_msg_esc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1702 } |
23416
0b6475f97648
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23415
diff
changeset
|
1703 g_free(alias_esc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1704 |
18026
c3d03dd25434
use the new NO_LINKIFY flag for join and part messages
Nathan Walp <nwalp@pidgin.im>
parents:
18025
diff
changeset
|
1705 purple_conversation_write(conv, NULL, tmp, |
c3d03dd25434
use the new NO_LINKIFY flag for join and part messages
Nathan Walp <nwalp@pidgin.im>
parents:
18025
diff
changeset
|
1706 PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, |
c3d03dd25434
use the new NO_LINKIFY flag for join and part messages
Nathan Walp <nwalp@pidgin.im>
parents:
18025
diff
changeset
|
1707 time(NULL)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1708 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1709 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1710 |
15822 | 1711 purple_signal_emit(purple_conversations_get_handle(), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1712 "chat-buddy-joined", conv, user, flag, new_arrivals); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1713 ul = ul->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1714 fl = fl->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1715 if (extra_msgs != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1716 extra_msgs = extra_msgs->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1717 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1718 |
15822 | 1719 cbuddies = g_list_sort(cbuddies, (GCompareFunc)purple_conv_chat_cb_compare); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1720 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1721 if (ops != NULL && ops->chat_add_users != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1722 ops->chat_add_users(conv, cbuddies, new_arrivals); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1723 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1724 g_list_free(cbuddies); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1725 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1726 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1727 void |
15822 | 1728 purple_conv_chat_rename_user(PurpleConvChat *chat, const char *old_user, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1729 const char *new_user) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1730 { |
15822 | 1731 PurpleConversation *conv; |
1732 PurpleConversationUiOps *ops; | |
1733 PurpleConnection *gc; | |
1734 PurplePluginProtocolInfo *prpl_info; | |
1735 PurpleConvChatBuddy *cb; | |
1736 PurpleConvChatBuddyFlags flags; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1737 const char *new_alias = new_user; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1738 char tmp[BUF_LONG]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1739 gboolean is_me = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1740 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1741 g_return_if_fail(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1742 g_return_if_fail(old_user != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1743 g_return_if_fail(new_user != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1744 |
15822 | 1745 conv = purple_conv_chat_get_conversation(chat); |
1746 ops = purple_conversation_get_ui_ops(conv); | |
1747 | |
1748 gc = purple_conversation_get_gc(conv); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1749 g_return_if_fail(gc != NULL); |
22262
edca47ee06c5
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22029
diff
changeset
|
1750 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1751 g_return_if_fail(prpl_info != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1752 |
25894
a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <paul@darkrain42.org>
parents:
25808
diff
changeset
|
1753 if (purple_strequal(chat->nick, purple_normalize(conv->account, old_user))) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1754 const char *alias; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1755 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1756 /* Note this for later. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1757 is_me = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1758 |
17484
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1759 if(!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1760 alias = purple_account_get_alias(conv->account); |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1761 if (alias != NULL) |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1762 new_alias = alias; |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1763 else |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1764 { |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1765 const char *display_name = purple_connection_get_display_name(gc); |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1766 if (display_name != NULL) |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1767 alias = display_name; |
4b18cc7b6177
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17434
diff
changeset
|
1768 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1769 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1770 } else if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
15822 | 1771 PurpleBuddy *buddy; |
1772 if ((buddy = purple_find_buddy(gc->account, new_user)) != NULL) | |
1773 new_alias = purple_buddy_get_contact_alias(buddy); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1774 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1775 |
18305
ffd706ec0220
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18121
diff
changeset
|
1776 flags = purple_conv_chat_user_get_flags(chat, old_user); |
ffd706ec0220
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18121
diff
changeset
|
1777 cb = purple_conv_chat_cb_new(new_user, new_alias, flags); |
ffd706ec0220
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18121
diff
changeset
|
1778 cb->buddy = purple_find_buddy(conv->account, new_user) != NULL; |
ffd706ec0220
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18121
diff
changeset
|
1779 purple_conv_chat_set_users(chat, |
ffd706ec0220
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18121
diff
changeset
|
1780 g_list_prepend(chat->in_room, cb)); |
ffd706ec0220
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18121
diff
changeset
|
1781 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1782 if (ops != NULL && ops->chat_rename_user != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1783 ops->chat_rename_user(conv, old_user, new_user, new_alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1784 |
15822 | 1785 cb = purple_conv_chat_cb_find(chat, old_user); |
15373
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 if (cb) { |
15822 | 1788 purple_conv_chat_set_users(chat, |
18115
871d9aa8e51c
Re-apply a good change from 1411afd7660760db59966c3a9f18e2adab8eb27e:
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
1789 g_list_remove(chat->in_room, cb)); |
15822 | 1790 purple_conv_chat_cb_destroy(cb); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1791 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1792 |
15822 | 1793 if (purple_conv_chat_is_user_ignored(chat, old_user)) { |
1794 purple_conv_chat_unignore(chat, old_user); | |
1795 purple_conv_chat_ignore(chat, new_user); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1796 } |
15822 | 1797 else if (purple_conv_chat_is_user_ignored(chat, new_user)) |
1798 purple_conv_chat_unignore(chat, new_user); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1799 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1800 if (is_me) |
15822 | 1801 purple_conv_chat_set_nick(chat, new_user); |
1802 | |
16424
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15822
diff
changeset
|
1803 if (purple_prefs_get_bool("/purple/conversations/chat/show_nick_change") && |
15822 | 1804 !purple_conv_chat_is_user_ignored(chat, new_user)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1805 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1806 if (is_me) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1807 char *escaped = g_markup_escape_text(new_user, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1808 g_snprintf(tmp, sizeof(tmp), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1809 _("You are now known as %s"), escaped); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1810 g_free(escaped); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1811 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1812 const char *old_alias = old_user; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1813 const char *new_alias = new_user; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1814 char *escaped; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1815 char *escaped2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1816 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1817 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
15822 | 1818 PurpleBuddy *buddy; |
1819 | |
1820 if ((buddy = purple_find_buddy(gc->account, old_user)) != NULL) | |
1821 old_alias = purple_buddy_get_contact_alias(buddy); | |
1822 if ((buddy = purple_find_buddy(gc->account, new_user)) != NULL) | |
1823 new_alias = purple_buddy_get_contact_alias(buddy); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1824 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1825 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1826 escaped = g_markup_escape_text(old_alias, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1827 escaped2 = g_markup_escape_text(new_alias, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1828 g_snprintf(tmp, sizeof(tmp), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1829 _("%s is now known as %s"), escaped, escaped2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1830 g_free(escaped); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1831 g_free(escaped2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1832 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1833 |
18028 | 1834 purple_conversation_write(conv, NULL, tmp, |
1835 PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, | |
1836 time(NULL)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1837 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1838 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1839 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1840 void |
15822 | 1841 purple_conv_chat_remove_user(PurpleConvChat *chat, const char *user, const char *reason) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1842 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1843 GList *users = g_list_append(NULL, (char *)user); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1844 |
15822 | 1845 purple_conv_chat_remove_users(chat, users, reason); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1846 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1847 g_list_free(users); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1848 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1849 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1850 void |
15822 | 1851 purple_conv_chat_remove_users(PurpleConvChat *chat, GList *users, const char *reason) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1852 { |
15822 | 1853 PurpleConversation *conv; |
1854 PurpleConnection *gc; | |
1855 PurplePluginProtocolInfo *prpl_info; | |
1856 PurpleConversationUiOps *ops; | |
1857 PurpleConvChatBuddy *cb; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1858 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1859 gboolean quiet; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1860 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1861 g_return_if_fail(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1862 g_return_if_fail(users != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1863 |
15822 | 1864 conv = purple_conv_chat_get_conversation(chat); |
1865 | |
1866 gc = purple_conversation_get_gc(conv); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1867 g_return_if_fail(gc != NULL); |
22262
edca47ee06c5
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22029
diff
changeset
|
1868 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1869 g_return_if_fail(prpl_info != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1870 |
15822 | 1871 ops = purple_conversation_get_ui_ops(conv); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1872 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1873 for (l = users; l != NULL; l = l->next) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1874 const char *user = (const char *)l->data; |
15822 | 1875 quiet = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_conversations_get_handle(), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1876 "chat-buddy-leaving", conv, user, reason)) | |
15822 | 1877 purple_conv_chat_is_user_ignored(chat, user); |
1878 | |
1879 cb = purple_conv_chat_cb_find(chat, user); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1880 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1881 if (cb) { |
15822 | 1882 purple_conv_chat_set_users(chat, |
18115
871d9aa8e51c
Re-apply a good change from 1411afd7660760db59966c3a9f18e2adab8eb27e:
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
1883 g_list_remove(chat->in_room, cb)); |
15822 | 1884 purple_conv_chat_cb_destroy(cb); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1885 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1886 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1887 /* NOTE: Don't remove them from ignored in case they re-enter. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1888 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1889 if (!quiet) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1890 const char *alias = user; |
23416
0b6475f97648
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23415
diff
changeset
|
1891 char *alias_esc; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1892 char *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1893 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1894 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
15822 | 1895 PurpleBuddy *buddy; |
1896 | |
1897 if ((buddy = purple_find_buddy(gc->account, user)) != NULL) | |
1898 alias = purple_buddy_get_contact_alias(buddy); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1899 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1900 |
23416
0b6475f97648
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23415
diff
changeset
|
1901 alias_esc = g_markup_escape_text(alias, -1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1902 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1903 if (reason == NULL || !*reason) |
23416
0b6475f97648
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23415
diff
changeset
|
1904 tmp = g_strdup_printf(_("%s left the room."), alias_esc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1905 else { |
23416
0b6475f97648
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23415
diff
changeset
|
1906 char *reason_esc = g_markup_escape_text(reason, -1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1907 tmp = g_strdup_printf(_("%s left the room (%s)."), |
23416
0b6475f97648
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23415
diff
changeset
|
1908 alias_esc, reason_esc); |
0b6475f97648
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23415
diff
changeset
|
1909 g_free(reason_esc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1910 } |
23416
0b6475f97648
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <will.thompson@collabora.co.uk>
parents:
23415
diff
changeset
|
1911 g_free(alias_esc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1912 |
18026
c3d03dd25434
use the new NO_LINKIFY flag for join and part messages
Nathan Walp <nwalp@pidgin.im>
parents:
18025
diff
changeset
|
1913 purple_conversation_write(conv, NULL, tmp, |
c3d03dd25434
use the new NO_LINKIFY flag for join and part messages
Nathan Walp <nwalp@pidgin.im>
parents:
18025
diff
changeset
|
1914 PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, |
c3d03dd25434
use the new NO_LINKIFY flag for join and part messages
Nathan Walp <nwalp@pidgin.im>
parents:
18025
diff
changeset
|
1915 time(NULL)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1916 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1917 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1918 |
15822 | 1919 purple_signal_emit(purple_conversations_get_handle(), "chat-buddy-left", |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1920 conv, user, reason); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1921 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1922 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1923 if (ops != NULL && ops->chat_remove_users != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1924 ops->chat_remove_users(conv, users); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1925 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1926 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1927 void |
15822 | 1928 purple_conv_chat_clear_users(PurpleConvChat *chat) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1929 { |
15822 | 1930 PurpleConversation *conv; |
1931 PurpleConversationUiOps *ops; | |
18115
871d9aa8e51c
Re-apply a good change from 1411afd7660760db59966c3a9f18e2adab8eb27e:
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
1932 GList *users; |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
1933 GList *l; |
18115
871d9aa8e51c
Re-apply a good change from 1411afd7660760db59966c3a9f18e2adab8eb27e:
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
1934 GList *names = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1935 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1936 g_return_if_fail(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1937 |
15822 | 1938 conv = purple_conv_chat_get_conversation(chat); |
1939 ops = purple_conversation_get_ui_ops(conv); | |
18115
871d9aa8e51c
Re-apply a good change from 1411afd7660760db59966c3a9f18e2adab8eb27e:
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
1940 users = chat->in_room; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1941 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1942 if (ops != NULL && ops->chat_remove_users != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1943 for (l = users; l; l = l->next) { |
15822 | 1944 PurpleConvChatBuddy *cb = l->data; |
17515
25d808baa395
In purple_conv_chat_clear_users(), use g_list_prepend() instead of
Richard Laager <rlaager@wiktel.com>
parents:
17484
diff
changeset
|
1945 names = g_list_prepend(names, cb->name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1946 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1947 ops->chat_remove_users(conv, names); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1948 g_list_free(names); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1949 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1950 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1951 for (l = users; l; l = l->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1952 { |
15822 | 1953 PurpleConvChatBuddy *cb = l->data; |
1954 | |
1955 purple_signal_emit(purple_conversations_get_handle(), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1956 "chat-buddy-leaving", conv, cb->name, NULL); |
15822 | 1957 purple_signal_emit(purple_conversations_get_handle(), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1958 "chat-buddy-left", conv, cb->name, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1959 |
15822 | 1960 purple_conv_chat_cb_destroy(cb); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1961 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1962 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1963 g_list_free(users); |
15822 | 1964 purple_conv_chat_set_users(chat, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1965 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1966 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1967 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1968 gboolean |
15822 | 1969 purple_conv_chat_find_user(PurpleConvChat *chat, const char *user) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1970 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1971 g_return_val_if_fail(chat != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1972 g_return_val_if_fail(user != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1973 |
15822 | 1974 return (purple_conv_chat_cb_find(chat, user) != NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1975 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1976 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1977 void |
15822 | 1978 purple_conv_chat_user_set_flags(PurpleConvChat *chat, const char *user, |
1979 PurpleConvChatBuddyFlags flags) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1980 { |
15822 | 1981 PurpleConversation *conv; |
1982 PurpleConversationUiOps *ops; | |
1983 PurpleConvChatBuddy *cb; | |
1984 PurpleConvChatBuddyFlags oldflags; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1985 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1986 g_return_if_fail(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1987 g_return_if_fail(user != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1988 |
15822 | 1989 cb = purple_conv_chat_cb_find(chat, user); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1990 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1991 if (!cb) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1992 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1993 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1994 if (flags == cb->flags) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1995 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1996 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1997 oldflags = cb->flags; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1998 cb->flags = flags; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1999 |
15822 | 2000 conv = purple_conv_chat_get_conversation(chat); |
2001 ops = purple_conversation_get_ui_ops(conv); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2002 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2003 if (ops != NULL && ops->chat_update_user != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2004 ops->chat_update_user(conv, user); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2005 |
15822 | 2006 purple_signal_emit(purple_conversations_get_handle(), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2007 "chat-buddy-flags", conv, user, oldflags, flags); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2008 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2009 |
15822 | 2010 PurpleConvChatBuddyFlags |
2011 purple_conv_chat_user_get_flags(PurpleConvChat *chat, const char *user) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2012 { |
15822 | 2013 PurpleConvChatBuddy *cb; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2014 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2015 g_return_val_if_fail(chat != NULL, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2016 g_return_val_if_fail(user != NULL, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2017 |
15822 | 2018 cb = purple_conv_chat_cb_find(chat, user); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2019 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2020 if (!cb) |
15822 | 2021 return PURPLE_CBFLAGS_NONE; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2022 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2023 return cb->flags; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2024 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2025 |
15822 | 2026 void purple_conv_chat_set_nick(PurpleConvChat *chat, const char *nick) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2027 g_return_if_fail(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2028 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2029 g_free(chat->nick); |
15822 | 2030 chat->nick = g_strdup(purple_normalize(chat->conv->account, nick)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2031 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2032 |
15822 | 2033 const char *purple_conv_chat_get_nick(PurpleConvChat *chat) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2034 g_return_val_if_fail(chat != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2035 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2036 return chat->nick; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2037 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2038 |
15822 | 2039 PurpleConversation * |
2040 purple_find_chat(const PurpleConnection *gc, int id) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2041 { |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
2042 GList *l; |
15822 | 2043 PurpleConversation *conv; |
2044 | |
2045 for (l = purple_get_chats(); l != NULL; l = l->next) { | |
2046 conv = (PurpleConversation *)l->data; | |
2047 | |
2048 if (purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)) == id && | |
2049 purple_conversation_get_gc(conv) == gc) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2050 return conv; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2051 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2052 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2053 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2054 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2055 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2056 void |
15822 | 2057 purple_conv_chat_left(PurpleConvChat *chat) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2058 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2059 g_return_if_fail(chat != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2060 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2061 chat->left = TRUE; |
15822 | 2062 purple_conversation_update(chat->conv, PURPLE_CONV_UPDATE_CHATLEFT); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2063 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2064 |
26541
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2065 static void |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2066 invite_user_to_chat(gpointer data, PurpleRequestFields *fields) |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2067 { |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2068 PurpleConversation *conv; |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2069 PurpleConvChat *chat; |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2070 const char *user, *message; |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2071 |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2072 conv = data; |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2073 chat = PURPLE_CONV_CHAT(conv); |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2074 user = purple_request_fields_get_string(fields, "screenname"); |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2075 message = purple_request_fields_get_string(fields, "message"); |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2076 |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2077 serv_chat_invite(purple_conversation_get_gc(conv), chat->id, message, user); |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2078 } |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2079 |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2080 void purple_conv_chat_invite_user(PurpleConvChat *chat, const char *user, |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2081 const char *message, gboolean confirm) |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2082 { |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2083 PurpleAccount *account; |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2084 PurpleConversation *conv; |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2085 PurpleRequestFields *fields; |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2086 PurpleRequestFieldGroup *group; |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2087 PurpleRequestField *field; |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2088 |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2089 g_return_if_fail(chat); |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2090 |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2091 if (!user || !*user || !message || !*message) |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2092 confirm = TRUE; |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2093 |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2094 conv = chat->conv; |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2095 account = conv->account; |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2096 |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2097 if (!confirm) { |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2098 serv_chat_invite(purple_account_get_connection(account), |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2099 purple_conv_chat_get_id(chat), message, user); |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2100 return; |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2101 } |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2102 |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2103 fields = purple_request_fields_new(); |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2104 group = purple_request_field_group_new(_("Invite to chat")); |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2105 purple_request_fields_add_group(fields, group); |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2106 |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2107 field = purple_request_field_string_new("screenname", _("Buddy"), user, FALSE); |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2108 purple_request_field_group_add_field(group, field); |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2109 purple_request_field_set_required(field, TRUE); |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2110 purple_request_field_set_type_hint(field, "screenname"); |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2111 |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2112 field = purple_request_field_string_new("message", _("Message"), message, FALSE); |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2113 purple_request_field_group_add_field(group, field); |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2114 |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2115 purple_request_fields(conv, _("Invite to chat"), NULL, |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2116 _("Please enter the name of the user you wish to invite, " |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2117 "along with an optional invite message."), |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2118 fields, |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2119 _("Invite"), G_CALLBACK(invite_user_to_chat), |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2120 _("Cancel"), NULL, |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2121 account, user, conv, |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2122 conv); |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2123 } |
15ae2dea92b3
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26530
diff
changeset
|
2124 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2125 gboolean |
15822 | 2126 purple_conv_chat_has_left(PurpleConvChat *chat) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2127 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2128 g_return_val_if_fail(chat != NULL, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2129 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2130 return chat->left; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2131 } |
18305
ffd706ec0220
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18121
diff
changeset
|
2132 |
15822 | 2133 PurpleConvChatBuddy * |
2134 purple_conv_chat_cb_new(const char *name, const char *alias, PurpleConvChatBuddyFlags flags) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2135 { |
15822 | 2136 PurpleConvChatBuddy *cb; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2137 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2138 g_return_val_if_fail(name != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2139 |
15822 | 2140 cb = g_new0(PurpleConvChatBuddy, 1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2141 cb->name = g_strdup(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2142 cb->flags = flags; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2143 cb->alias = g_strdup(alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2144 |
15822 | 2145 PURPLE_DBUS_REGISTER_POINTER(cb, PurpleConvChatBuddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2146 return cb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2147 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2148 |
15822 | 2149 PurpleConvChatBuddy * |
2150 purple_conv_chat_cb_find(PurpleConvChat *chat, const char *name) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2151 { |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
2152 GList *l; |
15822 | 2153 PurpleConvChatBuddy *cb = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2154 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2155 g_return_val_if_fail(chat != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2156 g_return_val_if_fail(name != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2157 |
15822 | 2158 for (l = purple_conv_chat_get_users(chat); l; l = l->next) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2159 cb = l->data; |
17434
6418bcb7809a
purple_conv_chat_cb_find should be case sensitive in finding users to make
Stu Tomlinson <stu@nosnilmot.com>
parents:
17082
diff
changeset
|
2160 if (!g_utf8_collate(cb->name, name)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2161 return cb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2162 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2163 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2164 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2165 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2166 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2167 void |
15822 | 2168 purple_conv_chat_cb_destroy(PurpleConvChatBuddy *cb) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2169 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2170 if (cb == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2171 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2172 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2173 g_free(cb->alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2174 g_free(cb->alias_key); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2175 g_free(cb->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2176 |
15822 | 2177 PURPLE_DBUS_UNREGISTER_POINTER(cb); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2178 g_free(cb); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2179 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2180 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2181 const char * |
15822 | 2182 purple_conv_chat_cb_get_name(PurpleConvChatBuddy *cb) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2183 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2184 g_return_val_if_fail(cb != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2185 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2186 return cb->name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2187 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2188 |
17735
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2189 GList * |
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2190 purple_conversation_get_extended_menu(PurpleConversation *conv) |
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2191 { |
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2192 GList *menu = NULL; |
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2193 |
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2194 g_return_val_if_fail(conv != NULL, NULL); |
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2195 |
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2196 purple_signal_emit(purple_conversations_get_handle(), |
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2197 "conversation-extended-menu", conv, &menu); |
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2198 return menu; |
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2199 } |
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2200 |
19413
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2201 void purple_conversation_clear_message_history(PurpleConversation *conv) |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2202 { |
19706
7ea794e7cec3
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
2203 GList *list = conv->message_history; |
19413
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2204 message_history_free(list); |
19706
7ea794e7cec3
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
2205 conv->message_history = NULL; |
19413
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2206 } |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2207 |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2208 GList *purple_conversation_get_message_history(PurpleConversation *conv) |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2209 { |
19706
7ea794e7cec3
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
2210 return conv->message_history; |
19413
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2211 } |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2212 |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2213 const char *purple_conversation_message_get_sender(PurpleConvMessage *msg) |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2214 { |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2215 g_return_val_if_fail(msg, NULL); |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2216 return msg->who; |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2217 } |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2218 |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2219 const char *purple_conversation_message_get_message(PurpleConvMessage *msg) |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2220 { |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2221 g_return_val_if_fail(msg, NULL); |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2222 return msg->what; |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2223 } |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2224 |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2225 PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg) |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2226 { |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2227 g_return_val_if_fail(msg, 0); |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2228 return msg->flags; |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2229 } |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2230 |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2231 time_t purple_conversation_message_get_timestamp(PurpleConvMessage *msg) |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2232 { |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2233 g_return_val_if_fail(msg, 0); |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2234 return msg->when; |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2235 } |
deb9471d7142
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18823
diff
changeset
|
2236 |
17736
c9a046a7f326
New function purple_conversation_do_command. This is almost like
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17735
diff
changeset
|
2237 gboolean |
c9a046a7f326
New function purple_conversation_do_command. This is almost like
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17735
diff
changeset
|
2238 purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline, |
c9a046a7f326
New function purple_conversation_do_command. This is almost like
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17735
diff
changeset
|
2239 const gchar *markup, gchar **error) |
c9a046a7f326
New function purple_conversation_do_command. This is almost like
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17735
diff
changeset
|
2240 { |
c9a046a7f326
New function purple_conversation_do_command. This is almost like
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17735
diff
changeset
|
2241 char *mark = (markup && *markup) ? NULL : g_markup_escape_text(cmdline, -1), *err = NULL; |
c9a046a7f326
New function purple_conversation_do_command. This is almost like
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17735
diff
changeset
|
2242 PurpleCmdStatus status = purple_cmd_do_command(conv, cmdline, mark ? mark : markup, error ? error : &err); |
c9a046a7f326
New function purple_conversation_do_command. This is almost like
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17735
diff
changeset
|
2243 g_free(mark); |
17737
192be492ce25
Plug a possible memory leak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17736
diff
changeset
|
2244 g_free(err); |
17736
c9a046a7f326
New function purple_conversation_do_command. This is almost like
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17735
diff
changeset
|
2245 return (status == PURPLE_CMD_STATUS_OK); |
c9a046a7f326
New function purple_conversation_do_command. This is almost like
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17735
diff
changeset
|
2246 } |
17735
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2247 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2248 void * |
15822 | 2249 purple_conversations_get_handle(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2250 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2251 static int handle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2252 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2253 return &handle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2254 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2255 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2256 void |
15822 | 2257 purple_conversations_init(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2258 { |
15822 | 2259 void *handle = purple_conversations_get_handle(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2260 |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
2261 conversation_cache = g_hash_table_new_full((GHashFunc)_purple_conversations_hconv_hash, |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
2262 (GEqualFunc)_purple_conversations_hconv_equal, |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
2263 (GDestroyNotify)_purple_conversations_hconv_free_key, NULL); |
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
2264 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2265 /********************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2266 * Register preferences |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2267 **********************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2268 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2269 /* Conversations */ |
16424
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15822
diff
changeset
|
2270 purple_prefs_add_none("/purple/conversations"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2271 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2272 /* Conversations -> Chat */ |
16424
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15822
diff
changeset
|
2273 purple_prefs_add_none("/purple/conversations/chat"); |
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15822
diff
changeset
|
2274 purple_prefs_add_bool("/purple/conversations/chat/show_nick_change", TRUE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2275 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2276 /* Conversations -> IM */ |
16424
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15822
diff
changeset
|
2277 purple_prefs_add_none("/purple/conversations/im"); |
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
15822
diff
changeset
|
2278 purple_prefs_add_bool("/purple/conversations/im/send_typing", TRUE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2279 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2280 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2281 /********************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2282 * Register signals |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2283 **********************************************************************/ |
15822 | 2284 purple_signal_register(handle, "writing-im-msg", |
18496
f4d05584369e
Fix up writing-im-msg and writing-chat-msg to use a marshaller which treats the
Will Thompson <will.thompson@collabora.co.uk>
parents:
18305
diff
changeset
|
2285 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT, |
15822 | 2286 purple_value_new(PURPLE_TYPE_BOOLEAN), 5, |
2287 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2288 PURPLE_SUBTYPE_ACCOUNT), | |
2289 purple_value_new(PURPLE_TYPE_STRING), | |
2290 purple_value_new_outgoing(PURPLE_TYPE_STRING), | |
2291 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2292 PURPLE_SUBTYPE_CONVERSATION), | |
2293 purple_value_new(PURPLE_TYPE_UINT)); | |
2294 | |
2295 purple_signal_register(handle, "wrote-im-msg", | |
2296 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2297 NULL, 5, |
15822 | 2298 purple_value_new(PURPLE_TYPE_SUBTYPE, |
2299 PURPLE_SUBTYPE_ACCOUNT), | |
2300 purple_value_new(PURPLE_TYPE_STRING), | |
2301 purple_value_new(PURPLE_TYPE_STRING), | |
2302 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2303 PURPLE_SUBTYPE_CONVERSATION), | |
2304 purple_value_new(PURPLE_TYPE_UINT)); | |
29244
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2305 |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2306 purple_signal_register(handle, "sent-attention", |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2307 purple_marshal_VOID__POINTER_POINTER_POINTER_UINT, |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2308 NULL, 4, |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2309 purple_value_new(PURPLE_TYPE_SUBTYPE, |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2310 PURPLE_SUBTYPE_ACCOUNT), |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2311 purple_value_new(PURPLE_TYPE_STRING), |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2312 purple_value_new(PURPLE_TYPE_SUBTYPE, |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2313 PURPLE_SUBTYPE_CONVERSATION), |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2314 purple_value_new(PURPLE_TYPE_UINT)); |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2315 |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2316 purple_signal_register(handle, "got-attention", |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2317 purple_marshal_VOID__POINTER_POINTER_POINTER_UINT, |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2318 NULL, 4, |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2319 purple_value_new(PURPLE_TYPE_SUBTYPE, |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2320 PURPLE_SUBTYPE_ACCOUNT), |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2321 purple_value_new(PURPLE_TYPE_STRING), |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2322 purple_value_new(PURPLE_TYPE_SUBTYPE, |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2323 PURPLE_SUBTYPE_CONVERSATION), |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2324 purple_value_new(PURPLE_TYPE_UINT)); |
22b8a92fb5ee
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <ml@update.uu.se>
parents:
23720
diff
changeset
|
2325 |
15822 | 2326 purple_signal_register(handle, "sending-im-msg", |
2327 purple_marshal_VOID__POINTER_POINTER_POINTER, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2328 NULL, 3, |
15822 | 2329 purple_value_new(PURPLE_TYPE_SUBTYPE, |
2330 PURPLE_SUBTYPE_ACCOUNT), | |
2331 purple_value_new(PURPLE_TYPE_STRING), | |
2332 purple_value_new_outgoing(PURPLE_TYPE_STRING)); | |
2333 | |
2334 purple_signal_register(handle, "sent-im-msg", | |
2335 purple_marshal_VOID__POINTER_POINTER_POINTER, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2336 NULL, 3, |
15822 | 2337 purple_value_new(PURPLE_TYPE_SUBTYPE, |
2338 PURPLE_SUBTYPE_ACCOUNT), | |
2339 purple_value_new(PURPLE_TYPE_STRING), | |
2340 purple_value_new(PURPLE_TYPE_STRING)); | |
2341 | |
2342 purple_signal_register(handle, "receiving-im-msg", | |
2343 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, | |
2344 purple_value_new(PURPLE_TYPE_BOOLEAN), 5, | |
2345 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2346 PURPLE_SUBTYPE_ACCOUNT), | |
2347 purple_value_new_outgoing(PURPLE_TYPE_STRING), | |
2348 purple_value_new_outgoing(PURPLE_TYPE_STRING), | |
2349 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2350 PURPLE_SUBTYPE_CONVERSATION), | |
2351 purple_value_new_outgoing(PURPLE_TYPE_UINT)); | |
2352 | |
2353 purple_signal_register(handle, "received-im-msg", | |
2354 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2355 NULL, 5, |
15822 | 2356 purple_value_new(PURPLE_TYPE_SUBTYPE, |
2357 PURPLE_SUBTYPE_ACCOUNT), | |
2358 purple_value_new(PURPLE_TYPE_STRING), | |
2359 purple_value_new(PURPLE_TYPE_STRING), | |
2360 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2361 PURPLE_SUBTYPE_CONVERSATION), | |
2362 purple_value_new(PURPLE_TYPE_UINT)); | |
2363 | |
23169
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2364 purple_signal_register(handle, "blocked-im-msg", |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2365 purple_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT, |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2366 NULL, 5, |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2367 purple_value_new(PURPLE_TYPE_SUBTYPE, |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2368 PURPLE_SUBTYPE_ACCOUNT), |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2369 purple_value_new(PURPLE_TYPE_STRING), |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2370 purple_value_new(PURPLE_TYPE_STRING), |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2371 purple_value_new(PURPLE_TYPE_UINT), |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2372 purple_value_new(PURPLE_TYPE_UINT)); |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2373 |
15822 | 2374 purple_signal_register(handle, "writing-chat-msg", |
18496
f4d05584369e
Fix up writing-im-msg and writing-chat-msg to use a marshaller which treats the
Will Thompson <will.thompson@collabora.co.uk>
parents:
18305
diff
changeset
|
2375 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT, |
15822 | 2376 purple_value_new(PURPLE_TYPE_BOOLEAN), 5, |
2377 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2378 PURPLE_SUBTYPE_ACCOUNT), | |
2379 purple_value_new(PURPLE_TYPE_STRING), | |
2380 purple_value_new_outgoing(PURPLE_TYPE_STRING), | |
2381 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2382 PURPLE_SUBTYPE_CONVERSATION), | |
2383 purple_value_new(PURPLE_TYPE_UINT)); | |
2384 | |
2385 purple_signal_register(handle, "wrote-chat-msg", | |
2386 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2387 NULL, 5, |
15822 | 2388 purple_value_new(PURPLE_TYPE_SUBTYPE, |
2389 PURPLE_SUBTYPE_ACCOUNT), | |
2390 purple_value_new(PURPLE_TYPE_STRING), | |
2391 purple_value_new(PURPLE_TYPE_STRING), | |
2392 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2393 PURPLE_SUBTYPE_CONVERSATION), | |
2394 purple_value_new(PURPLE_TYPE_UINT)); | |
2395 | |
2396 purple_signal_register(handle, "sending-chat-msg", | |
2397 purple_marshal_VOID__POINTER_POINTER_UINT, NULL, 3, | |
2398 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2399 PURPLE_SUBTYPE_ACCOUNT), | |
2400 purple_value_new_outgoing(PURPLE_TYPE_STRING), | |
2401 purple_value_new(PURPLE_TYPE_UINT)); | |
2402 | |
2403 purple_signal_register(handle, "sent-chat-msg", | |
2404 purple_marshal_VOID__POINTER_POINTER_UINT, NULL, 3, | |
2405 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2406 PURPLE_SUBTYPE_ACCOUNT), | |
2407 purple_value_new(PURPLE_TYPE_STRING), | |
2408 purple_value_new(PURPLE_TYPE_UINT)); | |
2409 | |
2410 purple_signal_register(handle, "receiving-chat-msg", | |
2411 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, | |
2412 purple_value_new(PURPLE_TYPE_BOOLEAN), 5, | |
2413 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2414 PURPLE_SUBTYPE_ACCOUNT), | |
2415 purple_value_new_outgoing(PURPLE_TYPE_STRING), | |
2416 purple_value_new_outgoing(PURPLE_TYPE_STRING), | |
2417 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2418 PURPLE_SUBTYPE_CONVERSATION), | |
2419 purple_value_new_outgoing(PURPLE_TYPE_UINT)); | |
2420 | |
2421 purple_signal_register(handle, "received-chat-msg", | |
2422 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2423 NULL, 5, |
15822 | 2424 purple_value_new(PURPLE_TYPE_SUBTYPE, |
2425 PURPLE_SUBTYPE_ACCOUNT), | |
2426 purple_value_new(PURPLE_TYPE_STRING), | |
2427 purple_value_new(PURPLE_TYPE_STRING), | |
2428 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2429 PURPLE_SUBTYPE_CONVERSATION), | |
2430 purple_value_new(PURPLE_TYPE_UINT)); | |
2431 | |
2432 purple_signal_register(handle, "conversation-created", | |
2433 purple_marshal_VOID__POINTER, NULL, 1, | |
2434 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2435 PURPLE_SUBTYPE_CONVERSATION)); | |
2436 | |
2437 purple_signal_register(handle, "conversation-updated", | |
2438 purple_marshal_VOID__POINTER_UINT, NULL, 2, | |
2439 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2440 PURPLE_SUBTYPE_CONVERSATION), | |
2441 purple_value_new(PURPLE_TYPE_UINT)); | |
2442 | |
2443 purple_signal_register(handle, "deleting-conversation", | |
2444 purple_marshal_VOID__POINTER, NULL, 1, | |
2445 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2446 PURPLE_SUBTYPE_CONVERSATION)); | |
2447 | |
2448 purple_signal_register(handle, "buddy-typing", | |
2449 purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
2450 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2451 PURPLE_SUBTYPE_ACCOUNT), | |
2452 purple_value_new(PURPLE_TYPE_STRING)); | |
2453 | |
2454 purple_signal_register(handle, "buddy-typed", | |
2455 purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
2456 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2457 PURPLE_SUBTYPE_ACCOUNT), | |
2458 purple_value_new(PURPLE_TYPE_STRING)); | |
2459 | |
2460 purple_signal_register(handle, "buddy-typing-stopped", | |
2461 purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
2462 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2463 PURPLE_SUBTYPE_ACCOUNT), | |
2464 purple_value_new(PURPLE_TYPE_STRING)); | |
2465 | |
2466 purple_signal_register(handle, "chat-buddy-joining", | |
2467 purple_marshal_BOOLEAN__POINTER_POINTER_UINT, | |
2468 purple_value_new(PURPLE_TYPE_BOOLEAN), 3, | |
2469 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2470 PURPLE_SUBTYPE_CONVERSATION), | |
2471 purple_value_new(PURPLE_TYPE_STRING), | |
2472 purple_value_new(PURPLE_TYPE_UINT)); | |
2473 | |
2474 purple_signal_register(handle, "chat-buddy-joined", | |
2475 purple_marshal_VOID__POINTER_POINTER_UINT_UINT, NULL, 4, | |
2476 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2477 PURPLE_SUBTYPE_CONVERSATION), | |
2478 purple_value_new(PURPLE_TYPE_STRING), | |
2479 purple_value_new(PURPLE_TYPE_UINT), | |
2480 purple_value_new(PURPLE_TYPE_BOOLEAN)); | |
2481 | |
2482 purple_signal_register(handle, "chat-buddy-flags", | |
2483 purple_marshal_VOID__POINTER_POINTER_UINT_UINT, NULL, 4, | |
2484 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2485 PURPLE_SUBTYPE_CONVERSATION), | |
2486 purple_value_new(PURPLE_TYPE_STRING), | |
2487 purple_value_new(PURPLE_TYPE_UINT), | |
2488 purple_value_new(PURPLE_TYPE_UINT)); | |
2489 | |
2490 purple_signal_register(handle, "chat-buddy-leaving", | |
2491 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER, | |
2492 purple_value_new(PURPLE_TYPE_BOOLEAN), 3, | |
2493 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2494 PURPLE_SUBTYPE_CONVERSATION), | |
2495 purple_value_new(PURPLE_TYPE_STRING), | |
2496 purple_value_new(PURPLE_TYPE_STRING)); | |
2497 | |
2498 purple_signal_register(handle, "chat-buddy-left", | |
2499 purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, | |
2500 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2501 PURPLE_SUBTYPE_CONVERSATION), | |
2502 purple_value_new(PURPLE_TYPE_STRING), | |
2503 purple_value_new(PURPLE_TYPE_STRING)); | |
2504 | |
2505 purple_signal_register(handle, "chat-inviting-user", | |
2506 purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, | |
2507 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2508 PURPLE_SUBTYPE_CONVERSATION), | |
2509 purple_value_new(PURPLE_TYPE_STRING), | |
2510 purple_value_new_outgoing(PURPLE_TYPE_STRING)); | |
2511 | |
2512 purple_signal_register(handle, "chat-invited-user", | |
2513 purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, | |
2514 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2515 PURPLE_SUBTYPE_CONVERSATION), | |
2516 purple_value_new(PURPLE_TYPE_STRING), | |
2517 purple_value_new(PURPLE_TYPE_STRING)); | |
2518 | |
2519 purple_signal_register(handle, "chat-invited", | |
2520 purple_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER, | |
20174
eb758ca32ea9
chat-invited handlers return an interger value.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19706
diff
changeset
|
2521 purple_value_new(PURPLE_TYPE_INT), 5, |
15822 | 2522 purple_value_new(PURPLE_TYPE_SUBTYPE, |
2523 PURPLE_SUBTYPE_ACCOUNT), | |
2524 purple_value_new(PURPLE_TYPE_STRING), | |
2525 purple_value_new(PURPLE_TYPE_STRING), | |
2526 purple_value_new(PURPLE_TYPE_STRING), | |
2527 purple_value_new(PURPLE_TYPE_POINTER)); | |
2528 | |
23169
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2529 purple_signal_register(handle, "chat-invite-blocked", |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2530 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER, |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2531 NULL, 5, |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2532 purple_value_new(PURPLE_TYPE_SUBTYPE, |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2533 PURPLE_SUBTYPE_ACCOUNT), |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2534 purple_value_new(PURPLE_TYPE_STRING), |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2535 purple_value_new(PURPLE_TYPE_STRING), |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2536 purple_value_new(PURPLE_TYPE_STRING), |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2537 purple_value_new(PURPLE_TYPE_BOXED, "GHashTable *")); |
ff8ec3d58367
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23111
diff
changeset
|
2538 |
15822 | 2539 purple_signal_register(handle, "chat-joined", |
2540 purple_marshal_VOID__POINTER, NULL, 1, | |
2541 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2542 PURPLE_SUBTYPE_CONVERSATION)); | |
2543 | |
22771
43233dc1d40b
applied changes from 4c5110037671f84e3e775214c32692b5b23c11e1
Evan Schoenberg <evan.s@dreskin.net>
parents:
22757
diff
changeset
|
2544 purple_signal_register(handle, "chat-join-failed", |
43233dc1d40b
applied changes from 4c5110037671f84e3e775214c32692b5b23c11e1
Evan Schoenberg <evan.s@dreskin.net>
parents:
22757
diff
changeset
|
2545 purple_marshal_VOID__POINTER_POINTER, NULL, 2, |
43233dc1d40b
applied changes from 4c5110037671f84e3e775214c32692b5b23c11e1
Evan Schoenberg <evan.s@dreskin.net>
parents:
22757
diff
changeset
|
2546 purple_value_new(PURPLE_TYPE_SUBTYPE, |
43233dc1d40b
applied changes from 4c5110037671f84e3e775214c32692b5b23c11e1
Evan Schoenberg <evan.s@dreskin.net>
parents:
22757
diff
changeset
|
2547 PURPLE_SUBTYPE_CONNECTION), |
23103
591ef3693345
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evan.s@dreskin.net>
parents:
22771
diff
changeset
|
2548 purple_value_new(PURPLE_TYPE_POINTER)); |
22771
43233dc1d40b
applied changes from 4c5110037671f84e3e775214c32692b5b23c11e1
Evan Schoenberg <evan.s@dreskin.net>
parents:
22757
diff
changeset
|
2549 |
15822 | 2550 purple_signal_register(handle, "chat-left", |
2551 purple_marshal_VOID__POINTER, NULL, 1, | |
2552 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2553 PURPLE_SUBTYPE_CONVERSATION)); | |
2554 | |
2555 purple_signal_register(handle, "chat-topic-changed", | |
2556 purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, | |
2557 purple_value_new(PURPLE_TYPE_SUBTYPE, | |
2558 PURPLE_SUBTYPE_CONVERSATION), | |
2559 purple_value_new(PURPLE_TYPE_STRING), | |
2560 purple_value_new(PURPLE_TYPE_STRING)); | |
17735
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2561 |
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2562 purple_signal_register(handle, "conversation-extended-menu", |
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2563 purple_marshal_VOID__POINTER_POINTER, NULL, 2, |
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2564 purple_value_new(PURPLE_TYPE_SUBTYPE, |
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2565 PURPLE_SUBTYPE_CONVERSATION), |
da2bab3b9fab
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17082
diff
changeset
|
2566 purple_value_new(PURPLE_TYPE_BOXED, "GList **")); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2567 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2568 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2569 void |
15822 | 2570 purple_conversations_uninit(void) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2571 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2572 while (conversations) |
15822 | 2573 purple_conversation_destroy((PurpleConversation*)conversations->data); |
27702
ce3bc26aa8cd
More efficient purple_find_conversation_with_account. Closes #9703.
aman@tmm1.net
parents:
27689
diff
changeset
|
2574 g_hash_table_destroy(conversation_cache); |
15822 | 2575 purple_signals_unregister_by_instance(purple_conversations_get_handle()); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2576 } |
19706
7ea794e7cec3
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
2577 |