Sun, 23 Jun 2013 15:23:44 +0530
Global replace - renamed functions and types according to GObject-based PurpleConversation API
| 66 | 1 | /* |
| 15884 | 2 | * purple |
| 66 | 3 | * |
| 15884 | 4 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 6 | * source distribution. | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
7 | * |
| 66 | 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19769
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 66 | 21 | */ |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
22 | #include "internal.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
23 | #include "blist.h" |
|
17266
d4dc6a9ca244
New function purple_conversation_do_command. This is almost like
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17265
diff
changeset
|
24 | #include "cmds.h" |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
25 | #include "conversation.h" |
|
11146
c56333373e3c
[gaim-migrate @ 13217]
Piotr Zielinski <zielaj@users.sourceforge.net>
parents:
11137
diff
changeset
|
26 | #include "dbus-maybe.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
27 | #include "debug.h" |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6846
diff
changeset
|
28 | #include "imgstore.h" |
|
5436
a0e0bacaa196
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5350
diff
changeset
|
29 | #include "notify.h" |
|
5539
a13dd0ba205a
[gaim-migrate @ 5939]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
30 | #include "prefs.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
31 | #include "prpl.h" |
| 14582 | 32 | #include "request.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
33 | #include "signals.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
34 | #include "util.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5860
diff
changeset
|
35 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
36 | /** @copydoc _PurpleConversationPrivate */ |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
34601
diff
changeset
|
37 | typedef struct _PurpleConversationPrivate PurpleConversationPrivate; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
38 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
39 | /** |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
40 | * A core representation of a conversation between two or more people. |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
41 | * |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
42 | * The conversation can be an IM or a chat. |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
43 | */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
44 | struct _PurpleConversationPrivate |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
45 | { |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
46 | PurpleConversationType type; /**< The type of conversation. */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
47 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
48 | PurpleAccount *account; /**< The user using this conversation. */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
49 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
50 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
51 | char *name; /**< The name of the conversation. */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
52 | char *title; /**< The window title. */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
53 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
54 | gboolean logging; /**< The status of logging. */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
55 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
56 | GList *logs; /**< This conversation's logs */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
57 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
58 | PurpleConversationUiOps *ui_ops; /**< UI-specific operations. */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
59 | void *ui_data; /**< UI-specific data. */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
60 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
61 | GHashTable *data; /**< Plugin-specific data. */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
62 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
63 | PurpleConnectionFlags features; /**< The supported features */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
64 | GList *message_history; /**< Message history, as a GList of PurpleConversationMessage's */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
65 | }; |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
66 | |
|
34601
bccb29d7be14
Removed GObject for PurpleConversationMessage, this will be a GBoxed
Ankit Vani <a@nevitus.org>
parents:
34600
diff
changeset
|
67 | /** TODO GBoxed |
|
32690
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
68 | * Description of a conversation message |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
69 | */ |
|
34601
bccb29d7be14
Removed GObject for PurpleConversationMessage, this will be a GBoxed
Ankit Vani <a@nevitus.org>
parents:
34600
diff
changeset
|
70 | struct _PurpleConversationMessage |
|
32690
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
71 | { |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
72 | char *who; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
73 | char *what; |
|
34620
e49aa67344e1
Renamed PurpleConversationMessageFlags back to PurpleMessageFlags.
Ankit Vani <a@nevitus.org>
parents:
34602
diff
changeset
|
74 | PurpleMessageFlags flags; |
|
32690
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
75 | time_t when; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
76 | PurpleConversation *conv; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
77 | char *alias; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
78 | }; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
79 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
80 | /** |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
81 | * A hash table used for efficient lookups of conversations by name. |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
82 | * struct _purple_hconv => PurpleConversation* |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
83 | */ |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
84 | static GHashTable *conversation_cache = NULL; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
85 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
86 | struct _purple_hconv { |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
87 | PurpleConversationType type; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
88 | char *name; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
89 | const PurpleAccount *account; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
90 | }; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
91 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
92 | static guint _purple_conversations_hconv_hash(struct _purple_hconv *hc) |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
93 | { |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
94 | return g_str_hash(hc->name) ^ hc->type ^ g_direct_hash(hc->account); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
95 | } |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
96 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
97 | static guint _purple_conversations_hconv_equal(struct _purple_hconv *hc1, struct _purple_hconv *hc2) |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
98 | { |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
99 | return (hc1->type == hc2->type && |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
100 | hc1->account == hc2->account && |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
101 | g_str_equal(hc1->name, hc2->name)); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
102 | } |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
103 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
104 | static void _purple_conversations_hconv_free_key(struct _purple_hconv *hc) |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
105 | { |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
106 | g_free(hc->name); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
107 | g_free(hc); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
108 | } |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
109 | |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
110 | static guint _purple_conversation_user_hash(gconstpointer data) |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
111 | { |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
112 | const gchar *name = data; |
|
31909
6367f2188824
conversation: Use the right comparison type (case-sensitive) for the hash table
Paul Aurich <darkrain42@pidgin.im>
parents:
31908
diff
changeset
|
113 | gchar *collated; |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
114 | guint hash; |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
115 | |
|
31909
6367f2188824
conversation: Use the right comparison type (case-sensitive) for the hash table
Paul Aurich <darkrain42@pidgin.im>
parents:
31908
diff
changeset
|
116 | collated = g_utf8_collate_key(name, -1); |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
117 | hash = g_str_hash(collated); |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
118 | g_free(collated); |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
119 | return hash; |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
120 | } |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
121 | |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
122 | static gboolean _purple_conversation_user_equal(gconstpointer a, gconstpointer b) |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
123 | { |
|
31909
6367f2188824
conversation: Use the right comparison type (case-sensitive) for the hash table
Paul Aurich <darkrain42@pidgin.im>
parents:
31908
diff
changeset
|
124 | return !g_utf8_collate(a, b); |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
125 | } |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
126 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
127 | static gboolean |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
128 | reset_typing_cb(gpointer data) |
| 66 | 129 | { |
| 15884 | 130 | PurpleConversation *c = (PurpleConversation *)data; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
131 | PurpleIMConversationPrivate *priv; |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
132 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
133 | im = PURPLE_IM_CONVERSATION_GET_PRIVATE(c); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
134 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
135 | purple_im_conversation_set_typing_state(im, PURPLE_IM_CONVERSATION_NOT_TYPING); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
136 | purple_im_conversation_stop_typing_timeout(im); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
137 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
138 | return FALSE; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
139 | } |
| 3159 | 140 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
141 | static gboolean |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
142 | send_typed_cb(gpointer data) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
143 | { |
| 15884 | 144 | PurpleConversation *conv = (PurpleConversation *)data; |
| 145 | PurpleConnection *gc; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
146 | const char *name; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
147 | |
|
13714
babc08c1c499
[gaim-migrate @ 16116]
Richard Laager <rlaager@pidgin.im>
parents:
13664
diff
changeset
|
148 | g_return_val_if_fail(conv != NULL, FALSE); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
149 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
150 | gc = purple_conversation_get_connection(conv); |
| 15884 | 151 | name = purple_conversation_get_name(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
152 | |
|
13714
babc08c1c499
[gaim-migrate @ 16116]
Richard Laager <rlaager@pidgin.im>
parents:
13664
diff
changeset
|
153 | if (gc != NULL && name != NULL) { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
154 | /* We set this to 1 so that PURPLE_IM_CONVERSATION_TYPING will be sent |
| 15884 | 155 | * if the Purple user types anything else. |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
156 | */ |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
157 | purple_im_conversation_set_type_again(PURPLE_IM_CONVERSATION_GET_PRIVATE(conv), 1); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
158 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
159 | serv_send_typing(gc, name, PURPLE_IM_CONVERSATION_TYPED); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
160 | |
| 15884 | 161 | purple_debug(PURPLE_DEBUG_MISC, "conversation", "typed...\n"); |
|
573
a267d68a8240
[gaim-migrate @ 583]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
570
diff
changeset
|
162 | } |
| 66 | 163 | |
|
2725
a844d0964552
[gaim-migrate @ 2738]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2722
diff
changeset
|
164 | return FALSE; |
| 66 | 165 | } |
| 166 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
167 | static void |
|
34620
e49aa67344e1
Renamed PurpleConversationMessageFlags back to PurpleMessageFlags.
Ankit Vani <a@nevitus.org>
parents:
34602
diff
changeset
|
168 | common_send(PurpleConversation *conv, const char *message, PurpleMessageFlags msgflags) |
| 3790 | 169 | { |
| 15884 | 170 | PurpleConversationType type; |
| 171 | PurpleAccount *account; | |
| 172 | PurpleConnection *gc; | |
|
8076
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
173 | char *displayed = NULL, *sent = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
174 | int err = 0; |
| 3790 | 175 | |
|
23440
d20160530c78
Don't use strlen() when we can just check the first character
Mark Doliner <markdoliner@pidgin.im>
parents:
23312
diff
changeset
|
176 | if (*message == '\0') |
|
7947
76de4859a53a
[gaim-migrate @ 8621]
Mark Doliner <markdoliner@pidgin.im>
parents:
7930
diff
changeset
|
177 | return; |
|
76de4859a53a
[gaim-migrate @ 8621]
Mark Doliner <markdoliner@pidgin.im>
parents:
7930
diff
changeset
|
178 | |
| 15884 | 179 | account = purple_conversation_get_account(conv); |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
180 | gc = purple_conversation_get_connection(conv); |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
181 | |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
182 | g_return_if_fail(account != NULL); |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
183 | g_return_if_fail(gc != NULL); |
| 3731 | 184 | |
| 15884 | 185 | type = purple_conversation_get_type(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
186 | |
|
18087
b56ec2e9dae6
add a PURPLE_MESSAGE_NO_LINKIFY to prevent things from getting linkified
Nathan Walp <nwalp@pidgin.im>
parents:
18068
diff
changeset
|
187 | /* Always linkfy the text for display, unless we're |
|
b56ec2e9dae6
add a PURPLE_MESSAGE_NO_LINKIFY to prevent things from getting linkified
Nathan Walp <nwalp@pidgin.im>
parents:
18068
diff
changeset
|
188 | * explicitly asked to do otheriwse*/ |
|
34620
e49aa67344e1
Renamed PurpleConversationMessageFlags back to PurpleMessageFlags.
Ankit Vani <a@nevitus.org>
parents:
34602
diff
changeset
|
189 | if (!(msgflags & PURPLE_MESSAGE_INVISIBLE)) { |
|
e49aa67344e1
Renamed PurpleConversationMessageFlags back to PurpleMessageFlags.
Ankit Vani <a@nevitus.org>
parents:
34602
diff
changeset
|
190 | if(msgflags & PURPLE_MESSAGE_NO_LINKIFY) |
|
19674
371069ae12fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19672
diff
changeset
|
191 | displayed = g_strdup(message); |
|
371069ae12fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19672
diff
changeset
|
192 | else |
|
371069ae12fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19672
diff
changeset
|
193 | displayed = purple_markup_linkify(message); |
|
371069ae12fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19672
diff
changeset
|
194 | } |
|
371069ae12fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19672
diff
changeset
|
195 | |
|
371069ae12fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19672
diff
changeset
|
196 | if (displayed && (conv->features & PURPLE_CONNECTION_HTML) && |
|
34620
e49aa67344e1
Renamed PurpleConversationMessageFlags back to PurpleMessageFlags.
Ankit Vani <a@nevitus.org>
parents:
34602
diff
changeset
|
197 | !(msgflags & PURPLE_MESSAGE_RAW)) { |
|
12901
85ddd02a44d1
[gaim-migrate @ 15254]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12867
diff
changeset
|
198 | sent = g_strdup(displayed); |
|
19674
371069ae12fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19672
diff
changeset
|
199 | } else |
|
12901
85ddd02a44d1
[gaim-migrate @ 15254]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12867
diff
changeset
|
200 | sent = g_strdup(message); |
| 5136 | 201 | |
|
34620
e49aa67344e1
Renamed PurpleConversationMessageFlags back to PurpleMessageFlags.
Ankit Vani <a@nevitus.org>
parents:
34602
diff
changeset
|
202 | msgflags |= PURPLE_MESSAGE_SEND; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
203 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
204 | if (type == PURPLE_CONVERSATION_TYPE_IM) { |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
205 | PurpleIMConversationPrivate *priv = PURPLE_IM_CONVERSATION_GET_PRIVATE(conv); |
| 15884 | 206 | |
| 207 | purple_signal_emit(purple_conversations_get_handle(), "sending-im-msg", | |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
208 | account, |
| 15884 | 209 | purple_conversation_get_name(conv), &sent); |
|
8076
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
210 | |
|
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
211 | if (sent != NULL && sent[0] != '\0') { |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12018
diff
changeset
|
212 | |
| 15884 | 213 | err = serv_send_im(gc, purple_conversation_get_name(conv), |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12018
diff
changeset
|
214 | sent, msgflags); |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6846
diff
changeset
|
215 | |
|
8078
e8e087085339
[gaim-migrate @ 8777]
Mark Doliner <markdoliner@pidgin.im>
parents:
8076
diff
changeset
|
216 | if ((err > 0) && (displayed != NULL)) |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
217 | purple_im_conversation_write(im, NULL, displayed, msgflags, time(NULL)); |
| 15884 | 218 | |
| 219 | purple_signal_emit(purple_conversations_get_handle(), "sent-im-msg", | |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
220 | account, |
| 15884 | 221 | purple_conversation_get_name(conv), sent); |
|
2102
2d024ad2e07b
[gaim-migrate @ 2112]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2094
diff
changeset
|
222 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
223 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
224 | else { |
| 15884 | 225 | purple_signal_emit(purple_conversations_get_handle(), "sending-chat-msg", |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
226 | account, &sent, |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
227 | purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv))); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
228 | |
|
8076
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
229 | if (sent != NULL && sent[0] != '\0') { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
230 | err = serv_chat_send(gc, purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv)), sent, msgflags); |
| 15884 | 231 | |
| 232 | purple_signal_emit(purple_conversations_get_handle(), "sent-chat-msg", | |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
233 | account, sent, |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
234 | purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv))); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
235 | } |
|
472
9a5b8da2d760
[gaim-migrate @ 482]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
411
diff
changeset
|
236 | } |
|
1253
f02697a6aada
[gaim-migrate @ 1263]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
237 | |
|
2123
4cfdde0aa3f1
[gaim-migrate @ 2133]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2111
diff
changeset
|
238 | if (err < 0) { |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
239 | const char *who; |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12902
diff
changeset
|
240 | const char *msg; |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
241 | |
| 15884 | 242 | who = purple_conversation_get_name(conv); |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
243 | |
|
5213
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
244 | if (err == -E2BIG) { |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
245 | msg = _("Unable to send message: The message is too large."); |
|
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
246 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
247 | if (!purple_conversation_helper_present_error(who, account, msg)) { |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12902
diff
changeset
|
248 | char *msg2 = g_strdup_printf(_("Unable to send message to %s."), who); |
| 15884 | 249 | purple_notify_error(gc, NULL, msg2, _("The message is too large.")); |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12902
diff
changeset
|
250 | g_free(msg2); |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
251 | } |
|
5213
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
252 | } |
|
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
253 | else if (err == -ENOTCONN) { |
| 15884 | 254 | purple_debug(PURPLE_DEBUG_ERROR, "conversation", |
|
5213
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
255 | "Not yet connected.\n"); |
|
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
256 | } |
|
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
257 | else { |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
258 | msg = _("Unable to send message."); |
|
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
259 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
260 | if (!purple_conversation_helper_present_error(who, account, msg)) { |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12902
diff
changeset
|
261 | char *msg2 = g_strdup_printf(_("Unable to send message to %s."), who); |
| 15884 | 262 | purple_notify_error(gc, NULL, msg2, NULL); |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12902
diff
changeset
|
263 | g_free(msg2); |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
264 | } |
|
5213
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
265 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
266 | } |
|
8076
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
267 | |
|
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
268 | g_free(displayed); |
|
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
269 | g_free(sent); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
270 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
271 | |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
272 | static void |
| 15884 | 273 | open_log(PurpleConversation *conv) |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
274 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
275 | conv->logs = g_list_append(NULL, purple_log_new(conv->type == PURPLE_CONVERSATION_TYPE_CHAT ? PURPLE_LOG_CHAT : |
| 15884 | 276 | PURPLE_LOG_IM, conv->name, conv->account, |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13107
diff
changeset
|
277 | conv, time(NULL), NULL)); |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
278 | } |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
279 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
280 | /* Functions that deal with PurpleConversationMessage */ |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
281 | |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
282 | static void |
|
21253
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
283 | add_message_to_history(PurpleConversation *conv, const char *who, const char *alias, |
|
34620
e49aa67344e1
Renamed PurpleConversationMessageFlags back to PurpleMessageFlags.
Ankit Vani <a@nevitus.org>
parents:
34602
diff
changeset
|
284 | const char *message, PurpleMessageFlags flags, time_t when) |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
285 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
286 | PurpleConversationMessage *msg; |
|
22458
42e804b6db56
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
287 | PurpleConnection *gc; |
|
42e804b6db56
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
288 | |
|
42e804b6db56
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
289 | gc = purple_account_get_connection(conv->account); |
|
19601
8f000de5f9de
Do not duplicate the same message in the history, and store the correct
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19595
diff
changeset
|
290 | |
|
34620
e49aa67344e1
Renamed PurpleConversationMessageFlags back to PurpleMessageFlags.
Ankit Vani <a@nevitus.org>
parents:
34602
diff
changeset
|
291 | if (flags & PURPLE_MESSAGE_SEND) { |
|
19601
8f000de5f9de
Do not duplicate the same message in the history, and store the correct
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19595
diff
changeset
|
292 | const char *me = NULL; |
|
22458
42e804b6db56
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
293 | if (gc) |
|
42e804b6db56
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
294 | me = purple_connection_get_display_name(gc); |
|
19601
8f000de5f9de
Do not duplicate the same message in the history, and store the correct
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19595
diff
changeset
|
295 | if (!me) |
|
32623
547eacef0b63
Convert libpurple and protocol prpl's to use the purple_account_* accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32621
diff
changeset
|
296 | me = purple_account_get_username(conv->account); |
|
19601
8f000de5f9de
Do not duplicate the same message in the history, and store the correct
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19595
diff
changeset
|
297 | who = me; |
|
8f000de5f9de
Do not duplicate the same message in the history, and store the correct
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19595
diff
changeset
|
298 | } |
|
21253
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
299 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
300 | msg = g_new0(PurpleConversationMessage, 1); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
301 | PURPLE_DBUS_REGISTER_POINTER(msg, PurpleConversationMessage); |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
302 | msg->who = g_strdup(who); |
|
21253
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
303 | msg->alias = g_strdup(alias); |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
304 | msg->flags = flags; |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
305 | msg->what = g_strdup(message); |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
306 | msg->when = when; |
|
20422
49be7bdacd56
Contactize the message history when re-attaching the pidgin ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20420
diff
changeset
|
307 | msg->conv = conv; |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
308 | |
|
19904
8abf4c2056eb
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
309 | conv->message_history = g_list_prepend(conv->message_history, msg); |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
310 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
311 | |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
312 | static void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
313 | free_conv_message(PurpleConversationMessage *msg) |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
314 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
315 | g_free(msg->who); |
|
21253
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
316 | g_free(msg->alias); |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
317 | g_free(msg->what); |
|
19595
acd61f0d6a81
DBus-ify the message history in a conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19593
diff
changeset
|
318 | PURPLE_DBUS_UNREGISTER_POINTER(msg); |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
319 | g_free(msg); |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
320 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
321 | |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
322 | static void |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
323 | message_history_free(GList *list) |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
324 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
325 | g_list_foreach(list, (GFunc)free_conv_message, NULL); |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
326 | g_list_free(list); |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
327 | } |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
328 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
329 | /************************************************************************** |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
330 | * Conversation API |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
331 | **************************************************************************/ |
| 8256 | 332 | static void |
| 15884 | 333 | purple_conversation_chat_cleanup_for_rejoin(PurpleConversation *conv) |
| 8256 | 334 | { |
| 335 | const char *disp; | |
| 15884 | 336 | PurpleAccount *account; |
| 337 | PurpleConnection *gc; | |
| 338 | ||
| 339 | account = purple_conversation_get_account(conv); | |
| 340 | ||
| 341 | purple_conversation_close_logs(conv); | |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
342 | open_log(conv); |
| 8373 | 343 | |
| 15884 | 344 | gc = purple_account_get_connection(account); |
| 345 | ||
| 346 | if ((disp = purple_connection_get_display_name(gc)) != NULL) | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
347 | purple_chat_conversation_set_nick(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv), disp); |
| 8373 | 348 | else |
| 349 | { | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
350 | purple_chat_conversation_set_nick(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv), |
| 15884 | 351 | purple_account_get_username(account)); |
| 8256 | 352 | } |
| 353 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
354 | purple_chat_conversation_clear_users(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv)); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
355 | purple_chat_conversation_set_topic(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv), NULL, NULL); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
356 | PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv)->left = FALSE; |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
357 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
358 | purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_CHATLEFT); |
| 8256 | 359 | } |
| 360 | ||
| 15884 | 361 | PurpleConversation * |
| 362 | purple_conversation_new(PurpleConversationType type, PurpleAccount *account, | |
|
4476
bf88170ba269
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4471
diff
changeset
|
363 | const char *name) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
364 | { |
| 15884 | 365 | PurpleConversation *conv; |
| 366 | PurpleConnection *gc; | |
| 367 | PurpleConversationUiOps *ops; | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
368 | struct _purple_hconv *hc; |
| 15884 | 369 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
370 | g_return_val_if_fail(type != PURPLE_CONVERSATION_TYPE_UNKNOWN, NULL); |
|
7088
0920bc6160ae
[gaim-migrate @ 7653]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
371 | g_return_val_if_fail(account != NULL, NULL); |
|
0920bc6160ae
[gaim-migrate @ 7653]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
372 | g_return_val_if_fail(name != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
373 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
374 | /* Check if this conversation already exists. */ |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
375 | if ((conv = purple_conversations_find_with_account(type, name, account)) != NULL) |
|
8271
a79531291e7f
[gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents:
8256
diff
changeset
|
376 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
377 | if (purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_CHAT && |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
378 | !purple_chat_conversation_has_left(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv))) { |
|
27954
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
379 | purple_debug_warning("conversation", "Trying to create multiple " |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
380 | "chats (%s) with the same name is deprecated and will be " |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
381 | "removed in libpurple 3.0.0", name); |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
382 | } |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
383 | |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
384 | /* |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
385 | * This hack is necessary because some prpls (MSN) have unnamed chats |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
386 | * that all use the same name. A PurpleConversation for one of those |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
387 | * is only ever re-used if the user has left, so calls to |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
388 | * purple_conversation_new need to fall-through to creating a new |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
389 | * chat. |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
390 | * TODO 3.0.0: Remove this workaround and mandate unique names. |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
391 | */ |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
392 | if (purple_conversation_get_type(conv) != PURPLE_CONVERSATION_TYPE_CHAT || |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
393 | purple_chat_conversation_has_left(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv))) |
|
22170
07ee0f226796
I am going to go ahead and commit+push this revision/fix of purple_conversation_new.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
394 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
395 | if (purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_CHAT) |
|
22170
07ee0f226796
I am going to go ahead and commit+push this revision/fix of purple_conversation_new.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
396 | purple_conversation_chat_cleanup_for_rejoin(conv); |
|
07ee0f226796
I am going to go ahead and commit+push this revision/fix of purple_conversation_new.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
397 | |
|
07ee0f226796
I am going to go ahead and commit+push this revision/fix of purple_conversation_new.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
398 | return conv; |
|
07ee0f226796
I am going to go ahead and commit+push this revision/fix of purple_conversation_new.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
399 | } |
| 8256 | 400 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
401 | |
| 15884 | 402 | gc = purple_account_get_connection(account); |
| 10665 | 403 | g_return_val_if_fail(gc != NULL, NULL); |
| 404 | ||
| 15884 | 405 | conv = g_new0(PurpleConversation, 1); |
| 406 | PURPLE_DBUS_REGISTER_POINTER(conv, PurpleConversation); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
407 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
408 | conv->type = type; |
| 4491 | 409 | conv->account = account; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
410 | conv->name = g_strdup(name); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
411 | conv->title = g_strdup(name); |
|
5139
24c56d94ed79
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
412 | conv->data = g_hash_table_new_full(g_str_hash, g_str_equal, |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
413 | g_free, NULL); |
| 10665 | 414 | /* copy features from the connection. */ |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32633
diff
changeset
|
415 | conv->features = purple_connection_get_flags(gc); |
| 11581 | 416 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
417 | if (type == PURPLE_CONVERSATION_TYPE_IM) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
418 | { |
| 15884 | 419 | PurpleBuddyIcon *icon; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
420 | conv->u.im = g_new0(PurpleIMConversationPrivate, 1); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
421 | conv->u.im->conv = conv; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
422 | PURPLE_DBUS_REGISTER_POINTER(conv->u.im, PurpleIMConversationPrivate); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
423 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
424 | ims = g_list_prepend(ims, conv); |
| 15884 | 425 | if ((icon = purple_buddy_icons_find(account, name))) |
|
16900
e9f12eb06c5b
Rework purple_buddy_icons_find() to return a reference for the caller, which
Richard Laager <rlaager@pidgin.im>
parents:
16545
diff
changeset
|
426 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
427 | purple_im_conversation_set_icon(conv->u.im, icon); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
428 | /* purple_im_conversation_set_icon refs the icon. */ |
|
16900
e9f12eb06c5b
Rework purple_buddy_icons_find() to return a reference for the caller, which
Richard Laager <rlaager@pidgin.im>
parents:
16545
diff
changeset
|
429 | purple_buddy_icon_unref(icon); |
|
e9f12eb06c5b
Rework purple_buddy_icons_find() to return a reference for the caller, which
Richard Laager <rlaager@pidgin.im>
parents:
16545
diff
changeset
|
430 | } |
| 15884 | 431 | |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
432 | if (purple_prefs_get_bool("/purple/logging/log_ims")) |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
433 | { |
| 15884 | 434 | purple_conversation_set_logging(conv, TRUE); |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
435 | open_log(conv); |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
436 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
437 | } |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
438 | else if (type == PURPLE_CONVERSATION_TYPE_CHAT) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
439 | { |
| 8158 | 440 | const char *disp; |
| 441 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
442 | conv->u.chat = g_new0(PurpleChatConversationPrivate, 1); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
443 | conv->u.chat->conv = conv; |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
444 | conv->u.chat->users = g_hash_table_new_full(_purple_conversation_user_hash, |
|
31905
1a27482becf4
conversation: Use a copy of the name and clear hash after emitting "left" signals
Paul Aurich <darkrain42@pidgin.im>
parents:
31903
diff
changeset
|
445 | _purple_conversation_user_equal, g_free, NULL); |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
446 | PURPLE_DBUS_REGISTER_POINTER(conv->u.chat, PurpleChatConversationPrivate); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
447 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
448 | chats = g_list_prepend(chats, conv); |
|
8271
a79531291e7f
[gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents:
8256
diff
changeset
|
449 | |
|
32624
f957ad287bcc
Convert code to use the purple_account accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
450 | if ((disp = purple_connection_get_display_name(purple_account_get_connection(account)))) |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
451 | purple_chat_conversation_set_nick(conv->u.chat, disp); |
|
8271
a79531291e7f
[gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents:
8256
diff
changeset
|
452 | else |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
453 | purple_chat_conversation_set_nick(conv->u.chat, |
| 15884 | 454 | purple_account_get_username(account)); |
| 455 | ||
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
456 | if (purple_prefs_get_bool("/purple/logging/log_chats")) |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
457 | { |
| 15884 | 458 | purple_conversation_set_logging(conv, TRUE); |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
459 | open_log(conv); |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
460 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
461 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
462 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
463 | conversations = g_list_prepend(conversations, conv); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
464 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
465 | hc = g_new(struct _purple_hconv, 1); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
466 | hc->name = g_strdup(purple_normalize(account, conv->name)); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
467 | hc->account = account; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
468 | hc->type = type; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
469 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
470 | g_hash_table_insert(conversation_cache, hc, conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
471 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
472 | /* Auto-set the title. */ |
| 15884 | 473 | purple_conversation_autoset_title(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
474 | |
|
11602
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
475 | /* Don't move this.. it needs to be one of the last things done otherwise |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
476 | * it causes mysterious crashes on my system. |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
477 | * -- Gary |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
478 | */ |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
479 | ops = conv->ui_ops = default_ops; |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
480 | if (ops != NULL && ops->create_conversation != NULL) |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
481 | ops->create_conversation(conv); |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
482 | |
| 15884 | 483 | purple_signal_emit(purple_conversations_get_handle(), |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
484 | "conversation-created", conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
485 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
486 | return conv; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
487 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
488 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
489 | void |
| 15884 | 490 | purple_conversation_destroy(PurpleConversation *conv) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
491 | { |
| 15884 | 492 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 493 | PurpleConversationUiOps *ops; | |
| 494 | PurpleConnection *gc; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
495 | const char *name; |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
496 | struct _purple_hconv hc; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
497 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
498 | g_return_if_fail(conv != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
499 | |
| 15884 | 500 | purple_request_close_with_handle(conv); |
| 501 | ||
| 502 | ops = purple_conversation_get_ui_ops(conv); | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
503 | gc = purple_conversation_get_connection(conv); |
| 15884 | 504 | name = purple_conversation_get_name(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
505 | |
| 8373 | 506 | if (gc != NULL) |
| 507 | { | |
|
5262
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
508 | /* Still connected */ |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22170
diff
changeset
|
509 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
| 15884 | 510 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
511 | if (purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_IM) |
| 8373 | 512 | { |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
513 | if (purple_prefs_get_bool("/purple/conversations/im/send_typing")) |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
514 | serv_send_typing(gc, name, PURPLE_IM_CONVERSATION_NOT_TYPING); |
|
5262
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
515 | |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
516 | if (gc && prpl_info->convo_closed != NULL) |
|
6403
9b2428783d7c
[gaim-migrate @ 6908]
Christian Hammond <chipx86@chipx86.com>
parents:
6402
diff
changeset
|
517 | prpl_info->convo_closed(gc, name); |
|
5262
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
518 | } |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
519 | else if (purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_CHAT) |
| 8373 | 520 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
521 | int chat_id = purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv)); |
|
8271
a79531291e7f
[gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents:
8256
diff
changeset
|
522 | #if 0 |
|
5262
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
523 | /* |
|
6030
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
524 | * This is unfortunately necessary, because calling |
| 15884 | 525 | * serv_chat_leave() calls this purple_conversation_destroy(), |
|
6030
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
526 | * which leads to two calls here.. We can't just return after |
|
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
527 | * this, because then it'll return on the next pass. So, since |
|
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
528 | * serv_got_chat_left(), which is eventually called from the |
|
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
529 | * prpl that serv_chat_leave() calls, removes this conversation |
|
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
530 | * from the gc's buddy_chats list, we're going to check to see |
|
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
531 | * if this exists in the list. If so, we want to return after |
|
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
532 | * calling this, because it'll be called again. If not, fall |
|
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
533 | * through, because it'll have already been removed, and we'd |
|
5262
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
534 | * be on the 2nd pass. |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
535 | * |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
536 | * Long paragraph. <-- Short sentence. |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
537 | * |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
538 | * -- ChipX86 |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
539 | */ |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
540 | |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
541 | if (gc && g_slist_find(gc->buddy_chats, conv) != NULL) { |
| 8373 | 542 | serv_chat_leave(gc, chat_id); |
|
5262
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
543 | |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
544 | return; |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
545 | } |
|
8271
a79531291e7f
[gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents:
8256
diff
changeset
|
546 | #endif |
| 8373 | 547 | /* |
| 548 | * Instead of all of that, lets just close the window when | |
| 549 | * the user tells us to, and let the prpl deal with the | |
| 550 | * internals on it's own time. Don't do this if the prpl already | |
| 551 | * knows it left the chat. | |
| 552 | */ | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
553 | if (!purple_chat_conversation_has_left(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv))) |
| 8373 | 554 | serv_chat_leave(gc, chat_id); |
| 555 | ||
| 556 | /* | |
| 557 | * If they didn't call serv_got_chat_left by now, it's too late. | |
| 558 | * So we better do it for them before we destroy the thing. | |
| 559 | */ | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
560 | if (!purple_chat_conversation_has_left(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv))) |
| 8373 | 561 | serv_got_chat_left(gc, chat_id); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
562 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
563 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
564 | |
|
12018
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
565 | /* remove from conversations and im/chats lists prior to emit */ |
|
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
566 | conversations = g_list_remove(conversations, conv); |
|
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
567 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
568 | if(conv->type==PURPLE_CONVERSATION_TYPE_IM) |
|
12018
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
569 | ims = g_list_remove(ims, conv); |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
570 | else if(conv->type==PURPLE_CONVERSATION_TYPE_CHAT) |
|
12018
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
571 | chats = g_list_remove(chats, conv); |
|
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
572 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
573 | hc.name = (gchar *)purple_normalize(conv->account, conv->name); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
574 | hc.account = conv->account; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
575 | hc.type = conv->type; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
576 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
577 | g_hash_table_remove(conversation_cache, &hc); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
578 | |
| 15884 | 579 | purple_signal_emit(purple_conversations_get_handle(), |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
580 | "deleting-conversation", conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
581 | |
| 11606 | 582 | g_free(conv->name); |
| 583 | g_free(conv->title); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
584 | |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
585 | conv->name = NULL; |
|
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
586 | conv->title = NULL; |
|
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
587 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
588 | if (conv->type == PURPLE_CONVERSATION_TYPE_IM) { |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
589 | purple_im_conversation_stop_typing_timeout(conv->u.im); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
590 | purple_im_conversation_stop_send_typed_timeout(conv->u.im); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
591 | |
|
16421
f9218e1c4703
The buddy icon code as it stands, with lots of bugs and design flaws.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
592 | purple_buddy_icon_unref(conv->u.im->icon); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
593 | conv->u.im->icon = NULL; |
|
6846
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
594 | |
| 15884 | 595 | PURPLE_DBUS_UNREGISTER_POINTER(conv->u.im); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
596 | g_free(conv->u.im); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
597 | conv->u.im = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
598 | } |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
599 | else if (conv->type == PURPLE_CONVERSATION_TYPE_CHAT) { |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
600 | g_hash_table_destroy(conv->u.chat->users); |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
601 | conv->u.chat->users = NULL; |
| 15884 | 602 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
603 | g_list_foreach(conv->u.chat->in_room, (GFunc)purple_chat_conversation_buddy_destroy, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
604 | g_list_free(conv->u.chat->in_room); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
605 | |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
606 | g_list_foreach(conv->u.chat->ignored, (GFunc)g_free, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
607 | g_list_free(conv->u.chat->ignored); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
608 | |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
609 | conv->u.chat->in_room = NULL; |
|
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
610 | conv->u.chat->ignored = NULL; |
|
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
611 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
612 | g_free(conv->u.chat->who); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
613 | conv->u.chat->who = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
614 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
615 | g_free(conv->u.chat->topic); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
616 | conv->u.chat->topic = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
617 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
618 | g_free(conv->u.chat->nick); |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10385
diff
changeset
|
619 | |
| 15884 | 620 | PURPLE_DBUS_UNREGISTER_POINTER(conv->u.chat); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
621 | g_free(conv->u.chat); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
622 | conv->u.chat = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
623 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
624 | |
|
4877
7d1f4381fed0
[gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents:
4876
diff
changeset
|
625 | g_hash_table_destroy(conv->data); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
626 | conv->data = NULL; |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
627 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
628 | if (ops != NULL && ops->destroy_conversation != NULL) |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
629 | ops->destroy_conversation(conv); |
|
31643
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31602
diff
changeset
|
630 | conv->ui_data = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
631 | |
| 15884 | 632 | purple_conversation_close_logs(conv); |
| 633 | ||
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
634 | purple_conversation_clear_message_history(conv); |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
635 | |
| 15884 | 636 | PURPLE_DBUS_UNREGISTER_POINTER(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
637 | g_free(conv); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
638 | conv = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
639 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
640 | |
| 10665 | 641 | |
| 642 | void | |
| 15884 | 643 | purple_conversation_present(PurpleConversation *conv) { |
| 644 | PurpleConversationUiOps *ops; | |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
645 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
646 | g_return_if_fail(conv != NULL); |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
647 | |
| 15884 | 648 | ops = purple_conversation_get_ui_ops(conv); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
649 | if(ops && ops->present) |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
650 | ops->present(conv); |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
651 | } |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
652 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
653 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
654 | void |
| 15884 | 655 | purple_conversation_set_features(PurpleConversation *conv, PurpleConnectionFlags features) |
| 10665 | 656 | { |
| 657 | g_return_if_fail(conv != NULL); | |
| 658 | ||
| 659 | conv->features = features; | |
| 660 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
661 | purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_FEATURES); |
| 10665 | 662 | } |
| 663 | ||
| 664 | ||
| 15884 | 665 | PurpleConnectionFlags |
| 666 | purple_conversation_get_features(PurpleConversation *conv) | |
| 10665 | 667 | { |
| 668 | g_return_val_if_fail(conv != NULL, 0); | |
| 669 | return conv->features; | |
| 670 | } | |
| 671 | ||
| 672 | ||
| 15884 | 673 | PurpleConversationType |
| 674 | purple_conversation_get_type(const PurpleConversation *conv) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
675 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
676 | g_return_val_if_fail(conv != NULL, PURPLE_CONVERSATION_TYPE_UNKNOWN); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
677 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
678 | return conv->type; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
679 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
680 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
681 | void |
| 15884 | 682 | purple_conversation_set_ui_ops(PurpleConversation *conv, |
| 683 | PurpleConversationUiOps *ops) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
684 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
685 | g_return_if_fail(conv != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
686 | |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
687 | if (conv->ui_ops == ops) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
688 | return; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
689 | |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4425
diff
changeset
|
690 | if (conv->ui_ops != NULL && conv->ui_ops->destroy_conversation != NULL) |
|
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4425
diff
changeset
|
691 | conv->ui_ops->destroy_conversation(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
692 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
693 | conv->ui_data = NULL; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
694 | |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4425
diff
changeset
|
695 | conv->ui_ops = ops; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
696 | } |
| 66 | 697 | |
| 15884 | 698 | PurpleConversationUiOps * |
| 699 | purple_conversation_get_ui_ops(const PurpleConversation *conv) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
700 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
701 | g_return_val_if_fail(conv != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
702 | |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4425
diff
changeset
|
703 | return conv->ui_ops; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
704 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
705 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
706 | void |
| 15884 | 707 | purple_conversation_set_account(PurpleConversation *conv, PurpleAccount *account) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
708 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
709 | g_return_if_fail(conv != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
710 | |
| 15884 | 711 | if (account == purple_conversation_get_account(conv)) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
712 | return; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
713 | |
| 4491 | 714 | conv->account = account; |
| 715 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
716 | purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_ACCOUNT); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
717 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
718 | |
| 15884 | 719 | PurpleAccount * |
| 720 | purple_conversation_get_account(const PurpleConversation *conv) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
721 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
722 | g_return_val_if_fail(conv != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
723 | |
| 4491 | 724 | return conv->account; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
725 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
726 | |
| 15884 | 727 | PurpleConnection * |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
728 | purple_conversation_get_connection(const PurpleConversation *conv) |
| 66 | 729 | { |
| 15884 | 730 | PurpleAccount *account; |
|
4425
b2ccc08ed727
[gaim-migrate @ 4700]
Christian Hammond <chipx86@chipx86.com>
parents:
4415
diff
changeset
|
731 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
732 | g_return_val_if_fail(conv != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
733 | |
| 15884 | 734 | account = purple_conversation_get_account(conv); |
| 4491 | 735 | |
| 736 | if (account == NULL) | |
|
4425
b2ccc08ed727
[gaim-migrate @ 4700]
Christian Hammond <chipx86@chipx86.com>
parents:
4415
diff
changeset
|
737 | return NULL; |
|
b2ccc08ed727
[gaim-migrate @ 4700]
Christian Hammond <chipx86@chipx86.com>
parents:
4415
diff
changeset
|
738 | |
|
32624
f957ad287bcc
Convert code to use the purple_account accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
739 | return purple_account_get_connection(account); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
740 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
741 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
742 | void |
| 15884 | 743 | purple_conversation_set_title(PurpleConversation *conv, const char *title) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
744 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
745 | g_return_if_fail(conv != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
746 | g_return_if_fail(title != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
747 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
748 | g_free(conv->title); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
749 | conv->title = g_strdup(title); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
750 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
751 | purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_TITLE); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
752 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
753 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
754 | const char * |
| 15884 | 755 | purple_conversation_get_title(const PurpleConversation *conv) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
756 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
757 | g_return_val_if_fail(conv != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
758 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
759 | return conv->title; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
760 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
761 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
762 | void |
| 15884 | 763 | purple_conversation_autoset_title(PurpleConversation *conv) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
764 | { |
| 15884 | 765 | PurpleAccount *account; |
| 766 | PurpleBuddy *b; | |
| 767 | PurpleChat *chat; | |
| 8015 | 768 | const char *text = NULL, *name; |
| 3799 | 769 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
770 | g_return_if_fail(conv != NULL); |
|
2267
9704c0f60689
[gaim-migrate @ 2277]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2264
diff
changeset
|
771 | |
| 15884 | 772 | account = purple_conversation_get_account(conv); |
| 773 | name = purple_conversation_get_name(conv); | |
| 774 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
775 | if(purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_IM) { |
| 15884 | 776 | if(account && ((b = purple_find_buddy(account, name)) != NULL)) |
| 777 | text = purple_buddy_get_contact_alias(b); | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
778 | } else if(purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_CHAT) { |
| 15884 | 779 | if(account && ((chat = purple_blist_find_chat(account, name)) != NULL)) |
|
24955
77727fac30c6
Finish off the libpurple updates for the hidden blist structs
Gary Kramlich <grim@reaperworld.com>
parents:
24051
diff
changeset
|
780 | text = purple_chat_get_name(chat); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
781 | } |
| 11581 | 782 | |
| 8015 | 783 | |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
784 | if(text == NULL) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
785 | text = name; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
786 | |
| 15884 | 787 | purple_conversation_set_title(conv, text); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
788 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
789 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
790 | void |
| 15884 | 791 | purple_conversation_set_name(PurpleConversation *conv, const char *name) |
|
7256
311c8febfc92
[gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents:
7125
diff
changeset
|
792 | { |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
793 | struct _purple_hconv *hc; |
|
7256
311c8febfc92
[gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents:
7125
diff
changeset
|
794 | g_return_if_fail(conv != NULL); |
|
311c8febfc92
[gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents:
7125
diff
changeset
|
795 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
796 | hc = g_new(struct _purple_hconv, 1); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
797 | hc->type = conv->type; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
798 | hc->account = conv->account; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
799 | hc->name = (gchar *)purple_normalize(conv->account, conv->name); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
800 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
801 | g_hash_table_remove(conversation_cache, hc); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
802 | g_free(conv->name); |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
803 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
804 | conv->name = g_strdup(name); |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
805 | hc->name = g_strdup(purple_normalize(conv->account, conv->name)); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
806 | g_hash_table_insert(conversation_cache, hc, conv); |
|
7257
599b8494e6ee
[gaim-migrate @ 7834]
Christian Hammond <chipx86@chipx86.com>
parents:
7256
diff
changeset
|
807 | |
| 15884 | 808 | purple_conversation_autoset_title(conv); |
|
7256
311c8febfc92
[gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents:
7125
diff
changeset
|
809 | } |
|
311c8febfc92
[gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents:
7125
diff
changeset
|
810 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
811 | const char * |
| 15884 | 812 | purple_conversation_get_name(const PurpleConversation *conv) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
813 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
814 | g_return_val_if_fail(conv != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
815 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
816 | return conv->name; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
817 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
818 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
819 | void |
| 15884 | 820 | purple_conversation_set_logging(PurpleConversation *conv, gboolean log) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
821 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
822 | g_return_if_fail(conv != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
823 | |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
824 | if (conv->logging != log) |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
825 | { |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
826 | conv->logging = log; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
827 | purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_LOGGING); |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
828 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
829 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
830 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
831 | gboolean |
| 15884 | 832 | purple_conversation_is_logging(const PurpleConversation *conv) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
833 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
834 | g_return_val_if_fail(conv != NULL, FALSE); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
835 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
836 | return conv->logging; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
837 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
838 | |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
839 | void |
| 15884 | 840 | purple_conversation_close_logs(PurpleConversation *conv) |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
841 | { |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
842 | g_return_if_fail(conv != NULL); |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
843 | |
| 15884 | 844 | g_list_foreach(conv->logs, (GFunc)purple_log_free, NULL); |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
845 | g_list_free(conv->logs); |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
846 | conv->logs = NULL; |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
847 | } |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
848 | |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
849 | void |
| 15884 | 850 | purple_conversation_set_data(PurpleConversation *conv, const char *key, |
|
4877
7d1f4381fed0
[gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents:
4876
diff
changeset
|
851 | gpointer data) |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
852 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
853 | g_return_if_fail(conv != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
854 | g_return_if_fail(key != NULL); |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
855 | |
|
4877
7d1f4381fed0
[gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents:
4876
diff
changeset
|
856 | g_hash_table_replace(conv->data, g_strdup(key), data); |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
857 | } |
|
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
858 | |
|
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
859 | gpointer |
| 15884 | 860 | purple_conversation_get_data(PurpleConversation *conv, const char *key) |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
861 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
862 | g_return_val_if_fail(conv != NULL, NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
863 | g_return_val_if_fail(key != NULL, NULL); |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
864 | |
|
4877
7d1f4381fed0
[gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents:
4876
diff
changeset
|
865 | return g_hash_table_lookup(conv->data, key); |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
866 | } |
|
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
867 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
868 | void |
| 15884 | 869 | purple_conversation_write(PurpleConversation *conv, const char *who, |
|
34620
e49aa67344e1
Renamed PurpleConversationMessageFlags back to PurpleMessageFlags.
Ankit Vani <a@nevitus.org>
parents:
34602
diff
changeset
|
870 | const char *message, PurpleMessageFlags flags, |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
871 | time_t mtime) |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
872 | { |
| 15884 | 873 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 874 | PurpleConnection *gc = NULL; | |
| 875 | PurpleAccount *account; | |
| 876 | PurpleConversationUiOps *ops; | |
|
11468
3411c0d7f597
[gaim-migrate @ 13708]
Richard Laager <rlaager@pidgin.im>
parents:
11454
diff
changeset
|
877 | const char *alias; |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
878 | char *displayed = NULL; |
| 15884 | 879 | PurpleBuddy *b; |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
880 | int plugin_return; |
| 15884 | 881 | PurpleConversationType type; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
882 | /* int logging_font_options = 0; */ |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
883 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
884 | g_return_if_fail(conv != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
885 | g_return_if_fail(message != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
886 | |
| 15884 | 887 | ops = purple_conversation_get_ui_ops(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
888 | |
| 15884 | 889 | account = purple_conversation_get_account(conv); |
| 890 | type = purple_conversation_get_type(conv); | |
|
6496
9833c2665143
[gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
891 | |
|
9833c2665143
[gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
892 | if (account != NULL) |
| 15884 | 893 | gc = purple_account_get_connection(account); |
| 894 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
895 | if (purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_CHAT && |
|
22805
92825aac9549
When you try to execute a command (e.g., /part etc.) in a chat on a
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22458
diff
changeset
|
896 | (gc != NULL && !g_slist_find(gc->buddy_chats, conv))) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
897 | return; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
898 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
899 | if (purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_IM && |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
900 | !g_list_find(purple_conversations_get(), conv)) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
901 | return; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
902 | |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
903 | displayed = g_strdup(message); |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
904 | |
|
19769
9420f2078435
writing-im-msg now receives the conversation name as the who argument if
Richard Laager <rlaager@pidgin.im>
parents:
19674
diff
changeset
|
905 | if (who == NULL || *who == '\0') |
|
9420f2078435
writing-im-msg now receives the conversation name as the who argument if
Richard Laager <rlaager@pidgin.im>
parents:
19674
diff
changeset
|
906 | who = purple_conversation_get_name(conv); |
|
9420f2078435
writing-im-msg now receives the conversation name as the who argument if
Richard Laager <rlaager@pidgin.im>
parents:
19674
diff
changeset
|
907 | alias = who; |
|
9420f2078435
writing-im-msg now receives the conversation name as the who argument if
Richard Laager <rlaager@pidgin.im>
parents:
19674
diff
changeset
|
908 | |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
909 | plugin_return = |
| 15884 | 910 | GPOINTER_TO_INT(purple_signal_emit_return_1( |
| 911 | purple_conversations_get_handle(), | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
912 | (type == PURPLE_CONVERSATION_TYPE_IM ? "writing-im-msg" : "writing-chat-msg"), |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
913 | account, who, &displayed, conv, flags)); |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
914 | |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
915 | if (displayed == NULL) |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
916 | return; |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
917 | |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
918 | if (plugin_return) { |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
919 | g_free(displayed); |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
920 | return; |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
921 | } |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
922 | |
| 9613 | 923 | if (account != NULL) { |
| 15884 | 924 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(account))); |
| 925 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
926 | if (purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_IM || |
|
5350
966c6d4d7bdd
[gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents:
5262
diff
changeset
|
927 | !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
|
966c6d4d7bdd
[gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents:
5262
diff
changeset
|
928 | |
|
34620
e49aa67344e1
Renamed PurpleConversationMessageFlags back to PurpleMessageFlags.
Ankit Vani <a@nevitus.org>
parents:
34602
diff
changeset
|
929 | if (flags & PURPLE_MESSAGE_SEND) { |
| 15884 | 930 | b = purple_find_buddy(account, |
| 931 | purple_account_get_username(account)); | |
| 932 | ||
|
34589
428e92c79631
Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents:
33578
diff
changeset
|
933 | if (purple_account_get_private_alias(account) != NULL) |
|
428e92c79631
Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents:
33578
diff
changeset
|
934 | alias = purple_account_get_private_alias(account); |
|
25859
b42be7bb9dac
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 <darkrain42@pidgin.im>
parents:
24955
diff
changeset
|
935 | else if (b != NULL && !purple_strequal(purple_buddy_get_name(b), purple_buddy_get_contact_alias(b))) |
| 15884 | 936 | alias = purple_buddy_get_contact_alias(b); |
| 937 | else if (purple_connection_get_display_name(gc) != NULL) | |
| 938 | alias = purple_connection_get_display_name(gc); | |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
939 | else |
| 15884 | 940 | alias = purple_account_get_username(account); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
941 | } |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
942 | else |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
943 | { |
| 15884 | 944 | b = purple_find_buddy(account, who); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
945 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
946 | if (b != NULL) |
| 15884 | 947 | alias = purple_buddy_get_contact_alias(b); |
|
1772
c759c01bd66f
[gaim-migrate @ 1782]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1764
diff
changeset
|
948 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
949 | } |
|
474
8e9acf2f6c48
[gaim-migrate @ 484]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
473
diff
changeset
|
950 | } |
| 8256 | 951 | |
|
34620
e49aa67344e1
Renamed PurpleConversationMessageFlags back to PurpleMessageFlags.
Ankit Vani <a@nevitus.org>
parents:
34602
diff
changeset
|
952 | if (!(flags & PURPLE_MESSAGE_NO_LOG) && purple_conversation_is_logging(conv)) { |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
953 | GList *log; |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
954 | |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
955 | if (conv->logs == NULL) |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
956 | open_log(conv); |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
957 | |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
958 | log = conv->logs; |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
959 | while (log != NULL) { |
| 15884 | 960 | purple_log_write((PurpleLog *)log->data, flags, alias, mtime, displayed); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
961 | log = log->next; |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
962 | } |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
963 | } |
| 66 | 964 | |
|
19593
608995889b11
A conversation shouldn't need ui-ops for logging the messages.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19590
diff
changeset
|
965 | if (ops && ops->write_conv) |
|
608995889b11
A conversation shouldn't need ui-ops for logging the messages.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19590
diff
changeset
|
966 | ops->write_conv(conv, who, alias, displayed, flags, mtime); |
|
21253
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
967 | |
|
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
968 | add_message_to_history(conv, who, alias, message, flags, mtime); |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
969 | |
| 15884 | 970 | purple_signal_emit(purple_conversations_get_handle(), |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
971 | (type == PURPLE_CONVERSATION_TYPE_IM ? "wrote-im-msg" : "wrote-chat-msg"), |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
972 | account, who, displayed, conv, flags); |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
973 | |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
974 | g_free(displayed); |
| 66 | 975 | } |
| 976 | ||
|
9260
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
977 | gboolean |
| 15884 | 978 | purple_conversation_has_focus(PurpleConversation *conv) |
|
9260
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
979 | { |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
980 | gboolean ret = FALSE; |
| 15884 | 981 | PurpleConversationUiOps *ops; |
|
9260
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
982 | |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
983 | g_return_val_if_fail(conv != NULL, FALSE); |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
984 | |
| 15884 | 985 | ops = purple_conversation_get_ui_ops(conv); |
|
9260
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
986 | |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
987 | if (ops != NULL && ops->has_focus != NULL) |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
988 | ret = ops->has_focus(conv); |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
989 | |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
990 | return ret; |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
991 | } |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
992 | |
|
7930
3005873ac411
[gaim-migrate @ 8601]
Mark Doliner <markdoliner@pidgin.im>
parents:
7879
diff
changeset
|
993 | /* |
| 8256 | 994 | * TODO: Need to make sure calls to this function happen in the core |
| 995 | * instead of the UI. That way UIs have less work to do, and the | |
| 996 | * core/UI split is cleaner. Also need to make sure this is called | |
|
7930
3005873ac411
[gaim-migrate @ 8601]
Mark Doliner <markdoliner@pidgin.im>
parents:
7879
diff
changeset
|
997 | * when chats are added/removed from the blist. |
|
3005873ac411
[gaim-migrate @ 8601]
Mark Doliner <markdoliner@pidgin.im>
parents:
7879
diff
changeset
|
998 | */ |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
999 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1000 | purple_conversation_update(PurpleConversation *conv, PurpleConversationUpdateType type) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1001 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1002 | g_return_if_fail(conv != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1003 | |
| 15884 | 1004 | purple_signal_emit(purple_conversations_get_handle(), |
| 9734 | 1005 | "conversation-updated", conv, type); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1006 | } |
| 2993 | 1007 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1008 | gboolean purple_conversation_helper_present_error(const char *who, PurpleAccount *account, const char *what) |
| 9627 | 1009 | { |
| 15884 | 1010 | PurpleConversation *conv; |
| 9627 | 1011 | |
| 1012 | g_return_val_if_fail(who != NULL, FALSE); | |
| 1013 | g_return_val_if_fail(account !=NULL, FALSE); | |
| 1014 | g_return_val_if_fail(what != NULL, FALSE); | |
| 1015 | ||
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1016 | conv = purple_conversations_find_with_account(PURPLE_CONVERSATION_TYPE_ANY, who, account); |
| 9627 | 1017 | if (conv != NULL) |
|
34620
e49aa67344e1
Renamed PurpleConversationMessageFlags back to PurpleMessageFlags.
Ankit Vani <a@nevitus.org>
parents:
34602
diff
changeset
|
1018 | purple_conversation_write(conv, NULL, what, PURPLE_MESSAGE_ERROR, time(NULL)); |
| 9627 | 1019 | else |
| 1020 | return FALSE; | |
| 1021 | ||
| 1022 | return TRUE; | |
| 1023 | } | |
| 1024 | ||
| 14582 | 1025 | static void |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1026 | purple_conversation_send_confirm_cb(gpointer *data) |
| 14582 | 1027 | { |
| 15884 | 1028 | PurpleConversation *conv = data[0]; |
| 14582 | 1029 | char *message = data[1]; |
| 1030 | ||
| 1031 | g_free(data); | |
| 1032 | common_send(conv, message, 0); | |
| 1033 | } | |
| 1034 | ||
| 1035 | void | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1036 | purple_conversation_send_confirm(PurpleConversation *conv, const char *message) |
| 14582 | 1037 | { |
| 1038 | char *text; | |
| 1039 | gpointer *data; | |
| 1040 | ||
| 1041 | g_return_if_fail(conv != NULL); | |
| 1042 | g_return_if_fail(message != NULL); | |
| 1043 | ||
| 1044 | if (conv->ui_ops != NULL && conv->ui_ops->send_confirm != NULL) | |
| 1045 | { | |
| 1046 | conv->ui_ops->send_confirm(conv, message); | |
| 1047 | return; | |
| 1048 | } | |
| 1049 | ||
| 1050 | text = g_strdup_printf("You are about to send the following message:\n%s", message); | |
| 1051 | data = g_new0(gpointer, 2); | |
| 1052 | data[0] = conv; | |
| 1053 | data[1] = (gpointer)message; | |
| 1054 | ||
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1055 | purple_request_action(conv, NULL, _("Send Message"), text, 0, |
|
16490
68c22924d66b
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 <evands@pidgin.im>
parents:
16478
diff
changeset
|
1056 | purple_conversation_get_account(conv), NULL, conv, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1057 | data, 2, |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1058 | _("_Send Message"), G_CALLBACK(purple_conversation_send_confirm_cb), |
|
16490
68c22924d66b
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 <evands@pidgin.im>
parents:
16478
diff
changeset
|
1059 | _("Cancel"), NULL); |
| 14582 | 1060 | } |
| 1061 | ||
| 10526 | 1062 | gboolean |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1063 | purple_conversation_custom_smiley_add(PurpleConversation *conv, const char *smile, |
|
12618
b83b6bab0703
[gaim-migrate @ 14954]
Richard Laager <rlaager@pidgin.im>
parents:
12604
diff
changeset
|
1064 | const char *cksum_type, const char *chksum, |
|
b83b6bab0703
[gaim-migrate @ 14954]
Richard Laager <rlaager@pidgin.im>
parents:
12604
diff
changeset
|
1065 | gboolean remote) |
| 10526 | 1066 | { |
| 1067 | if (conv == NULL || smile == NULL || !*smile) { | |
| 1068 | return FALSE; | |
| 1069 | } | |
| 1070 | ||
| 1071 | /* TODO: check if the icon is in the cache and return false if so */ | |
| 1072 | /* TODO: add an icon cache (that doesn't suck) */ | |
| 1073 | if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_add !=NULL) { | |
|
12618
b83b6bab0703
[gaim-migrate @ 14954]
Richard Laager <rlaager@pidgin.im>
parents:
12604
diff
changeset
|
1074 | return conv->ui_ops->custom_smiley_add(conv, smile, remote); |
| 10526 | 1075 | } else { |
| 15884 | 1076 | purple_debug_info("conversation", "Could not find add custom smiley function"); |
| 10526 | 1077 | return FALSE; |
| 1078 | } | |
| 1079 | ||
| 1080 | } | |
| 1081 | ||
| 1082 | void | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1083 | purple_conversation_custom_smiley_write(PurpleConversation *conv, const char *smile, |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11064
diff
changeset
|
1084 | const guchar *data, gsize size) |
| 10526 | 1085 | { |
| 1086 | g_return_if_fail(conv != NULL); | |
| 1087 | g_return_if_fail(smile != NULL && *smile); | |
| 1088 | ||
| 1089 | if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_write != NULL) | |
| 1090 | conv->ui_ops->custom_smiley_write(conv, smile, data, size); | |
| 1091 | else | |
| 15884 | 1092 | purple_debug_info("conversation", "Could not find the smiley write function"); |
| 10526 | 1093 | } |
| 1094 | ||
| 1095 | void | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1096 | purple_conversation_custom_smiley_close(PurpleConversation *conv, const char *smile) |
| 10526 | 1097 | { |
| 1098 | g_return_if_fail(conv != NULL); | |
| 1099 | g_return_if_fail(smile != NULL && *smile); | |
| 1100 | ||
| 1101 | if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_close != NULL) | |
| 1102 | conv->ui_ops->custom_smiley_close(conv, smile); | |
| 1103 | else | |
| 15884 | 1104 | purple_debug_info("conversation", "Could not find custom smiley close function"); |
| 10526 | 1105 | } |
| 1106 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1107 | void purple_chat_conversation_set_nick(PurpleChatConversation *chat, const char *nick) { |
| 8158 | 1108 | g_return_if_fail(chat != NULL); |
| 1109 | ||
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1110 | g_free(chat->nick); |
| 15884 | 1111 | chat->nick = g_strdup(purple_normalize(chat->conv->account, nick)); |
| 8158 | 1112 | } |
| 1113 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1114 | const char *purple_chat_conversation_get_nick(PurpleChatConversation *chat) { |
| 8158 | 1115 | g_return_val_if_fail(chat != NULL, NULL); |
| 1116 | ||
| 1117 | return chat->nick; | |
| 1118 | } | |
| 1119 | ||
|
26762
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1120 | static void |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1121 | invite_user_to_chat(gpointer data, PurpleRequestFields *fields) |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1122 | { |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1123 | PurpleConversation *conv; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1124 | PurpleChatConversationPrivate *priv; |
|
26762
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1125 | const char *user, *message; |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1126 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1127 | conv = data; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1128 | chat = PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv); |
|
26762
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1129 | user = purple_request_fields_get_string(fields, "screenname"); |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1130 | message = purple_request_fields_get_string(fields, "message"); |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1131 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
1132 | serv_chat_invite(purple_conversation_get_connection(conv), chat->id, message, user); |
|
26762
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1133 | } |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1134 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1135 | void purple_chat_conversation_invite_user(PurpleChatConversation *chat, const char *user, |
|
26762
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1136 | const char *message, gboolean confirm) |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1137 | { |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1138 | PurpleAccount *account; |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1139 | PurpleConversation *conv; |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1140 | PurpleRequestFields *fields; |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1141 | PurpleRequestFieldGroup *group; |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1142 | PurpleRequestField *field; |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1143 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1144 | g_return_if_fail(chat); |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1145 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1146 | if (!user || !*user || !message || !*message) |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1147 | confirm = TRUE; |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1148 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1149 | conv = chat->conv; |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1150 | account = conv->account; |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1151 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1152 | if (!confirm) { |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1153 | serv_chat_invite(purple_account_get_connection(account), |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1154 | purple_chat_conversation_get_id(chat), message, user); |
|
26762
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1155 | return; |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1156 | } |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1157 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1158 | fields = purple_request_fields_new(); |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1159 | group = purple_request_field_group_new(_("Invite to chat")); |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1160 | purple_request_fields_add_group(fields, group); |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1161 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1162 | field = purple_request_field_string_new("screenname", _("Buddy"), user, FALSE); |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1163 | purple_request_field_group_add_field(group, field); |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1164 | purple_request_field_set_required(field, TRUE); |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1165 | purple_request_field_set_type_hint(field, "screenname"); |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1166 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1167 | field = purple_request_field_string_new("message", _("Message"), message, FALSE); |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1168 | purple_request_field_group_add_field(group, field); |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1169 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1170 | purple_request_fields(conv, _("Invite to chat"), NULL, |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1171 | _("Please enter the name of the user you wish to invite, " |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1172 | "along with an optional invite message."), |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1173 | fields, |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1174 | _("Invite"), G_CALLBACK(invite_user_to_chat), |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1175 | _("Cancel"), NULL, |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1176 | account, user, conv, |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1177 | conv); |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1178 | } |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
1179 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1180 | void purple_chat_conversation_buddy_set_ui_data(PurpleChatConversationBuddy *cb, gpointer ui_data) |
|
32615
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1181 | { |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1182 | g_return_if_fail(cb != NULL); |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1183 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1184 | cb->ui_data = ui_data; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1185 | } |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1186 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1187 | gpointer purple_chat_conversation_buddy_get_ui_data(const PurpleChatConversationBuddy *cb) |
|
32615
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1188 | { |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1189 | g_return_val_if_fail(cb != NULL, NULL); |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1190 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1191 | return cb->ui_data; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1192 | } |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1193 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1194 | gboolean purple_chat_conversation_buddy_is_buddy(const PurpleChatConversationBuddy *cb) |
|
32615
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1195 | { |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1196 | g_return_val_if_fail(cb != NULL, FALSE); |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1197 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1198 | return cb->buddy; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1199 | } |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
1200 | |
|
31397
b50f1cf05a5e
Moved the conversation attributes API and the IRC periodic WHO updates to i.p.p.next.minor, where they belong.
Evan Schoenberg <evands@pidgin.im>
parents:
31294
diff
changeset
|
1201 | static void |
|
b50f1cf05a5e
Moved the conversation attributes API and the IRC periodic WHO updates to i.p.p.next.minor, where they belong.
Evan Schoenberg <evands@pidgin.im>
parents:
31294
diff
changeset
|
1202 | append_attribute_key(gpointer key, gpointer value, gpointer user_data) |
|
b50f1cf05a5e
Moved the conversation attributes API and the IRC periodic WHO updates to i.p.p.next.minor, where they belong.
Evan Schoenberg <evands@pidgin.im>
parents:
31294
diff
changeset
|
1203 | { |
|
b50f1cf05a5e
Moved the conversation attributes API and the IRC periodic WHO updates to i.p.p.next.minor, where they belong.
Evan Schoenberg <evands@pidgin.im>
parents:
31294
diff
changeset
|
1204 | GList **list = user_data; |
|
b50f1cf05a5e
Moved the conversation attributes API and the IRC periodic WHO updates to i.p.p.next.minor, where they belong.
Evan Schoenberg <evands@pidgin.im>
parents:
31294
diff
changeset
|
1205 | *list = g_list_prepend(*list, key); |
|
b50f1cf05a5e
Moved the conversation attributes API and the IRC periodic WHO updates to i.p.p.next.minor, where they belong.
Evan Schoenberg <evands@pidgin.im>
parents:
31294
diff
changeset
|
1206 | } |
|
b50f1cf05a5e
Moved the conversation attributes API and the IRC periodic WHO updates to i.p.p.next.minor, where they belong.
Evan Schoenberg <evands@pidgin.im>
parents:
31294
diff
changeset
|
1207 | |
|
b50f1cf05a5e
Moved the conversation attributes API and the IRC periodic WHO updates to i.p.p.next.minor, where they belong.
Evan Schoenberg <evands@pidgin.im>
parents:
31294
diff
changeset
|
1208 | GList * |
|
17265
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
1209 | purple_conversation_get_extended_menu(PurpleConversation *conv) |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
1210 | { |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
1211 | GList *menu = NULL; |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
1212 | |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
1213 | g_return_val_if_fail(conv != NULL, NULL); |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
1214 | |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
1215 | purple_signal_emit(purple_conversations_get_handle(), |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
1216 | "conversation-extended-menu", conv, &menu); |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
1217 | return menu; |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
1218 | } |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
1219 | |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1220 | void purple_conversation_clear_message_history(PurpleConversation *conv) |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1221 | { |
|
19904
8abf4c2056eb
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
1222 | GList *list = conv->message_history; |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1223 | message_history_free(list); |
|
19904
8abf4c2056eb
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
1224 | conv->message_history = NULL; |
|
31643
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31602
diff
changeset
|
1225 | |
|
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31602
diff
changeset
|
1226 | purple_signal_emit(purple_conversations_get_handle(), |
|
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31602
diff
changeset
|
1227 | "cleared-message-history", conv); |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1228 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1229 | |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1230 | GList *purple_conversation_get_message_history(PurpleConversation *conv) |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1231 | { |
|
19904
8abf4c2056eb
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
1232 | return conv->message_history; |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1233 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1234 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1235 | const char *purple_conversation_message_get_sender(const PurpleConversationMessage *msg) |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1236 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1237 | g_return_val_if_fail(msg, NULL); |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1238 | return msg->who; |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1239 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1240 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1241 | const char *purple_conversation_message_get_message(const PurpleConversationMessage *msg) |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1242 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1243 | g_return_val_if_fail(msg, NULL); |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1244 | return msg->what; |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1245 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1246 | |
|
34620
e49aa67344e1
Renamed PurpleConversationMessageFlags back to PurpleMessageFlags.
Ankit Vani <a@nevitus.org>
parents:
34602
diff
changeset
|
1247 | PurpleMessageFlags purple_conversation_message_get_flags(const PurpleConversationMessage *msg) |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1248 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1249 | g_return_val_if_fail(msg, 0); |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1250 | return msg->flags; |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1251 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1252 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1253 | time_t purple_conversation_message_get_timestamp(const PurpleConversationMessage *msg) |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1254 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1255 | g_return_val_if_fail(msg, 0); |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1256 | return msg->when; |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1257 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
1258 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1259 | const char *purple_conversation_message_get_alias(const PurpleConversationMessage *msg) |
|
32690
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
1260 | { |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
1261 | g_return_val_if_fail(msg, NULL); |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
1262 | return msg->alias; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
1263 | } |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
1264 | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1265 | PurpleConversation *purple_conversation_message_get_conversation(const PurpleConversationMessage *msg) |
|
32690
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
1266 | { |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
1267 | g_return_val_if_fail(msg, NULL); |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
1268 | return msg->conv; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
1269 | } |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
1270 | |
|
32253
99ecf637808b
Add accessor functions purple_conversation_get_ui_data() and purple_conversation_set_ui_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
31937
diff
changeset
|
1271 | void purple_conversation_set_ui_data(PurpleConversation *conv, gpointer ui_data) |
|
99ecf637808b
Add accessor functions purple_conversation_get_ui_data() and purple_conversation_set_ui_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
31937
diff
changeset
|
1272 | { |
|
99ecf637808b
Add accessor functions purple_conversation_get_ui_data() and purple_conversation_set_ui_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
31937
diff
changeset
|
1273 | g_return_if_fail(conv != NULL); |
|
99ecf637808b
Add accessor functions purple_conversation_get_ui_data() and purple_conversation_set_ui_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
31937
diff
changeset
|
1274 | |
|
99ecf637808b
Add accessor functions purple_conversation_get_ui_data() and purple_conversation_set_ui_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
31937
diff
changeset
|
1275 | conv->ui_data = ui_data; |
|
99ecf637808b
Add accessor functions purple_conversation_get_ui_data() and purple_conversation_set_ui_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
31937
diff
changeset
|
1276 | } |
|
99ecf637808b
Add accessor functions purple_conversation_get_ui_data() and purple_conversation_set_ui_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
31937
diff
changeset
|
1277 | |
|
32256
620e4580252a
These pointers should rather be marked const.
Andrew Victor <andrew.victor@mxit.com>
parents:
32253
diff
changeset
|
1278 | gpointer purple_conversation_get_ui_data(const PurpleConversation *conv) |
|
32253
99ecf637808b
Add accessor functions purple_conversation_get_ui_data() and purple_conversation_set_ui_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
31937
diff
changeset
|
1279 | { |
|
99ecf637808b
Add accessor functions purple_conversation_get_ui_data() and purple_conversation_set_ui_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
31937
diff
changeset
|
1280 | g_return_val_if_fail(conv != NULL, NULL); |
|
99ecf637808b
Add accessor functions purple_conversation_get_ui_data() and purple_conversation_set_ui_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
31937
diff
changeset
|
1281 | |
|
99ecf637808b
Add accessor functions purple_conversation_get_ui_data() and purple_conversation_set_ui_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
31937
diff
changeset
|
1282 | return conv->ui_data; |
|
99ecf637808b
Add accessor functions purple_conversation_get_ui_data() and purple_conversation_set_ui_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
31937
diff
changeset
|
1283 | } |
|
99ecf637808b
Add accessor functions purple_conversation_get_ui_data() and purple_conversation_set_ui_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
31937
diff
changeset
|
1284 | |
|
33578
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
1285 | |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
1286 | gboolean |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
1287 | purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline, |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
1288 | const gchar *markup, gchar **error) |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
1289 | { |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
1290 | char *mark = (markup && *markup) ? NULL : g_markup_escape_text(cmdline, -1), *err = NULL; |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
1291 | PurpleCmdStatus status = purple_cmd_do_command(conv, cmdline, mark ? mark : markup, error ? error : &err); |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
1292 | g_free(mark); |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
1293 | g_free(err); |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
1294 | return (status == PURPLE_CMD_STATUS_OK); |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
1295 | } |