Thu, 12 Sep 2013 16:47:08 +0200
Request API: help button support
| 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 | |
|
25716
1b5be208d5ba
applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents:
24051
diff
changeset
|
36 | #define SEND_TYPED_TIMEOUT_SECONDS 5 |
| 4241 | 37 | |
|
32613
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
38 | /** |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
39 | * Data specific to Chats. |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
40 | */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
41 | struct _PurpleConvChat |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
42 | { |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
43 | PurpleConversation *conv; /**< The parent conversation. */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
44 | |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
45 | GList *in_room; /**< The users in the room. |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
46 | * @deprecated Will be removed in 3.0.0 |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
47 | */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
48 | GList *ignored; /**< Ignored users. */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
49 | char *who; /**< The person who set the topic. */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
50 | char *topic; /**< The topic. */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
51 | int id; /**< The chat ID. */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
52 | char *nick; /**< Your nick in this chat. */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
53 | |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
54 | gboolean left; /**< We left the chat and kept the window open */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
55 | GHashTable *users; /**< Hash table of the users in the room. */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
56 | }; |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
57 | |
|
32614
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
58 | /** |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
59 | * Data specific to Instant Messages. |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
60 | */ |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
61 | struct _PurpleConvIm |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
62 | { |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
63 | PurpleConversation *conv; /**< The parent conversation. */ |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
64 | |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
65 | PurpleTypingState typing_state; /**< The current typing state. */ |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
66 | guint typing_timeout; /**< The typing timer handle. */ |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
67 | time_t type_again; /**< The type again time. */ |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
68 | guint send_typed_timeout; /**< The type again timer handle. */ |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
69 | |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
70 | PurpleBuddyIcon *icon; /**< The buddy icon. */ |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
71 | }; |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
72 | |
|
32615
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
73 | /** |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
74 | * Data for "Chat Buddies" |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
75 | */ |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
76 | struct _PurpleConvChatBuddy |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
77 | { |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
78 | /** The chat participant's name in the chat. */ |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
79 | char *name; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
80 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
81 | /** The chat participant's alias, if known; @a NULL otherwise. */ |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
82 | char *alias; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
83 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
84 | /** |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
85 | * A string by which this buddy will be sorted, or @c NULL if the |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
86 | * buddy should be sorted by its @c name. (This is currently always |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
87 | * @c NULL. |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
88 | */ |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
89 | char *alias_key; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
90 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
91 | /** |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
92 | * @a TRUE if this chat participant is on the buddy list; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
93 | * @a FALSE otherwise. |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
94 | */ |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
95 | gboolean buddy; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
96 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
97 | /** |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
98 | * A bitwise OR of flags for this participant, such as whether they |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
99 | * are a channel operator. |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
100 | */ |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
101 | PurpleConvChatBuddyFlags flags; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
102 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
103 | /** |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
104 | * A hash table of attributes about the user, such as real name, |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
105 | * user\@host, etc. |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
106 | */ |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
107 | GHashTable *attributes; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
108 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
109 | /** The UI can put whatever it wants here. */ |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
110 | gpointer ui_data; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
111 | }; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
112 | |
|
32621
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
113 | /** |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
114 | * A core representation of a conversation between two or more people. |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
115 | * |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
116 | * The conversation can be an IM or a chat. |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
117 | */ |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
118 | struct _PurpleConversation |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
119 | { |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
120 | PurpleConversationType type; /**< The type of conversation. */ |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
121 | |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
122 | PurpleAccount *account; /**< The user using this conversation. */ |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
123 | |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
124 | |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
125 | char *name; /**< The name of the conversation. */ |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
126 | char *title; /**< The window title. */ |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
127 | |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
128 | gboolean logging; /**< The status of logging. */ |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
129 | |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
130 | GList *logs; /**< This conversation's logs */ |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
131 | |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
132 | union |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
133 | { |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
134 | PurpleConvIm *im; /**< IM-specific data. */ |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
135 | PurpleConvChat *chat; /**< Chat-specific data. */ |
|
32633
f9073e555cbd
Restore a union member lost in the merge due to struct hiding.
Kevin Stange <kstange@pidgin.im>
parents:
32624
diff
changeset
|
136 | void *misc; /**< Misc. data. */ |
|
f9073e555cbd
Restore a union member lost in the merge due to struct hiding.
Kevin Stange <kstange@pidgin.im>
parents:
32624
diff
changeset
|
137 | |
|
32621
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
138 | } u; |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
139 | |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
140 | PurpleConversationUiOps *ui_ops; /**< UI-specific operations. */ |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
141 | void *ui_data; /**< UI-specific data. */ |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
142 | |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
143 | GHashTable *data; /**< Plugin-specific data. */ |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
144 | |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
145 | PurpleConnectionFlags features; /**< The supported features */ |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
146 | GList *message_history; /**< Message history, as a GList of PurpleConvMessage's */ |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
147 | }; |
|
aa5f7a20e0fa
Hide struct _PurpleConversation.
Andrew Victor <andrew.victor@mxit.com>
parents:
32615
diff
changeset
|
148 | |
|
32690
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
149 | /** |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
150 | * Description of a conversation message |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
151 | */ |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
152 | struct _PurpleConvMessage |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
153 | { |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
154 | char *who; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
155 | char *what; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
156 | PurpleMessageFlags flags; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
157 | time_t when; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
158 | PurpleConversation *conv; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
159 | char *alias; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
160 | }; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
161 | |
|
32615
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
162 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
163 | static GList *conversations = NULL; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
164 | static GList *ims = NULL; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
165 | static GList *chats = NULL; |
| 15884 | 166 | static PurpleConversationUiOps *default_ops = NULL; |
| 11581 | 167 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
168 | /** |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
169 | * 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
|
170 | * struct _purple_hconv => PurpleConversation* |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
171 | */ |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
172 | static GHashTable *conversation_cache = NULL; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
173 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
174 | struct _purple_hconv { |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
175 | PurpleConversationType type; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
176 | char *name; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
177 | const PurpleAccount *account; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
178 | }; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
179 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
180 | 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
|
181 | { |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
182 | 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
|
183 | } |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
184 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
185 | 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
|
186 | { |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
187 | return (hc1->type == hc2->type && |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
188 | hc1->account == hc2->account && |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
189 | 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
|
190 | } |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
191 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
192 | 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
|
193 | { |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
194 | g_free(hc->name); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
195 | g_free(hc); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
196 | } |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
197 | |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
198 | 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
|
199 | { |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
200 | 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
|
201 | gchar *collated; |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
202 | guint hash; |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
203 | |
|
31909
6367f2188824
conversation: Use the right comparison type (case-sensitive) for the hash table
Paul Aurich <darkrain42@pidgin.im>
parents:
31908
diff
changeset
|
204 | 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
|
205 | hash = g_str_hash(collated); |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
206 | g_free(collated); |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
207 | return hash; |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
208 | } |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
209 | |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
210 | 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
|
211 | { |
|
31909
6367f2188824
conversation: Use the right comparison type (case-sensitive) for the hash table
Paul Aurich <darkrain42@pidgin.im>
parents:
31908
diff
changeset
|
212 | 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
|
213 | } |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
214 | |
| 11581 | 215 | void |
| 15884 | 216 | purple_conversations_set_ui_ops(PurpleConversationUiOps *ops) |
| 11581 | 217 | { |
| 218 | default_ops = ops; | |
| 219 | } | |
|
7602
1b9f55e57af3
[gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents:
7562
diff
changeset
|
220 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
221 | static gboolean |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
222 | reset_typing_cb(gpointer data) |
| 66 | 223 | { |
| 15884 | 224 | PurpleConversation *c = (PurpleConversation *)data; |
| 225 | PurpleConvIm *im; | |
| 226 | ||
| 227 | im = PURPLE_CONV_IM(c); | |
| 228 | ||
| 229 | purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING); | |
| 230 | purple_conv_im_stop_typing_timeout(im); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
231 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
232 | return FALSE; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
233 | } |
| 3159 | 234 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
235 | static gboolean |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
236 | send_typed_cb(gpointer data) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
237 | { |
| 15884 | 238 | PurpleConversation *conv = (PurpleConversation *)data; |
| 239 | PurpleConnection *gc; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
240 | const char *name; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
241 | |
|
13714
babc08c1c499
[gaim-migrate @ 16116]
Richard Laager <rlaager@pidgin.im>
parents:
13664
diff
changeset
|
242 | g_return_val_if_fail(conv != NULL, FALSE); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
243 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
244 | gc = purple_conversation_get_connection(conv); |
| 15884 | 245 | name = purple_conversation_get_name(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
246 | |
|
13714
babc08c1c499
[gaim-migrate @ 16116]
Richard Laager <rlaager@pidgin.im>
parents:
13664
diff
changeset
|
247 | if (gc != NULL && name != NULL) { |
| 15884 | 248 | /* We set this to 1 so that PURPLE_TYPING will be sent |
| 249 | * if the Purple user types anything else. | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
250 | */ |
| 15884 | 251 | purple_conv_im_set_type_again(PURPLE_CONV_IM(conv), 1); |
| 252 | ||
| 253 | serv_send_typing(gc, name, PURPLE_TYPED); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
254 | |
| 15884 | 255 | purple_debug(PURPLE_DEBUG_MISC, "conversation", "typed...\n"); |
|
573
a267d68a8240
[gaim-migrate @ 583]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
570
diff
changeset
|
256 | } |
| 66 | 257 | |
|
2725
a844d0964552
[gaim-migrate @ 2738]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2722
diff
changeset
|
258 | return FALSE; |
| 66 | 259 | } |
| 260 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
261 | static void |
| 15884 | 262 | common_send(PurpleConversation *conv, const char *message, PurpleMessageFlags msgflags) |
| 3790 | 263 | { |
| 15884 | 264 | PurpleConversationType type; |
| 265 | PurpleAccount *account; | |
| 266 | PurpleConnection *gc; | |
|
8076
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
267 | char *displayed = NULL, *sent = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
268 | int err = 0; |
| 3790 | 269 | |
|
23440
d20160530c78
Don't use strlen() when we can just check the first character
Mark Doliner <markdoliner@pidgin.im>
parents:
23312
diff
changeset
|
270 | if (*message == '\0') |
|
7947
76de4859a53a
[gaim-migrate @ 8621]
Mark Doliner <markdoliner@pidgin.im>
parents:
7930
diff
changeset
|
271 | return; |
|
76de4859a53a
[gaim-migrate @ 8621]
Mark Doliner <markdoliner@pidgin.im>
parents:
7930
diff
changeset
|
272 | |
| 15884 | 273 | 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
|
274 | gc = purple_conversation_get_connection(conv); |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
275 | |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
276 | g_return_if_fail(account != NULL); |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
277 | g_return_if_fail(gc != NULL); |
| 3731 | 278 | |
| 15884 | 279 | type = purple_conversation_get_type(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
280 | |
|
18087
b56ec2e9dae6
add a PURPLE_MESSAGE_NO_LINKIFY to prevent things from getting linkified
Nathan Walp <nwalp@pidgin.im>
parents:
18068
diff
changeset
|
281 | /* 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
|
282 | * explicitly asked to do otheriwse*/ |
|
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
|
283 | if (!(msgflags & PURPLE_MESSAGE_INVISIBLE)) { |
|
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
|
284 | if(msgflags & PURPLE_MESSAGE_NO_LINKIFY) |
|
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
|
285 | 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
|
286 | 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
|
287 | 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
|
288 | } |
|
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
|
289 | |
|
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
|
290 | if (displayed && (conv->features & PURPLE_CONNECTION_HTML) && |
|
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
|
291 | !(msgflags & PURPLE_MESSAGE_RAW)) { |
|
12901
85ddd02a44d1
[gaim-migrate @ 15254]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12867
diff
changeset
|
292 | 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
|
293 | } else |
|
12901
85ddd02a44d1
[gaim-migrate @ 15254]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12867
diff
changeset
|
294 | sent = g_strdup(message); |
| 5136 | 295 | |
| 15884 | 296 | msgflags |= PURPLE_MESSAGE_SEND; |
| 297 | ||
| 298 | if (type == PURPLE_CONV_TYPE_IM) { | |
| 299 | PurpleConvIm *im = PURPLE_CONV_IM(conv); | |
| 300 | ||
| 301 | purple_signal_emit(purple_conversations_get_handle(), "sending-im-msg", | |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
302 | account, |
| 15884 | 303 | purple_conversation_get_name(conv), &sent); |
|
8076
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
304 | |
|
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
305 | if (sent != NULL && sent[0] != '\0') { |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12018
diff
changeset
|
306 | |
| 15884 | 307 | err = serv_send_im(gc, purple_conversation_get_name(conv), |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12018
diff
changeset
|
308 | sent, msgflags); |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6846
diff
changeset
|
309 | |
|
8078
e8e087085339
[gaim-migrate @ 8777]
Mark Doliner <markdoliner@pidgin.im>
parents:
8076
diff
changeset
|
310 | if ((err > 0) && (displayed != NULL)) |
| 15884 | 311 | purple_conv_im_write(im, NULL, displayed, msgflags, time(NULL)); |
| 312 | ||
| 313 | purple_signal_emit(purple_conversations_get_handle(), "sent-im-msg", | |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
314 | account, |
| 15884 | 315 | purple_conversation_get_name(conv), sent); |
|
2102
2d024ad2e07b
[gaim-migrate @ 2112]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2094
diff
changeset
|
316 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
317 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
318 | else { |
| 15884 | 319 | purple_signal_emit(purple_conversations_get_handle(), "sending-chat-msg", |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
320 | account, &sent, |
| 15884 | 321 | purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv))); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
322 | |
|
8076
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
323 | if (sent != NULL && sent[0] != '\0') { |
| 15884 | 324 | err = serv_chat_send(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), sent, msgflags); |
| 325 | ||
| 326 | purple_signal_emit(purple_conversations_get_handle(), "sent-chat-msg", | |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
327 | account, sent, |
| 15884 | 328 | purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv))); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
329 | } |
|
472
9a5b8da2d760
[gaim-migrate @ 482]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
411
diff
changeset
|
330 | } |
|
1253
f02697a6aada
[gaim-migrate @ 1263]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
331 | |
|
2123
4cfdde0aa3f1
[gaim-migrate @ 2133]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2111
diff
changeset
|
332 | if (err < 0) { |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
333 | const char *who; |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12902
diff
changeset
|
334 | const char *msg; |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
335 | |
| 15884 | 336 | who = purple_conversation_get_name(conv); |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
337 | |
|
5213
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
338 | if (err == -E2BIG) { |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
339 | msg = _("Unable to send message: The message is too large."); |
|
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
340 | |
| 15884 | 341 | if (!purple_conv_present_error(who, account, msg)) { |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12902
diff
changeset
|
342 | char *msg2 = g_strdup_printf(_("Unable to send message to %s."), who); |
| 15884 | 343 | 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
|
344 | g_free(msg2); |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
345 | } |
|
5213
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
346 | } |
|
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
347 | else if (err == -ENOTCONN) { |
| 15884 | 348 | purple_debug(PURPLE_DEBUG_ERROR, "conversation", |
|
5213
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
349 | "Not yet connected.\n"); |
|
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
350 | } |
|
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
351 | else { |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
352 | msg = _("Unable to send message."); |
|
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
353 | |
| 15884 | 354 | if (!purple_conv_present_error(who, account, msg)) { |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12902
diff
changeset
|
355 | char *msg2 = g_strdup_printf(_("Unable to send message to %s."), who); |
| 15884 | 356 | purple_notify_error(gc, NULL, msg2, NULL); |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12902
diff
changeset
|
357 | g_free(msg2); |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
358 | } |
|
5213
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
359 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
360 | } |
|
8076
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
361 | |
|
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
362 | g_free(displayed); |
|
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
363 | g_free(sent); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
364 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
365 | |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
366 | static void |
| 15884 | 367 | open_log(PurpleConversation *conv) |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
368 | { |
| 15884 | 369 | conv->logs = g_list_append(NULL, purple_log_new(conv->type == PURPLE_CONV_TYPE_CHAT ? PURPLE_LOG_CHAT : |
| 370 | PURPLE_LOG_IM, conv->name, conv->account, | |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13107
diff
changeset
|
371 | conv, time(NULL), NULL)); |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
372 | } |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
373 | |
|
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
|
374 | /* Functions that deal with PurpleConvMessage */ |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
375 | |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
376 | static void |
|
21253
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
377 | add_message_to_history(PurpleConversation *conv, const char *who, const char *alias, |
|
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
378 | 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
|
379 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
380 | PurpleConvMessage *msg; |
|
22458
42e804b6db56
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
381 | PurpleConnection *gc; |
|
42e804b6db56
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
382 | |
|
42e804b6db56
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
383 | 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
|
384 | |
|
8f000de5f9de
Do not duplicate the same message in the history, and store the correct
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19595
diff
changeset
|
385 | if (flags & PURPLE_MESSAGE_SEND) { |
|
8f000de5f9de
Do not duplicate the same message in the history, and store the correct
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19595
diff
changeset
|
386 | const char *me = NULL; |
|
22458
42e804b6db56
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
387 | if (gc) |
|
42e804b6db56
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
388 | 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
|
389 | 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
|
390 | 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
|
391 | 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
|
392 | } |
|
21253
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
393 | |
|
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
|
394 | msg = g_new0(PurpleConvMessage, 1); |
|
19595
acd61f0d6a81
DBus-ify the message history in a conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19593
diff
changeset
|
395 | PURPLE_DBUS_REGISTER_POINTER(msg, PurpleConvMessage); |
|
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
|
396 | msg->who = g_strdup(who); |
|
21253
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
397 | 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
|
398 | 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
|
399 | 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
|
400 | 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
|
401 | 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
|
402 | |
|
19904
8abf4c2056eb
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
403 | 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
|
404 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
405 | |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
406 | 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
|
407 | free_conv_message(PurpleConvMessage *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
|
408 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
409 | g_free(msg->who); |
|
21253
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
410 | 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
|
411 | g_free(msg->what); |
|
19595
acd61f0d6a81
DBus-ify the message history in a conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19593
diff
changeset
|
412 | 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
|
413 | 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
|
414 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
415 | |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
416 | 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
|
417 | 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
|
418 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
419 | 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
|
420 | 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
|
421 | } |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
422 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
423 | /************************************************************************** |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
424 | * Conversation API |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
425 | **************************************************************************/ |
| 8256 | 426 | static void |
| 15884 | 427 | purple_conversation_chat_cleanup_for_rejoin(PurpleConversation *conv) |
| 8256 | 428 | { |
| 429 | const char *disp; | |
| 15884 | 430 | PurpleAccount *account; |
| 431 | PurpleConnection *gc; | |
| 432 | ||
| 433 | account = purple_conversation_get_account(conv); | |
| 434 | ||
| 435 | purple_conversation_close_logs(conv); | |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
436 | open_log(conv); |
| 8373 | 437 | |
| 15884 | 438 | gc = purple_account_get_connection(account); |
| 439 | ||
| 440 | if ((disp = purple_connection_get_display_name(gc)) != NULL) | |
| 441 | purple_conv_chat_set_nick(PURPLE_CONV_CHAT(conv), disp); | |
| 8373 | 442 | else |
| 443 | { | |
| 15884 | 444 | purple_conv_chat_set_nick(PURPLE_CONV_CHAT(conv), |
| 445 | purple_account_get_username(account)); | |
| 8256 | 446 | } |
| 447 | ||
| 15884 | 448 | purple_conv_chat_clear_users(PURPLE_CONV_CHAT(conv)); |
| 449 | purple_conv_chat_set_topic(PURPLE_CONV_CHAT(conv), NULL, NULL); | |
| 450 | PURPLE_CONV_CHAT(conv)->left = FALSE; | |
| 451 | ||
| 452 | purple_conversation_update(conv, PURPLE_CONV_UPDATE_CHATLEFT); | |
| 8256 | 453 | } |
| 454 | ||
| 15884 | 455 | PurpleConversation * |
| 456 | purple_conversation_new(PurpleConversationType type, PurpleAccount *account, | |
|
4476
bf88170ba269
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4471
diff
changeset
|
457 | const char *name) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
458 | { |
| 15884 | 459 | PurpleConversation *conv; |
| 460 | PurpleConnection *gc; | |
| 461 | PurpleConversationUiOps *ops; | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
462 | struct _purple_hconv *hc; |
| 15884 | 463 | |
| 464 | g_return_val_if_fail(type != PURPLE_CONV_TYPE_UNKNOWN, NULL); | |
|
7088
0920bc6160ae
[gaim-migrate @ 7653]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
465 | g_return_val_if_fail(account != NULL, NULL); |
|
0920bc6160ae
[gaim-migrate @ 7653]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
466 | g_return_val_if_fail(name != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
467 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
468 | /* Check if this conversation already exists. */ |
| 15884 | 469 | if ((conv = purple_find_conversation_with_account(type, name, account)) != NULL) |
|
8271
a79531291e7f
[gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents:
8256
diff
changeset
|
470 | { |
|
27954
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
471 | if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
472 | !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) { |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
473 | 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
|
474 | "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
|
475 | "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
|
476 | } |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
477 | |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
478 | /* |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
479 | * 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
|
480 | * 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
|
481 | * 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
|
482 | * 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
|
483 | * chat. |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
484 | * 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
|
485 | */ |
|
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
|
486 | if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_CHAT || |
|
21253
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
487 | purple_conv_chat_has_left(PURPLE_CONV_CHAT(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
|
488 | { |
|
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
|
489 | if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
|
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
|
490 | 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
|
491 | |
|
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
|
492 | 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
|
493 | } |
| 8256 | 494 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
495 | |
| 15884 | 496 | gc = purple_account_get_connection(account); |
| 10665 | 497 | g_return_val_if_fail(gc != NULL, NULL); |
| 498 | ||
| 15884 | 499 | conv = g_new0(PurpleConversation, 1); |
| 500 | PURPLE_DBUS_REGISTER_POINTER(conv, PurpleConversation); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
501 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
502 | conv->type = type; |
| 4491 | 503 | conv->account = account; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
504 | conv->name = g_strdup(name); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
505 | conv->title = g_strdup(name); |
|
5139
24c56d94ed79
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
506 | 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
|
507 | g_free, NULL); |
| 10665 | 508 | /* 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
|
509 | conv->features = purple_connection_get_flags(gc); |
| 11581 | 510 | |
| 15884 | 511 | if (type == PURPLE_CONV_TYPE_IM) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
512 | { |
| 15884 | 513 | PurpleBuddyIcon *icon; |
| 514 | conv->u.im = g_new0(PurpleConvIm, 1); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
515 | conv->u.im->conv = conv; |
| 15884 | 516 | PURPLE_DBUS_REGISTER_POINTER(conv->u.im, PurpleConvIm); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
517 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
518 | ims = g_list_prepend(ims, conv); |
| 15884 | 519 | 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
|
520 | { |
| 15884 | 521 | purple_conv_im_set_icon(conv->u.im, 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
|
522 | /* purple_conv_im_set_icon refs the icon. */ |
|
e9f12eb06c5b
Rework purple_buddy_icons_find() to return a reference for the caller, which
Richard Laager <rlaager@pidgin.im>
parents:
16545
diff
changeset
|
523 | 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
|
524 | } |
| 15884 | 525 | |
|
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
|
526 | if (purple_prefs_get_bool("/purple/logging/log_ims")) |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
527 | { |
| 15884 | 528 | purple_conversation_set_logging(conv, TRUE); |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
529 | open_log(conv); |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
530 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
531 | } |
| 15884 | 532 | else if (type == PURPLE_CONV_TYPE_CHAT) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
533 | { |
| 8158 | 534 | const char *disp; |
| 535 | ||
| 15884 | 536 | conv->u.chat = g_new0(PurpleConvChat, 1); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
537 | conv->u.chat->conv = conv; |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
538 | 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
|
539 | _purple_conversation_user_equal, g_free, NULL); |
| 15884 | 540 | PURPLE_DBUS_REGISTER_POINTER(conv->u.chat, PurpleConvChat); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
541 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
542 | chats = g_list_prepend(chats, conv); |
|
8271
a79531291e7f
[gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents:
8256
diff
changeset
|
543 | |
|
32624
f957ad287bcc
Convert code to use the purple_account accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
544 | if ((disp = purple_connection_get_display_name(purple_account_get_connection(account)))) |
| 15884 | 545 | purple_conv_chat_set_nick(conv->u.chat, disp); |
|
8271
a79531291e7f
[gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents:
8256
diff
changeset
|
546 | else |
| 15884 | 547 | purple_conv_chat_set_nick(conv->u.chat, |
| 548 | purple_account_get_username(account)); | |
| 549 | ||
|
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
|
550 | if (purple_prefs_get_bool("/purple/logging/log_chats")) |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
551 | { |
| 15884 | 552 | purple_conversation_set_logging(conv, TRUE); |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
553 | open_log(conv); |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
554 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
555 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
556 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
557 | 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
|
558 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
559 | 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
|
560 | 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
|
561 | hc->account = account; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
562 | hc->type = type; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
563 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
564 | g_hash_table_insert(conversation_cache, hc, conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
565 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
566 | /* Auto-set the title. */ |
| 15884 | 567 | purple_conversation_autoset_title(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
568 | |
|
11602
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
569 | /* 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
|
570 | * it causes mysterious crashes on my system. |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
571 | * -- Gary |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
572 | */ |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
573 | ops = conv->ui_ops = default_ops; |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
574 | if (ops != NULL && ops->create_conversation != NULL) |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
575 | ops->create_conversation(conv); |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
576 | |
| 15884 | 577 | purple_signal_emit(purple_conversations_get_handle(), |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
578 | "conversation-created", conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
579 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
580 | return conv; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
581 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
582 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
583 | void |
| 15884 | 584 | purple_conversation_destroy(PurpleConversation *conv) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
585 | { |
| 15884 | 586 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 587 | PurpleConversationUiOps *ops; | |
| 588 | PurpleConnection *gc; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
589 | const char *name; |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
590 | struct _purple_hconv hc; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
591 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
592 | g_return_if_fail(conv != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
593 | |
| 15884 | 594 | purple_request_close_with_handle(conv); |
| 595 | ||
| 596 | 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
|
597 | gc = purple_conversation_get_connection(conv); |
| 15884 | 598 | name = purple_conversation_get_name(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
599 | |
| 8373 | 600 | if (gc != NULL) |
| 601 | { | |
|
5262
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
602 | /* 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
|
603 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
| 15884 | 604 | |
| 605 | if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) | |
| 8373 | 606 | { |
|
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
|
607 | if (purple_prefs_get_bool("/purple/conversations/im/send_typing")) |
| 15884 | 608 | serv_send_typing(gc, name, PURPLE_NOT_TYPING); |
|
5262
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
609 | |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
610 | if (gc && prpl_info->convo_closed != NULL) |
|
6403
9b2428783d7c
[gaim-migrate @ 6908]
Christian Hammond <chipx86@chipx86.com>
parents:
6402
diff
changeset
|
611 | 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
|
612 | } |
| 15884 | 613 | else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
| 8373 | 614 | { |
| 15884 | 615 | int chat_id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); |
|
8271
a79531291e7f
[gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents:
8256
diff
changeset
|
616 | #if 0 |
|
5262
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
617 | /* |
|
6030
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
618 | * This is unfortunately necessary, because calling |
| 15884 | 619 | * serv_chat_leave() calls this purple_conversation_destroy(), |
|
6030
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
620 | * 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
|
621 | * 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
|
622 | * serv_got_chat_left(), which is eventually called from the |
|
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
623 | * prpl that serv_chat_leave() calls, removes this conversation |
|
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
624 | * 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
|
625 | * 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
|
626 | * calling this, because it'll be called again. If not, fall |
|
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
627 | * 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
|
628 | * be on the 2nd pass. |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
629 | * |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
630 | * Long paragraph. <-- Short sentence. |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
631 | * |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
632 | * -- ChipX86 |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
633 | */ |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
634 | |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
635 | if (gc && g_slist_find(gc->buddy_chats, conv) != NULL) { |
| 8373 | 636 | 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
|
637 | |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
638 | return; |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
639 | } |
|
8271
a79531291e7f
[gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents:
8256
diff
changeset
|
640 | #endif |
| 8373 | 641 | /* |
| 642 | * Instead of all of that, lets just close the window when | |
| 643 | * the user tells us to, and let the prpl deal with the | |
| 644 | * internals on it's own time. Don't do this if the prpl already | |
| 645 | * knows it left the chat. | |
| 646 | */ | |
| 15884 | 647 | if (!purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) |
| 8373 | 648 | serv_chat_leave(gc, chat_id); |
| 649 | ||
| 650 | /* | |
| 651 | * If they didn't call serv_got_chat_left by now, it's too late. | |
| 652 | * So we better do it for them before we destroy the thing. | |
| 653 | */ | |
| 15884 | 654 | if (!purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) |
| 8373 | 655 | serv_got_chat_left(gc, chat_id); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
656 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
657 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
658 | |
|
12018
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
659 | /* remove from conversations and im/chats lists prior to emit */ |
|
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
660 | conversations = g_list_remove(conversations, conv); |
|
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
661 | |
| 15884 | 662 | if(conv->type==PURPLE_CONV_TYPE_IM) |
|
12018
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
663 | ims = g_list_remove(ims, conv); |
| 15884 | 664 | else if(conv->type==PURPLE_CONV_TYPE_CHAT) |
|
12018
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
665 | chats = g_list_remove(chats, conv); |
|
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
666 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
667 | 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
|
668 | hc.account = conv->account; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
669 | hc.type = conv->type; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
670 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
671 | 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
|
672 | |
| 15884 | 673 | purple_signal_emit(purple_conversations_get_handle(), |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
674 | "deleting-conversation", conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
675 | |
| 11606 | 676 | g_free(conv->name); |
| 677 | g_free(conv->title); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
678 | |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
679 | conv->name = NULL; |
|
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
680 | conv->title = NULL; |
|
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
681 | |
| 15884 | 682 | if (conv->type == PURPLE_CONV_TYPE_IM) { |
| 683 | purple_conv_im_stop_typing_timeout(conv->u.im); | |
| 684 | purple_conv_im_stop_send_typed_timeout(conv->u.im); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
685 | |
|
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
|
686 | purple_buddy_icon_unref(conv->u.im->icon); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
687 | conv->u.im->icon = NULL; |
|
6846
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
688 | |
| 15884 | 689 | PURPLE_DBUS_UNREGISTER_POINTER(conv->u.im); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
690 | g_free(conv->u.im); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
691 | conv->u.im = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
692 | } |
| 15884 | 693 | else if (conv->type == PURPLE_CONV_TYPE_CHAT) { |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
694 | 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
|
695 | conv->u.chat->users = NULL; |
| 15884 | 696 | |
| 697 | g_list_foreach(conv->u.chat->in_room, (GFunc)purple_conv_chat_cb_destroy, NULL); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
698 | g_list_free(conv->u.chat->in_room); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
699 | |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
700 | 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
|
701 | g_list_free(conv->u.chat->ignored); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
702 | |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
703 | conv->u.chat->in_room = NULL; |
|
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
704 | conv->u.chat->ignored = NULL; |
|
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
705 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
706 | g_free(conv->u.chat->who); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
707 | conv->u.chat->who = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
708 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
709 | g_free(conv->u.chat->topic); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
710 | conv->u.chat->topic = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
711 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
712 | g_free(conv->u.chat->nick); |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10385
diff
changeset
|
713 | |
| 15884 | 714 | PURPLE_DBUS_UNREGISTER_POINTER(conv->u.chat); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
715 | g_free(conv->u.chat); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
716 | conv->u.chat = NULL; |
|
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 | |
|
4877
7d1f4381fed0
[gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents:
4876
diff
changeset
|
719 | g_hash_table_destroy(conv->data); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
720 | conv->data = NULL; |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
721 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
722 | if (ops != NULL && ops->destroy_conversation != NULL) |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
723 | 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
|
724 | conv->ui_data = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
725 | |
| 15884 | 726 | purple_conversation_close_logs(conv); |
| 727 | ||
|
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
|
728 | 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
|
729 | |
| 15884 | 730 | PURPLE_DBUS_UNREGISTER_POINTER(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
731 | g_free(conv); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
732 | conv = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
733 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
734 | |
| 10665 | 735 | |
| 736 | void | |
| 15884 | 737 | purple_conversation_present(PurpleConversation *conv) { |
| 738 | PurpleConversationUiOps *ops; | |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
739 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
740 | g_return_if_fail(conv != NULL); |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
741 | |
| 15884 | 742 | ops = purple_conversation_get_ui_ops(conv); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
743 | if(ops && ops->present) |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
744 | ops->present(conv); |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
745 | } |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
746 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
747 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
748 | void |
| 15884 | 749 | purple_conversation_set_features(PurpleConversation *conv, PurpleConnectionFlags features) |
| 10665 | 750 | { |
| 751 | g_return_if_fail(conv != NULL); | |
| 752 | ||
| 753 | conv->features = features; | |
| 754 | ||
| 15884 | 755 | purple_conversation_update(conv, PURPLE_CONV_UPDATE_FEATURES); |
| 10665 | 756 | } |
| 757 | ||
| 758 | ||
| 15884 | 759 | PurpleConnectionFlags |
| 760 | purple_conversation_get_features(PurpleConversation *conv) | |
| 10665 | 761 | { |
| 762 | g_return_val_if_fail(conv != NULL, 0); | |
| 763 | return conv->features; | |
| 764 | } | |
| 765 | ||
| 766 | ||
| 15884 | 767 | PurpleConversationType |
| 768 | purple_conversation_get_type(const PurpleConversation *conv) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
769 | { |
| 15884 | 770 | g_return_val_if_fail(conv != NULL, PURPLE_CONV_TYPE_UNKNOWN); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
771 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
772 | return conv->type; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
773 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
774 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
775 | void |
| 15884 | 776 | purple_conversation_set_ui_ops(PurpleConversation *conv, |
| 777 | PurpleConversationUiOps *ops) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
778 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
779 | g_return_if_fail(conv != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
780 | |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
781 | if (conv->ui_ops == ops) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
782 | return; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
783 | |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4425
diff
changeset
|
784 | if (conv->ui_ops != NULL && conv->ui_ops->destroy_conversation != NULL) |
|
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4425
diff
changeset
|
785 | conv->ui_ops->destroy_conversation(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
786 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
787 | conv->ui_data = NULL; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
788 | |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4425
diff
changeset
|
789 | conv->ui_ops = ops; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
790 | } |
| 66 | 791 | |
| 15884 | 792 | PurpleConversationUiOps * |
| 793 | purple_conversation_get_ui_ops(const PurpleConversation *conv) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
794 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
795 | g_return_val_if_fail(conv != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
796 | |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4425
diff
changeset
|
797 | return conv->ui_ops; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
798 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
799 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
800 | void |
| 15884 | 801 | purple_conversation_set_account(PurpleConversation *conv, PurpleAccount *account) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
802 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
803 | g_return_if_fail(conv != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
804 | |
| 15884 | 805 | if (account == purple_conversation_get_account(conv)) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
806 | return; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
807 | |
| 4491 | 808 | conv->account = account; |
| 809 | ||
| 15884 | 810 | purple_conversation_update(conv, PURPLE_CONV_UPDATE_ACCOUNT); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
811 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
812 | |
| 15884 | 813 | PurpleAccount * |
| 814 | purple_conversation_get_account(const PurpleConversation *conv) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
815 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
816 | g_return_val_if_fail(conv != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
817 | |
| 4491 | 818 | return conv->account; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
819 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
820 | |
| 15884 | 821 | 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
|
822 | purple_conversation_get_connection(const PurpleConversation *conv) |
| 66 | 823 | { |
| 15884 | 824 | PurpleAccount *account; |
|
4425
b2ccc08ed727
[gaim-migrate @ 4700]
Christian Hammond <chipx86@chipx86.com>
parents:
4415
diff
changeset
|
825 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
826 | g_return_val_if_fail(conv != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
827 | |
| 15884 | 828 | account = purple_conversation_get_account(conv); |
| 4491 | 829 | |
| 830 | if (account == NULL) | |
|
4425
b2ccc08ed727
[gaim-migrate @ 4700]
Christian Hammond <chipx86@chipx86.com>
parents:
4415
diff
changeset
|
831 | return NULL; |
|
b2ccc08ed727
[gaim-migrate @ 4700]
Christian Hammond <chipx86@chipx86.com>
parents:
4415
diff
changeset
|
832 | |
|
32624
f957ad287bcc
Convert code to use the purple_account accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
833 | return purple_account_get_connection(account); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
834 | } |
|
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 | void |
| 15884 | 837 | purple_conversation_set_title(PurpleConversation *conv, const char *title) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
838 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
839 | g_return_if_fail(conv != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
840 | g_return_if_fail(title != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
841 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
842 | g_free(conv->title); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
843 | conv->title = g_strdup(title); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
844 | |
| 15884 | 845 | purple_conversation_update(conv, PURPLE_CONV_UPDATE_TITLE); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
846 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
847 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
848 | const char * |
| 15884 | 849 | purple_conversation_get_title(const PurpleConversation *conv) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
850 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
851 | g_return_val_if_fail(conv != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
852 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
853 | return conv->title; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
854 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
855 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
856 | void |
| 15884 | 857 | purple_conversation_autoset_title(PurpleConversation *conv) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
858 | { |
| 15884 | 859 | PurpleAccount *account; |
| 860 | PurpleBuddy *b; | |
| 861 | PurpleChat *chat; | |
| 8015 | 862 | const char *text = NULL, *name; |
| 3799 | 863 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
864 | g_return_if_fail(conv != NULL); |
|
2267
9704c0f60689
[gaim-migrate @ 2277]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2264
diff
changeset
|
865 | |
| 15884 | 866 | account = purple_conversation_get_account(conv); |
| 867 | name = purple_conversation_get_name(conv); | |
| 868 | ||
| 869 | if(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { | |
| 870 | if(account && ((b = purple_find_buddy(account, name)) != NULL)) | |
| 871 | text = purple_buddy_get_contact_alias(b); | |
| 872 | } else if(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { | |
| 873 | 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
|
874 | text = purple_chat_get_name(chat); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
875 | } |
| 11581 | 876 | |
| 8015 | 877 | |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
878 | if(text == NULL) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
879 | text = name; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
880 | |
| 15884 | 881 | purple_conversation_set_title(conv, text); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
882 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
883 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
884 | void |
| 15884 | 885 | purple_conversation_foreach(void (*func)(PurpleConversation *conv)) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
886 | { |
| 15884 | 887 | PurpleConversation *conv; |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
888 | GList *l; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
889 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
890 | g_return_if_fail(func != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
891 | |
| 15884 | 892 | for (l = purple_get_conversations(); l != NULL; l = l->next) { |
| 893 | conv = (PurpleConversation *)l->data; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
894 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
895 | func(conv); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
896 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
897 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
898 | |
|
7256
311c8febfc92
[gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents:
7125
diff
changeset
|
899 | void |
| 15884 | 900 | purple_conversation_set_name(PurpleConversation *conv, const char *name) |
|
7256
311c8febfc92
[gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents:
7125
diff
changeset
|
901 | { |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
902 | struct _purple_hconv *hc; |
|
7256
311c8febfc92
[gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents:
7125
diff
changeset
|
903 | g_return_if_fail(conv != NULL); |
|
311c8febfc92
[gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents:
7125
diff
changeset
|
904 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
905 | 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
|
906 | hc->type = conv->type; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
907 | hc->account = conv->account; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
908 | 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
|
909 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
910 | g_hash_table_remove(conversation_cache, hc); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
911 | g_free(conv->name); |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
912 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
913 | 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
|
914 | 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
|
915 | g_hash_table_insert(conversation_cache, hc, conv); |
|
7257
599b8494e6ee
[gaim-migrate @ 7834]
Christian Hammond <chipx86@chipx86.com>
parents:
7256
diff
changeset
|
916 | |
| 15884 | 917 | purple_conversation_autoset_title(conv); |
|
7256
311c8febfc92
[gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents:
7125
diff
changeset
|
918 | } |
|
311c8febfc92
[gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents:
7125
diff
changeset
|
919 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
920 | const char * |
| 15884 | 921 | purple_conversation_get_name(const PurpleConversation *conv) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
922 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
923 | g_return_val_if_fail(conv != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
924 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
925 | return conv->name; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
926 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
927 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
928 | void |
| 15884 | 929 | purple_conversation_set_logging(PurpleConversation *conv, gboolean log) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
930 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
931 | g_return_if_fail(conv != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
932 | |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
933 | if (conv->logging != log) |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
934 | { |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
935 | conv->logging = log; |
| 15884 | 936 | purple_conversation_update(conv, PURPLE_CONV_UPDATE_LOGGING); |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
937 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
938 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
939 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
940 | gboolean |
| 15884 | 941 | purple_conversation_is_logging(const PurpleConversation *conv) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
942 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
943 | g_return_val_if_fail(conv != NULL, FALSE); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
944 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
945 | return conv->logging; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
946 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
947 | |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
948 | void |
| 15884 | 949 | purple_conversation_close_logs(PurpleConversation *conv) |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
950 | { |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
951 | g_return_if_fail(conv != NULL); |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
952 | |
| 15884 | 953 | g_list_foreach(conv->logs, (GFunc)purple_log_free, NULL); |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
954 | g_list_free(conv->logs); |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
955 | conv->logs = NULL; |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
956 | } |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
957 | |
| 15884 | 958 | PurpleConvIm * |
| 959 | purple_conversation_get_im_data(const PurpleConversation *conv) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
960 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
961 | g_return_val_if_fail(conv != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
962 | |
| 15884 | 963 | if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_IM) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
964 | return NULL; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
965 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
966 | return conv->u.im; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
967 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
968 | |
| 15884 | 969 | PurpleConvChat * |
| 970 | purple_conversation_get_chat_data(const PurpleConversation *conv) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
971 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
972 | g_return_val_if_fail(conv != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
973 | |
| 15884 | 974 | if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_CHAT) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
975 | return NULL; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
976 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
977 | return conv->u.chat; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
978 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
979 | |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
980 | void |
| 15884 | 981 | purple_conversation_set_data(PurpleConversation *conv, const char *key, |
|
4877
7d1f4381fed0
[gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents:
4876
diff
changeset
|
982 | gpointer data) |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
983 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
984 | g_return_if_fail(conv != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
985 | g_return_if_fail(key != NULL); |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
986 | |
|
4877
7d1f4381fed0
[gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents:
4876
diff
changeset
|
987 | g_hash_table_replace(conv->data, g_strdup(key), data); |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
988 | } |
|
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
989 | |
|
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
990 | gpointer |
| 15884 | 991 | purple_conversation_get_data(PurpleConversation *conv, const char *key) |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
992 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
993 | g_return_val_if_fail(conv != NULL, NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
994 | g_return_val_if_fail(key != NULL, NULL); |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
995 | |
|
4877
7d1f4381fed0
[gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents:
4876
diff
changeset
|
996 | return g_hash_table_lookup(conv->data, key); |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
997 | } |
|
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
998 | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
999 | GList * |
| 15884 | 1000 | purple_get_conversations(void) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1001 | { |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1002 | return conversations; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1003 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1004 | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1005 | GList * |
| 15884 | 1006 | purple_get_ims(void) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1007 | { |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1008 | return ims; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1009 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1010 | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1011 | GList * |
| 15884 | 1012 | purple_get_chats(void) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1013 | { |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1014 | return chats; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1015 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1016 | |
| 7261 | 1017 | |
| 15884 | 1018 | PurpleConversation * |
| 1019 | purple_find_conversation_with_account(PurpleConversationType type, | |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10132
diff
changeset
|
1020 | const char *name, |
| 15884 | 1021 | const PurpleAccount *account) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1022 | { |
| 15884 | 1023 | PurpleConversation *c = NULL; |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
1024 | struct _purple_hconv hc; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1025 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1026 | g_return_val_if_fail(name != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1027 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
1028 | hc.name = (gchar *)purple_normalize(account, name); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
1029 | hc.account = account; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
1030 | hc.type = type; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
1031 | |
|
22987
4cd9b9d34a4e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22918
diff
changeset
|
1032 | switch (type) { |
|
4cd9b9d34a4e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22918
diff
changeset
|
1033 | case PURPLE_CONV_TYPE_IM: |
|
4cd9b9d34a4e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22918
diff
changeset
|
1034 | case PURPLE_CONV_TYPE_CHAT: |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
1035 | c = g_hash_table_lookup(conversation_cache, &hc); |
|
22987
4cd9b9d34a4e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22918
diff
changeset
|
1036 | break; |
|
4cd9b9d34a4e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22918
diff
changeset
|
1037 | case PURPLE_CONV_TYPE_ANY: |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
1038 | hc.type = PURPLE_CONV_TYPE_IM; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
1039 | c = g_hash_table_lookup(conversation_cache, &hc); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
1040 | if (!c) { |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
1041 | hc.type = PURPLE_CONV_TYPE_CHAT; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
1042 | c = g_hash_table_lookup(conversation_cache, &hc); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
1043 | } |
|
22987
4cd9b9d34a4e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22918
diff
changeset
|
1044 | break; |
|
4cd9b9d34a4e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22918
diff
changeset
|
1045 | default: |
|
4cd9b9d34a4e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22918
diff
changeset
|
1046 | g_return_val_if_reached(NULL); |
|
4cd9b9d34a4e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22918
diff
changeset
|
1047 | } |
|
4cd9b9d34a4e
When searching for a conversation, search only in the list of the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22918
diff
changeset
|
1048 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1049 | return c; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1050 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1051 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1052 | void |
| 15884 | 1053 | purple_conversation_write(PurpleConversation *conv, const char *who, |
| 1054 | const char *message, PurpleMessageFlags flags, | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1055 | time_t mtime) |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1056 | { |
| 15884 | 1057 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 1058 | PurpleConnection *gc = NULL; | |
| 1059 | PurpleAccount *account; | |
| 1060 | PurpleConversationUiOps *ops; | |
|
11468
3411c0d7f597
[gaim-migrate @ 13708]
Richard Laager <rlaager@pidgin.im>
parents:
11454
diff
changeset
|
1061 | const char *alias; |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1062 | char *displayed = NULL; |
| 15884 | 1063 | PurpleBuddy *b; |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1064 | int plugin_return; |
| 15884 | 1065 | PurpleConversationType type; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1066 | /* int logging_font_options = 0; */ |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1067 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1068 | g_return_if_fail(conv != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1069 | g_return_if_fail(message != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1070 | |
| 15884 | 1071 | ops = purple_conversation_get_ui_ops(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1072 | |
| 15884 | 1073 | account = purple_conversation_get_account(conv); |
| 1074 | type = purple_conversation_get_type(conv); | |
|
6496
9833c2665143
[gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1075 | |
|
9833c2665143
[gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
1076 | if (account != NULL) |
| 15884 | 1077 | gc = purple_account_get_connection(account); |
| 1078 | ||
| 1079 | if (purple_conversation_get_type(conv) == PURPLE_CONV_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
|
1080 | (gc != NULL && !g_slist_find(gc->buddy_chats, conv))) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1081 | return; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1082 | |
| 15884 | 1083 | if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1084 | !g_list_find(purple_get_conversations(), conv)) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1085 | return; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1086 | |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1087 | displayed = g_strdup(message); |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1088 | |
|
19769
9420f2078435
writing-im-msg now receives the conversation name as the who argument if
Richard Laager <rlaager@pidgin.im>
parents:
19674
diff
changeset
|
1089 | 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
|
1090 | 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
|
1091 | 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
|
1092 | |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1093 | plugin_return = |
| 15884 | 1094 | GPOINTER_TO_INT(purple_signal_emit_return_1( |
| 1095 | purple_conversations_get_handle(), | |
| 1096 | (type == PURPLE_CONV_TYPE_IM ? "writing-im-msg" : "writing-chat-msg"), | |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1097 | account, who, &displayed, conv, flags)); |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1098 | |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1099 | if (displayed == NULL) |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1100 | return; |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1101 | |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1102 | if (plugin_return) { |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1103 | g_free(displayed); |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1104 | return; |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1105 | } |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1106 | |
| 9613 | 1107 | if (account != NULL) { |
| 15884 | 1108 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(account))); |
| 1109 | ||
| 1110 | if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM || | |
|
5350
966c6d4d7bdd
[gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents:
5262
diff
changeset
|
1111 | !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
|
966c6d4d7bdd
[gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents:
5262
diff
changeset
|
1112 | |
| 15884 | 1113 | if (flags & PURPLE_MESSAGE_SEND) { |
| 1114 | b = purple_find_buddy(account, | |
| 1115 | purple_account_get_username(account)); | |
| 1116 | ||
| 1117 | if (purple_account_get_alias(account) != NULL) | |
|
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
|
1118 | alias = purple_account_get_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
|
1119 | else if (b != NULL && !purple_strequal(purple_buddy_get_name(b), purple_buddy_get_contact_alias(b))) |
| 15884 | 1120 | alias = purple_buddy_get_contact_alias(b); |
| 1121 | else if (purple_connection_get_display_name(gc) != NULL) | |
| 1122 | alias = purple_connection_get_display_name(gc); | |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1123 | else |
| 15884 | 1124 | alias = purple_account_get_username(account); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1125 | } |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1126 | else |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1127 | { |
| 15884 | 1128 | b = purple_find_buddy(account, who); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1129 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1130 | if (b != NULL) |
| 15884 | 1131 | alias = purple_buddy_get_contact_alias(b); |
|
1772
c759c01bd66f
[gaim-migrate @ 1782]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1764
diff
changeset
|
1132 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1133 | } |
|
474
8e9acf2f6c48
[gaim-migrate @ 484]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
473
diff
changeset
|
1134 | } |
| 8256 | 1135 | |
| 15884 | 1136 | 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
|
1137 | GList *log; |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
1138 | |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
1139 | if (conv->logs == NULL) |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
1140 | open_log(conv); |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
1141 | |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
1142 | log = conv->logs; |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1143 | while (log != NULL) { |
| 15884 | 1144 | purple_log_write((PurpleLog *)log->data, flags, alias, mtime, displayed); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1145 | log = log->next; |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1146 | } |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1147 | } |
| 66 | 1148 | |
|
19593
608995889b11
A conversation shouldn't need ui-ops for logging the messages.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19590
diff
changeset
|
1149 | 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
|
1150 | 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
|
1151 | |
|
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
1152 | 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
|
1153 | |
| 15884 | 1154 | purple_signal_emit(purple_conversations_get_handle(), |
| 1155 | (type == PURPLE_CONV_TYPE_IM ? "wrote-im-msg" : "wrote-chat-msg"), | |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1156 | account, who, displayed, conv, flags); |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1157 | |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1158 | g_free(displayed); |
| 66 | 1159 | } |
| 1160 | ||
|
9260
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1161 | gboolean |
| 15884 | 1162 | purple_conversation_has_focus(PurpleConversation *conv) |
|
9260
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1163 | { |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1164 | gboolean ret = FALSE; |
| 15884 | 1165 | PurpleConversationUiOps *ops; |
|
9260
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1166 | |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1167 | g_return_val_if_fail(conv != NULL, FALSE); |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1168 | |
| 15884 | 1169 | ops = purple_conversation_get_ui_ops(conv); |
|
9260
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1170 | |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1171 | if (ops != NULL && ops->has_focus != NULL) |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1172 | ret = ops->has_focus(conv); |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1173 | |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1174 | return ret; |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1175 | } |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1176 | |
|
7930
3005873ac411
[gaim-migrate @ 8601]
Mark Doliner <markdoliner@pidgin.im>
parents:
7879
diff
changeset
|
1177 | /* |
| 8256 | 1178 | * TODO: Need to make sure calls to this function happen in the core |
| 1179 | * instead of the UI. That way UIs have less work to do, and the | |
| 1180 | * 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
|
1181 | * when chats are added/removed from the blist. |
|
3005873ac411
[gaim-migrate @ 8601]
Mark Doliner <markdoliner@pidgin.im>
parents:
7879
diff
changeset
|
1182 | */ |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1183 | void |
| 15884 | 1184 | purple_conversation_update(PurpleConversation *conv, PurpleConvUpdateType type) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1185 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1186 | g_return_if_fail(conv != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1187 | |
| 15884 | 1188 | purple_signal_emit(purple_conversations_get_handle(), |
| 9734 | 1189 | "conversation-updated", conv, type); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1190 | } |
| 2993 | 1191 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1192 | /************************************************************************** |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1193 | * IM Conversation API |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1194 | **************************************************************************/ |
| 15884 | 1195 | PurpleConversation * |
| 1196 | purple_conv_im_get_conversation(const PurpleConvIm *im) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1197 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1198 | g_return_val_if_fail(im != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1199 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1200 | return im->conv; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1201 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1202 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1203 | void |
| 15884 | 1204 | purple_conv_im_set_icon(PurpleConvIm *im, PurpleBuddyIcon *icon) |
|
6846
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1205 | { |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1206 | g_return_if_fail(im != NULL); |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1207 | |
|
9261
a0ed867a459e
[gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents:
9260
diff
changeset
|
1208 | if (im->icon != icon) |
|
a0ed867a459e
[gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents:
9260
diff
changeset
|
1209 | { |
|
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
|
1210 | purple_buddy_icon_unref(im->icon); |
| 15884 | 1211 | |
| 1212 | im->icon = (icon == NULL ? NULL : purple_buddy_icon_ref(icon)); | |
|
9261
a0ed867a459e
[gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents:
9260
diff
changeset
|
1213 | } |
|
6846
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1214 | |
| 15884 | 1215 | purple_conversation_update(purple_conv_im_get_conversation(im), |
| 1216 | PURPLE_CONV_UPDATE_ICON); | |
|
6846
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1217 | } |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1218 | |
| 15884 | 1219 | PurpleBuddyIcon * |
| 1220 | purple_conv_im_get_icon(const PurpleConvIm *im) | |
|
6846
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1221 | { |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1222 | g_return_val_if_fail(im != NULL, NULL); |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1223 | |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1224 | return im->icon; |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1225 | } |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1226 | |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1227 | void |
| 15884 | 1228 | purple_conv_im_set_typing_state(PurpleConvIm *im, PurpleTypingState state) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1229 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1230 | g_return_if_fail(im != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1231 | |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12639
diff
changeset
|
1232 | if (im->typing_state != state) |
|
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12639
diff
changeset
|
1233 | { |
|
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12639
diff
changeset
|
1234 | im->typing_state = state; |
|
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12639
diff
changeset
|
1235 | |
|
17106
acef708c4ebc
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evands@pidgin.im>
parents:
16900
diff
changeset
|
1236 | switch (state) |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
1237 | { |
|
17106
acef708c4ebc
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evands@pidgin.im>
parents:
16900
diff
changeset
|
1238 | case PURPLE_TYPING: |
|
acef708c4ebc
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evands@pidgin.im>
parents:
16900
diff
changeset
|
1239 | purple_signal_emit(purple_conversations_get_handle(), |
|
acef708c4ebc
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evands@pidgin.im>
parents:
16900
diff
changeset
|
1240 | "buddy-typing", im->conv->account, im->conv->name); |
|
acef708c4ebc
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evands@pidgin.im>
parents:
16900
diff
changeset
|
1241 | break; |
|
acef708c4ebc
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evands@pidgin.im>
parents:
16900
diff
changeset
|
1242 | case PURPLE_TYPED: |
|
acef708c4ebc
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evands@pidgin.im>
parents:
16900
diff
changeset
|
1243 | purple_signal_emit(purple_conversations_get_handle(), |
|
acef708c4ebc
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evands@pidgin.im>
parents:
16900
diff
changeset
|
1244 | "buddy-typed", im->conv->account, im->conv->name); |
|
acef708c4ebc
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evands@pidgin.im>
parents:
16900
diff
changeset
|
1245 | break; |
|
acef708c4ebc
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evands@pidgin.im>
parents:
16900
diff
changeset
|
1246 | case PURPLE_NOT_TYPING: |
|
acef708c4ebc
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evands@pidgin.im>
parents:
16900
diff
changeset
|
1247 | purple_signal_emit(purple_conversations_get_handle(), |
|
acef708c4ebc
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evands@pidgin.im>
parents:
16900
diff
changeset
|
1248 | "buddy-typing-stopped", im->conv->account, im->conv->name); |
|
acef708c4ebc
Use switch() rather than a series of if() statements which hit all the values of the enum
Evan Schoenberg <evands@pidgin.im>
parents:
16900
diff
changeset
|
1249 | break; |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12639
diff
changeset
|
1250 | } |
|
27250
47fc0f87ce94
Consistently emit conversation-updated for typing state changes.
Florian Quèze <florian@instantbird.org>
parents:
26889
diff
changeset
|
1251 | |
|
47fc0f87ce94
Consistently emit conversation-updated for typing state changes.
Florian Quèze <florian@instantbird.org>
parents:
26889
diff
changeset
|
1252 | purple_conv_im_update_typing(im); |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12639
diff
changeset
|
1253 | } |
| 2993 | 1254 | } |
| 66 | 1255 | |
| 15884 | 1256 | PurpleTypingState |
| 1257 | purple_conv_im_get_typing_state(const PurpleConvIm *im) | |
| 3671 | 1258 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1259 | g_return_val_if_fail(im != NULL, 0); |
| 3671 | 1260 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1261 | return im->typing_state; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1262 | } |
| 3704 | 1263 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1264 | void |
| 15884 | 1265 | purple_conv_im_start_typing_timeout(PurpleConvIm *im, int timeout) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1266 | { |
| 15884 | 1267 | PurpleConversation *conv; |
| 3671 | 1268 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1269 | g_return_if_fail(im != NULL); |
| 3671 | 1270 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1271 | if (im->typing_timeout > 0) |
| 15884 | 1272 | purple_conv_im_stop_typing_timeout(im); |
| 1273 | ||
| 1274 | conv = purple_conv_im_get_conversation(im); | |
| 1275 | ||
|
18068
b6554e3c8224
merge of '1442df274a24edc9a31194327bd00dfbcf478720'
Richard Laager <rlaager@pidgin.im>
diff
changeset
|
1276 | im->typing_timeout = purple_timeout_add_seconds(timeout, reset_typing_cb, conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1277 | } |
| 3671 | 1278 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1279 | void |
| 15884 | 1280 | purple_conv_im_stop_typing_timeout(PurpleConvIm *im) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1281 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1282 | g_return_if_fail(im != NULL); |
| 3671 | 1283 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1284 | if (im->typing_timeout == 0) |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1285 | return; |
| 3671 | 1286 | |
| 15884 | 1287 | purple_timeout_remove(im->typing_timeout); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1288 | im->typing_timeout = 0; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1289 | } |
| 3671 | 1290 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1291 | guint |
| 15884 | 1292 | purple_conv_im_get_typing_timeout(const PurpleConvIm *im) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1293 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1294 | g_return_val_if_fail(im != NULL, 0); |
| 3699 | 1295 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1296 | return im->typing_timeout; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1297 | } |
| 3699 | 1298 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1299 | void |
| 15884 | 1300 | purple_conv_im_set_type_again(PurpleConvIm *im, unsigned int val) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1301 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1302 | g_return_if_fail(im != NULL); |
| 3671 | 1303 | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
1304 | if (val == 0) |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
1305 | im->type_again = 0; |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
1306 | else |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
1307 | im->type_again = time(NULL) + val; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1308 | } |
| 3671 | 1309 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1310 | time_t |
| 15884 | 1311 | purple_conv_im_get_type_again(const PurpleConvIm *im) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1312 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1313 | g_return_val_if_fail(im != NULL, 0); |
| 3671 | 1314 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1315 | return im->type_again; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1316 | } |
| 3671 | 1317 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1318 | void |
| 15884 | 1319 | purple_conv_im_start_send_typed_timeout(PurpleConvIm *im) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1320 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1321 | g_return_if_fail(im != NULL); |
| 3671 | 1322 | |
|
25716
1b5be208d5ba
applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents:
24051
diff
changeset
|
1323 | im->send_typed_timeout = purple_timeout_add_seconds(SEND_TYPED_TIMEOUT_SECONDS, |
|
1b5be208d5ba
applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents:
24051
diff
changeset
|
1324 | send_typed_cb, |
|
1b5be208d5ba
applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents:
24051
diff
changeset
|
1325 | purple_conv_im_get_conversation(im)); |
| 3671 | 1326 | } |
| 1327 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1328 | void |
| 15884 | 1329 | purple_conv_im_stop_send_typed_timeout(PurpleConvIm *im) |
| 3671 | 1330 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1331 | g_return_if_fail(im != NULL); |
| 3671 | 1332 | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
1333 | if (im->send_typed_timeout == 0) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1334 | return; |
| 3671 | 1335 | |
| 15884 | 1336 | purple_timeout_remove(im->send_typed_timeout); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
1337 | im->send_typed_timeout = 0; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1338 | } |
| 3671 | 1339 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1340 | guint |
| 15884 | 1341 | purple_conv_im_get_send_typed_timeout(const PurpleConvIm *im) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1342 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1343 | g_return_val_if_fail(im != NULL, 0); |
| 3671 | 1344 | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
1345 | return im->send_typed_timeout; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1346 | } |
| 3671 | 1347 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1348 | void |
| 15884 | 1349 | purple_conv_im_update_typing(PurpleConvIm *im) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1350 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1351 | g_return_if_fail(im != NULL); |
| 3671 | 1352 | |
| 15884 | 1353 | purple_conversation_update(purple_conv_im_get_conversation(im), |
| 1354 | PURPLE_CONV_UPDATE_TYPING); | |
| 3671 | 1355 | } |
| 1356 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1357 | void |
| 15884 | 1358 | purple_conv_im_write(PurpleConvIm *im, const char *who, const char *message, |
| 1359 | PurpleMessageFlags flags, time_t mtime) | |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1360 | { |
| 15884 | 1361 | PurpleConversation *c; |
|
1898
695a31e4452b
[gaim-migrate @ 1908]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1889
diff
changeset
|
1362 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1363 | g_return_if_fail(im != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1364 | g_return_if_fail(message != NULL); |
|
1898
695a31e4452b
[gaim-migrate @ 1908]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1889
diff
changeset
|
1365 | |
| 15884 | 1366 | c = purple_conv_im_get_conversation(im); |
|
2787
050506d3945f
[gaim-migrate @ 2800]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2773
diff
changeset
|
1367 | |
|
31602
968e936bc122
Fix indenting.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31565
diff
changeset
|
1368 | if ((flags & PURPLE_MESSAGE_RECV) == PURPLE_MESSAGE_RECV) { |
|
31449
2c75e32cecc6
applied changes from 471aa5f04627823959bd9accda5d5e5630f119d5
Evan Schoenberg <evands@pidgin.im>
parents:
31448
diff
changeset
|
1369 | purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING); |
|
2c75e32cecc6
applied changes from 471aa5f04627823959bd9accda5d5e5630f119d5
Evan Schoenberg <evands@pidgin.im>
parents:
31448
diff
changeset
|
1370 | } |
|
2c75e32cecc6
applied changes from 471aa5f04627823959bd9accda5d5e5630f119d5
Evan Schoenberg <evands@pidgin.im>
parents:
31448
diff
changeset
|
1371 | |
|
19118
c242294f21d1
Correct an inaccurate comment.
Will Thompson <resiak@pidgin.im>
parents:
18744
diff
changeset
|
1372 | /* Pass this on to either the ops structure or the default write func. */ |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4425
diff
changeset
|
1373 | if (c->ui_ops != NULL && c->ui_ops->write_im != NULL) |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6846
diff
changeset
|
1374 | c->ui_ops->write_im(c, who, message, flags, mtime); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1375 | else |
| 15884 | 1376 | purple_conversation_write(c, who, message, flags, mtime); |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1377 | } |
|
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1378 | |
| 15884 | 1379 | gboolean purple_conv_present_error(const char *who, PurpleAccount *account, const char *what) |
| 9627 | 1380 | { |
| 15884 | 1381 | PurpleConversation *conv; |
| 9627 | 1382 | |
| 1383 | g_return_val_if_fail(who != NULL, FALSE); | |
| 1384 | g_return_val_if_fail(account !=NULL, FALSE); | |
| 1385 | g_return_val_if_fail(what != NULL, FALSE); | |
| 1386 | ||
| 15884 | 1387 | conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, who, account); |
| 9627 | 1388 | if (conv != NULL) |
| 15884 | 1389 | purple_conversation_write(conv, NULL, what, PURPLE_MESSAGE_ERROR, time(NULL)); |
| 9627 | 1390 | else |
| 1391 | return FALSE; | |
| 1392 | ||
| 1393 | return TRUE; | |
| 1394 | } | |
| 1395 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1396 | void |
| 15884 | 1397 | purple_conv_im_send(PurpleConvIm *im, const char *message) |
|
2379
cffc8ebf1bd4
[gaim-migrate @ 2392]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2375
diff
changeset
|
1398 | { |
| 15884 | 1399 | purple_conv_im_send_with_flags(im, message, 0); |
|
11921
fe74264ce36c
[gaim-migrate @ 14212]
Evan Schoenberg <evands@pidgin.im>
parents:
11869
diff
changeset
|
1400 | } |
|
fe74264ce36c
[gaim-migrate @ 14212]
Evan Schoenberg <evands@pidgin.im>
parents:
11869
diff
changeset
|
1401 | |
| 14582 | 1402 | static void |
| 15884 | 1403 | purple_conv_send_confirm_cb(gpointer *data) |
| 14582 | 1404 | { |
| 15884 | 1405 | PurpleConversation *conv = data[0]; |
| 14582 | 1406 | char *message = data[1]; |
| 1407 | ||
| 1408 | g_free(data); | |
| 1409 | common_send(conv, message, 0); | |
| 1410 | } | |
| 1411 | ||
| 1412 | void | |
| 15884 | 1413 | purple_conv_send_confirm(PurpleConversation *conv, const char *message) |
| 14582 | 1414 | { |
| 1415 | char *text; | |
| 1416 | gpointer *data; | |
| 1417 | ||
| 1418 | g_return_if_fail(conv != NULL); | |
| 1419 | g_return_if_fail(message != NULL); | |
| 1420 | ||
| 1421 | if (conv->ui_ops != NULL && conv->ui_ops->send_confirm != NULL) | |
| 1422 | { | |
| 1423 | conv->ui_ops->send_confirm(conv, message); | |
| 1424 | return; | |
| 1425 | } | |
| 1426 | ||
| 1427 | text = g_strdup_printf("You are about to send the following message:\n%s", message); | |
| 1428 | data = g_new0(gpointer, 2); | |
| 1429 | data[0] = conv; | |
| 1430 | data[1] = (gpointer)message; | |
| 1431 | ||
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1432 | purple_request_action(conv, NULL, _("Send Message"), text, 0, |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34322
diff
changeset
|
1433 | purple_request_cpar_from_account( |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34322
diff
changeset
|
1434 | purple_conversation_get_account(conv)), |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34322
diff
changeset
|
1435 | data, 2, _("_Send Message"), |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34322
diff
changeset
|
1436 | G_CALLBACK(purple_conv_send_confirm_cb), _("Cancel"), NULL); |
| 14582 | 1437 | } |
| 1438 | ||
|
11921
fe74264ce36c
[gaim-migrate @ 14212]
Evan Schoenberg <evands@pidgin.im>
parents:
11869
diff
changeset
|
1439 | void |
| 15884 | 1440 | purple_conv_im_send_with_flags(PurpleConvIm *im, const char *message, PurpleMessageFlags flags) |
|
11921
fe74264ce36c
[gaim-migrate @ 14212]
Evan Schoenberg <evands@pidgin.im>
parents:
11869
diff
changeset
|
1441 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1442 | g_return_if_fail(im != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1443 | g_return_if_fail(message != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1444 | |
| 15884 | 1445 | common_send(purple_conv_im_get_conversation(im), message, flags); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1446 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1447 | |
| 10526 | 1448 | gboolean |
| 15884 | 1449 | purple_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, |
|
12618
b83b6bab0703
[gaim-migrate @ 14954]
Richard Laager <rlaager@pidgin.im>
parents:
12604
diff
changeset
|
1450 | const char *cksum_type, const char *chksum, |
|
b83b6bab0703
[gaim-migrate @ 14954]
Richard Laager <rlaager@pidgin.im>
parents:
12604
diff
changeset
|
1451 | gboolean remote) |
| 10526 | 1452 | { |
| 1453 | if (conv == NULL || smile == NULL || !*smile) { | |
| 1454 | return FALSE; | |
| 1455 | } | |
| 1456 | ||
| 1457 | /* TODO: check if the icon is in the cache and return false if so */ | |
| 1458 | /* TODO: add an icon cache (that doesn't suck) */ | |
| 1459 | 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
|
1460 | return conv->ui_ops->custom_smiley_add(conv, smile, remote); |
| 10526 | 1461 | } else { |
| 15884 | 1462 | purple_debug_info("conversation", "Could not find add custom smiley function"); |
| 10526 | 1463 | return FALSE; |
| 1464 | } | |
| 1465 | ||
| 1466 | } | |
| 1467 | ||
| 1468 | void | |
| 15884 | 1469 | purple_conv_custom_smiley_write(PurpleConversation *conv, const char *smile, |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11064
diff
changeset
|
1470 | const guchar *data, gsize size) |
| 10526 | 1471 | { |
| 1472 | g_return_if_fail(conv != NULL); | |
| 1473 | g_return_if_fail(smile != NULL && *smile); | |
| 1474 | ||
| 1475 | if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_write != NULL) | |
| 1476 | conv->ui_ops->custom_smiley_write(conv, smile, data, size); | |
| 1477 | else | |
| 15884 | 1478 | purple_debug_info("conversation", "Could not find the smiley write function"); |
| 10526 | 1479 | } |
| 1480 | ||
| 1481 | void | |
| 15884 | 1482 | purple_conv_custom_smiley_close(PurpleConversation *conv, const char *smile) |
| 10526 | 1483 | { |
| 1484 | g_return_if_fail(conv != NULL); | |
| 1485 | g_return_if_fail(smile != NULL && *smile); | |
| 1486 | ||
| 1487 | if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_close != NULL) | |
| 1488 | conv->ui_ops->custom_smiley_close(conv, smile); | |
| 1489 | else | |
| 15884 | 1490 | purple_debug_info("conversation", "Could not find custom smiley close function"); |
| 10526 | 1491 | } |
| 1492 | ||
| 1493 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1494 | /************************************************************************** |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1495 | * Chat Conversation API |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1496 | **************************************************************************/ |
|
2379
cffc8ebf1bd4
[gaim-migrate @ 2392]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2375
diff
changeset
|
1497 | |
| 15884 | 1498 | PurpleConversation * |
| 1499 | purple_conv_chat_get_conversation(const PurpleConvChat *chat) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1500 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1501 | g_return_val_if_fail(chat != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1502 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1503 | return chat->conv; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1504 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1505 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1506 | GList * |
| 15884 | 1507 | purple_conv_chat_get_users(const PurpleConvChat *chat) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1002
diff
changeset
|
1508 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1509 | g_return_val_if_fail(chat != NULL, NULL); |
|
1253
f02697a6aada
[gaim-migrate @ 1263]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
1510 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1511 | return chat->in_room; |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1002
diff
changeset
|
1512 | } |
|
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1002
diff
changeset
|
1513 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1514 | void |
| 15884 | 1515 | purple_conv_chat_ignore(PurpleConvChat *chat, const char *name) |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1516 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1517 | g_return_if_fail(chat != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1518 | g_return_if_fail(name != NULL); |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1519 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1520 | /* Make sure the user isn't already ignored. */ |
| 15884 | 1521 | if (purple_conv_chat_is_user_ignored(chat, name)) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1522 | return; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1523 | |
| 15884 | 1524 | purple_conv_chat_set_ignored(chat, |
|
18187
d560300fa2ab
Re-apply a good change from 2d8ea56b90971e7851442d96b7d74ecb4f052126:
Richard Laager <rlaager@pidgin.im>
parents:
18122
diff
changeset
|
1525 | g_list_append(chat->ignored, g_strdup(name))); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1526 | } |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1527 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1528 | void |
| 15884 | 1529 | purple_conv_chat_unignore(PurpleConvChat *chat, const char *name) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1530 | { |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1531 | GList *item; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1532 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1533 | g_return_if_fail(chat != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1534 | g_return_if_fail(name != NULL); |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1535 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1536 | /* Make sure the user is actually ignored. */ |
| 15884 | 1537 | if (!purple_conv_chat_is_user_ignored(chat, name)) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1538 | return; |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1539 | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1540 | item = g_list_find(purple_conv_chat_get_ignored(chat), |
| 15884 | 1541 | purple_conv_chat_get_ignored_user(chat, name)); |
| 1542 | ||
| 1543 | purple_conv_chat_set_ignored(chat, | |
|
18187
d560300fa2ab
Re-apply a good change from 2d8ea56b90971e7851442d96b7d74ecb4f052126:
Richard Laager <rlaager@pidgin.im>
parents:
18122
diff
changeset
|
1544 | g_list_remove_link(chat->ignored, item)); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1545 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1546 | g_free(item->data); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1547 | g_list_free_1(item); |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1548 | } |
|
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1549 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1550 | GList * |
| 15884 | 1551 | purple_conv_chat_set_ignored(PurpleConvChat *chat, GList *ignored) |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1552 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1553 | g_return_val_if_fail(chat != NULL, NULL); |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1554 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1555 | chat->ignored = ignored; |
|
993
8798e0ac047d
[gaim-migrate @ 1003]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
980
diff
changeset
|
1556 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1557 | return ignored; |
|
2111
34615a640c59
[gaim-migrate @ 2121]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2109
diff
changeset
|
1558 | } |
|
34615a640c59
[gaim-migrate @ 2121]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2109
diff
changeset
|
1559 | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1560 | GList * |
| 15884 | 1561 | purple_conv_chat_get_ignored(const PurpleConvChat *chat) |
|
2111
34615a640c59
[gaim-migrate @ 2121]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2109
diff
changeset
|
1562 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1563 | g_return_val_if_fail(chat != NULL, NULL); |
|
1898
695a31e4452b
[gaim-migrate @ 1908]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1889
diff
changeset
|
1564 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1565 | return chat->ignored; |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1566 | } |
|
472
9a5b8da2d760
[gaim-migrate @ 482]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
411
diff
changeset
|
1567 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1568 | const char * |
| 15884 | 1569 | purple_conv_chat_get_ignored_user(const PurpleConvChat *chat, const char *user) |
| 1340 | 1570 | { |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1571 | GList *ignored; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1572 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1573 | g_return_val_if_fail(chat != NULL, NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1574 | g_return_val_if_fail(user != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1575 | |
| 15884 | 1576 | for (ignored = purple_conv_chat_get_ignored(chat); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1577 | ignored != NULL; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1578 | ignored = ignored->next) { |
|
2372
c24942700dfd
[gaim-migrate @ 2385]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2363
diff
changeset
|
1579 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1580 | const char *ign = (const char *)ignored->data; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1581 | |
| 15884 | 1582 | if (!purple_utf8_strcasecmp(user, ign) || |
| 1583 | ((*ign == '+' || *ign == '%') && !purple_utf8_strcasecmp(user, ign + 1))) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1584 | return ign; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1585 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1586 | if (*ign == '@') { |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1587 | ign++; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1588 | |
| 15884 | 1589 | if ((*ign == '+' && !purple_utf8_strcasecmp(user, ign + 1)) || |
| 1590 | (*ign != '+' && !purple_utf8_strcasecmp(user, ign))) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1591 | return ign; |
| 3671 | 1592 | } |
| 2094 | 1593 | } |
| 1341 | 1594 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1595 | return NULL; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1596 | } |
| 1341 | 1597 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1598 | gboolean |
| 15884 | 1599 | purple_conv_chat_is_user_ignored(const PurpleConvChat *chat, const char *user) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1600 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1601 | g_return_val_if_fail(chat != NULL, FALSE); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1602 | g_return_val_if_fail(user != NULL, FALSE); |
| 1341 | 1603 | |
| 15884 | 1604 | return (purple_conv_chat_get_ignored_user(chat, user) != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1605 | } |
| 1343 | 1606 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1607 | void |
| 15884 | 1608 | purple_conv_chat_set_topic(PurpleConvChat *chat, const char *who, const char *topic) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1609 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1610 | g_return_if_fail(chat != NULL); |
| 1343 | 1611 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1612 | g_free(chat->who); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1613 | g_free(chat->topic); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1614 | |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1615 | chat->who = g_strdup(who); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1616 | chat->topic = g_strdup(topic); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1617 | |
| 15884 | 1618 | purple_conversation_update(purple_conv_chat_get_conversation(chat), |
| 1619 | PURPLE_CONV_UPDATE_TOPIC); | |
| 1620 | ||
| 1621 | purple_signal_emit(purple_conversations_get_handle(), "chat-topic-changed", | |
| 9517 | 1622 | chat->conv, chat->who, chat->topic); |
| 1340 | 1623 | } |
| 1624 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1625 | const char * |
| 15884 | 1626 | purple_conv_chat_get_topic(const PurpleConvChat *chat) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1627 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1628 | g_return_val_if_fail(chat != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1629 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1630 | return chat->topic; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1631 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1632 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1633 | void |
| 15884 | 1634 | purple_conv_chat_set_id(PurpleConvChat *chat, int id) |
|
1573
878f7c59ee85
[gaim-migrate @ 1583]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1532
diff
changeset
|
1635 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1636 | g_return_if_fail(chat != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1637 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1638 | chat->id = id; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1639 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1640 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1641 | int |
| 15884 | 1642 | purple_conv_chat_get_id(const PurpleConvChat *chat) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1643 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1644 | g_return_val_if_fail(chat != NULL, -1); |
| 3951 | 1645 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1646 | return chat->id; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1647 | } |
| 3951 | 1648 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1649 | void |
| 15884 | 1650 | purple_conv_chat_write(PurpleConvChat *chat, const char *who, const char *message, |
| 1651 | PurpleMessageFlags flags, time_t mtime) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1652 | { |
| 15884 | 1653 | PurpleAccount *account; |
| 1654 | PurpleConversation *conv; | |
| 1655 | PurpleConnection *gc; | |
| 3866 | 1656 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1657 | g_return_if_fail(chat != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1658 | g_return_if_fail(who != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1659 | g_return_if_fail(message != NULL); |
| 3866 | 1660 | |
| 15884 | 1661 | conv = purple_conv_chat_get_conversation(chat); |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
1662 | gc = purple_conversation_get_connection(conv); |
| 15884 | 1663 | account = purple_connection_get_account(gc); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1664 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1665 | /* Don't display this if the person who wrote it is ignored. */ |
| 15884 | 1666 | if (purple_conv_chat_is_user_ignored(chat, who)) |
|
1573
878f7c59ee85
[gaim-migrate @ 1583]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1532
diff
changeset
|
1667 | return; |
| 3677 | 1668 | |
| 15884 | 1669 | if (!(flags & PURPLE_MESSAGE_WHISPER)) { |
|
25721
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25716
diff
changeset
|
1670 | const char *str; |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25716
diff
changeset
|
1671 | |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25716
diff
changeset
|
1672 | str = purple_normalize(account, who); |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25716
diff
changeset
|
1673 | |
|
26889
4de21edc9dc7
Chat's nick is normalized. So normalize before comparing with it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26762
diff
changeset
|
1674 | if (purple_strequal(str, chat->nick)) { |
| 15884 | 1675 | flags |= PURPLE_MESSAGE_SEND; |
| 8158 | 1676 | } else { |
| 15884 | 1677 | flags |= PURPLE_MESSAGE_RECV; |
| 1678 | ||
| 1679 | if (purple_utf8_has_word(message, chat->nick)) | |
| 1680 | flags |= PURPLE_MESSAGE_NICK; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1681 | } |
| 3677 | 1682 | } |
| 3705 | 1683 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1684 | /* Pass this on to either the ops structure or the default write func. */ |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4425
diff
changeset
|
1685 | if (conv->ui_ops != NULL && conv->ui_ops->write_chat != NULL) |
|
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4425
diff
changeset
|
1686 | conv->ui_ops->write_chat(conv, who, message, flags, mtime); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1687 | else |
| 15884 | 1688 | purple_conversation_write(conv, who, message, flags, mtime); |
|
1573
878f7c59ee85
[gaim-migrate @ 1583]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1532
diff
changeset
|
1689 | } |
|
878f7c59ee85
[gaim-migrate @ 1583]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1532
diff
changeset
|
1690 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1691 | void |
| 15884 | 1692 | purple_conv_chat_send(PurpleConvChat *chat, const char *message) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1693 | { |
| 15884 | 1694 | purple_conv_chat_send_with_flags(chat, message, 0); |
|
11921
fe74264ce36c
[gaim-migrate @ 14212]
Evan Schoenberg <evands@pidgin.im>
parents:
11869
diff
changeset
|
1695 | } |
|
fe74264ce36c
[gaim-migrate @ 14212]
Evan Schoenberg <evands@pidgin.im>
parents:
11869
diff
changeset
|
1696 | |
|
fe74264ce36c
[gaim-migrate @ 14212]
Evan Schoenberg <evands@pidgin.im>
parents:
11869
diff
changeset
|
1697 | void |
| 15884 | 1698 | purple_conv_chat_send_with_flags(PurpleConvChat *chat, const char *message, PurpleMessageFlags flags) |
|
11921
fe74264ce36c
[gaim-migrate @ 14212]
Evan Schoenberg <evands@pidgin.im>
parents:
11869
diff
changeset
|
1699 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1700 | g_return_if_fail(chat != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1701 | g_return_if_fail(message != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1702 | |
| 15884 | 1703 | common_send(purple_conv_chat_get_conversation(chat), message, flags); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1704 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1705 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1706 | void |
| 15884 | 1707 | purple_conv_chat_add_user(PurpleConvChat *chat, const char *user, |
| 1708 | const char *extra_msg, PurpleConvChatBuddyFlags flags, | |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1709 | gboolean new_arrival) |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1710 | { |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1711 | GList *users = g_list_append(NULL, (char *)user); |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1712 | GList *extra_msgs = g_list_append(NULL, (char *)extra_msg); |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1713 | GList *flags2 = g_list_append(NULL, GINT_TO_POINTER(flags)); |
| 11581 | 1714 | |
| 15884 | 1715 | purple_conv_chat_add_users(chat, users, extra_msgs, flags2, new_arrival); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1716 | |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1717 | g_list_free(users); |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1718 | g_list_free(extra_msgs); |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1719 | g_list_free(flags2); |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1720 | } |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1721 | |
|
14043
3b7f131dbb20
[gaim-migrate @ 16548]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1722 | static int |
| 15884 | 1723 | purple_conv_chat_cb_compare(PurpleConvChatBuddy *a, PurpleConvChatBuddy *b) |
|
14027
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1724 | { |
| 15884 | 1725 | PurpleConvChatBuddyFlags f1 = 0, f2 = 0; |
|
14027
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1726 | char *user1 = NULL, *user2 = NULL; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1727 | gint ret = 0; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1728 | |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1729 | if (a) { |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1730 | f1 = a->flags; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1731 | if (a->alias_key) |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1732 | user1 = a->alias_key; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1733 | else if (a->name) |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1734 | user1 = a->name; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1735 | } |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1736 | |
|
14027
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1737 | if (b) { |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1738 | f2 = b->flags; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1739 | if (b->alias_key) |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1740 | user2 = b->alias_key; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1741 | else if (b->name) |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1742 | user2 = b->name; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1743 | } |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1744 | |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1745 | if (user1 == NULL || user2 == NULL) { |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1746 | if (!(user1 == NULL && user2 == NULL)) |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1747 | ret = (user1 == NULL) ? -1: 1; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1748 | } else if (f1 != f2) { |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1749 | /* sort more important users first */ |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1750 | ret = (f1 > f2) ? -1 : 1; |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1751 | } else if (a->buddy != b->buddy) { |
|
14027
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1752 | ret = a->buddy ? -1 : 1; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1753 | } else { |
|
17155
143ff2796376
Replace strcasecmp() calls with glib equivalents.
Richard Laager <rlaager@pidgin.im>
parents:
17106
diff
changeset
|
1754 | ret = purple_utf8_strcasecmp(user1, user2); |
|
14027
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1755 | } |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1756 | |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1757 | return ret; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1758 | } |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1759 | |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1760 | void |
| 15884 | 1761 | purple_conv_chat_add_users(PurpleConvChat *chat, GList *users, GList *extra_msgs, |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1762 | GList *flags, gboolean new_arrivals) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1763 | { |
| 15884 | 1764 | PurpleConversation *conv; |
| 1765 | PurpleConversationUiOps *ops; | |
| 1766 | PurpleConvChatBuddy *cbuddy; | |
| 1767 | PurpleConnection *gc; | |
| 1768 | PurplePluginProtocolInfo *prpl_info; | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1769 | GList *ul, *fl; |
|
14027
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1770 | GList *cbuddies = NULL; |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1771 | |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1772 | g_return_if_fail(chat != NULL); |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1773 | g_return_if_fail(users != NULL); |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1774 | |
| 15884 | 1775 | conv = purple_conv_chat_get_conversation(chat); |
| 1776 | ops = purple_conversation_get_ui_ops(conv); | |
| 1777 | ||
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
1778 | gc = purple_conversation_get_connection(conv); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1779 | g_return_if_fail(gc != NULL); |
|
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
|
1780 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1781 | g_return_if_fail(prpl_info != NULL); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1782 | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1783 | ul = users; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1784 | fl = flags; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1785 | while ((ul != NULL) && (fl != NULL)) { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1786 | const char *user = (const char *)ul->data; |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1787 | const char *alias = user; |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1788 | gboolean quiet; |
| 15884 | 1789 | PurpleConvChatBuddyFlags flag = GPOINTER_TO_INT(fl->data); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1790 | const char *extra_msg = (extra_msgs ? extra_msgs->data : NULL); |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1791 | |
|
17567
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1792 | if(!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
|
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
|
1793 | if (purple_strequal(chat->nick, purple_normalize(conv->account, user))) { |
|
17567
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1794 | const char *alias2 = purple_account_get_alias(conv->account); |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1795 | if (alias2 != NULL) |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1796 | alias = alias2; |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1797 | else |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1798 | { |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1799 | const char *display_name = purple_connection_get_display_name(gc); |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1800 | if (display_name != NULL) |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1801 | alias = display_name; |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1802 | } |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1803 | } else { |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1804 | PurpleBuddy *buddy; |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32633
diff
changeset
|
1805 | if ((buddy = purple_find_buddy(purple_connection_get_account(gc), user)) != NULL) |
|
17567
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1806 | alias = purple_buddy_get_contact_alias(buddy); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1807 | } |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1808 | } |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1809 | |
| 15884 | 1810 | quiet = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_conversations_get_handle(), |
|
23558
a83aa53014d5
This should be a boolean or, not a bitwise or.
Will Thompson <resiak@pidgin.im>
parents:
23440
diff
changeset
|
1811 | "chat-buddy-joining", conv, user, flag)) || |
| 15884 | 1812 | purple_conv_chat_is_user_ignored(chat, user); |
| 1813 | ||
| 1814 | cbuddy = purple_conv_chat_cb_new(user, alias, flag); | |
|
18360
24a00376266d
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18193
diff
changeset
|
1815 | cbuddy->buddy = purple_find_buddy(conv->account, user) != NULL; |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
1816 | |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
1817 | chat->in_room = g_list_prepend(chat->in_room, cbuddy); |
|
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
|
1818 | g_hash_table_replace(chat->users, g_strdup(cbuddy->name), cbuddy); |
|
14031
c9283f5bf3da
[gaim-migrate @ 16527]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
14027
diff
changeset
|
1819 | |
|
14027
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1820 | cbuddies = g_list_prepend(cbuddies, cbuddy); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1821 | |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1822 | if (!quiet && new_arrivals) { |
|
23559
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
1823 | char *alias_esc = g_markup_escape_text(alias, -1); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1824 | char *tmp; |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1825 | |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1826 | if (extra_msg == NULL) |
|
23559
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
1827 | tmp = g_strdup_printf(_("%s entered the room."), alias_esc); |
|
12840
548fd34f1f87
[gaim-migrate @ 15188]
Richard Laager <rlaager@pidgin.im>
parents:
12797
diff
changeset
|
1828 | else { |
|
23559
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
1829 | char *extra_msg_esc = g_markup_escape_text(extra_msg, -1); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1830 | tmp = g_strdup_printf(_("%s [<I>%s</I>] entered the room."), |
|
23559
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
1831 | alias_esc, extra_msg_esc); |
|
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
1832 | g_free(extra_msg_esc); |
|
12840
548fd34f1f87
[gaim-migrate @ 15188]
Richard Laager <rlaager@pidgin.im>
parents:
12797
diff
changeset
|
1833 | } |
|
23559
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
1834 | g_free(alias_esc); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1835 | |
|
18088
2e08852cc6c5
use the new NO_LINKIFY flag for join and part messages
Nathan Walp <nwalp@pidgin.im>
parents:
18087
diff
changeset
|
1836 | purple_conversation_write(conv, NULL, tmp, |
|
2e08852cc6c5
use the new NO_LINKIFY flag for join and part messages
Nathan Walp <nwalp@pidgin.im>
parents:
18087
diff
changeset
|
1837 | PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, |
|
2e08852cc6c5
use the new NO_LINKIFY flag for join and part messages
Nathan Walp <nwalp@pidgin.im>
parents:
18087
diff
changeset
|
1838 | time(NULL)); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1839 | g_free(tmp); |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1840 | } |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
1841 | |
| 15884 | 1842 | purple_signal_emit(purple_conversations_get_handle(), |
|
14031
c9283f5bf3da
[gaim-migrate @ 16527]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
14027
diff
changeset
|
1843 | "chat-buddy-joined", conv, user, flag, new_arrivals); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1844 | ul = ul->next; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1845 | fl = fl->next; |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1846 | if (extra_msgs != NULL) |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1847 | extra_msgs = extra_msgs->next; |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1848 | } |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1849 | |
| 15884 | 1850 | cbuddies = g_list_sort(cbuddies, (GCompareFunc)purple_conv_chat_cb_compare); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1851 | |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1852 | if (ops != NULL && ops->chat_add_users != NULL) |
|
14027
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1853 | ops->chat_add_users(conv, cbuddies, new_arrivals); |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1854 | |
|
14031
c9283f5bf3da
[gaim-migrate @ 16527]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
14027
diff
changeset
|
1855 | g_list_free(cbuddies); |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1856 | } |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1857 | |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1858 | void |
| 15884 | 1859 | purple_conv_chat_rename_user(PurpleConvChat *chat, const char *old_user, |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1860 | const char *new_user) |
|
472
9a5b8da2d760
[gaim-migrate @ 482]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
411
diff
changeset
|
1861 | { |
| 15884 | 1862 | PurpleConversation *conv; |
| 1863 | PurpleConversationUiOps *ops; | |
| 1864 | PurpleConnection *gc; | |
| 1865 | PurplePluginProtocolInfo *prpl_info; | |
| 1866 | PurpleConvChatBuddy *cb; | |
| 1867 | PurpleConvChatBuddyFlags flags; | |
|
11485
fe334b13d1d0
[gaim-migrate @ 13727]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11481
diff
changeset
|
1868 | const char *new_alias = new_user; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1869 | char tmp[BUF_LONG]; |
|
11485
fe334b13d1d0
[gaim-migrate @ 13727]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11481
diff
changeset
|
1870 | gboolean is_me = FALSE; |
| 3866 | 1871 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1872 | g_return_if_fail(chat != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1873 | g_return_if_fail(old_user != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1874 | g_return_if_fail(new_user != NULL); |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1875 | |
| 15884 | 1876 | conv = purple_conv_chat_get_conversation(chat); |
| 1877 | ops = purple_conversation_get_ui_ops(conv); | |
| 1878 | ||
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
1879 | gc = purple_conversation_get_connection(conv); |
|
11485
fe334b13d1d0
[gaim-migrate @ 13727]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11481
diff
changeset
|
1880 | g_return_if_fail(gc != NULL); |
|
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
|
1881 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
|
11485
fe334b13d1d0
[gaim-migrate @ 13727]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11481
diff
changeset
|
1882 | g_return_if_fail(prpl_info != NULL); |
|
fe334b13d1d0
[gaim-migrate @ 13727]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11481
diff
changeset
|
1883 | |
|
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
|
1884 | if (purple_strequal(chat->nick, purple_normalize(conv->account, old_user))) { |
|
11500
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1885 | const char *alias; |
|
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1886 | |
|
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1887 | /* Note this for later. */ |
|
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1888 | is_me = TRUE; |
|
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1889 | |
|
17567
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1890 | if(!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1891 | alias = purple_account_get_alias(conv->account); |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1892 | if (alias != NULL) |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1893 | new_alias = alias; |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1894 | else |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1895 | { |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1896 | const char *display_name = purple_connection_get_display_name(gc); |
|
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1897 | if (display_name != NULL) |
|
32761
4ab8a6852266
It seems to me this should be new_alias, not alias.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32698
diff
changeset
|
1898 | new_alias = display_name; |
|
17567
332ee8ac7662
don't show your own alias (half the time) when in a chatroom where no one
Nathan Walp <nwalp@pidgin.im>
parents:
17525
diff
changeset
|
1899 | } |
|
11500
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1900 | } |
|
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1901 | } else if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
| 15884 | 1902 | PurpleBuddy *buddy; |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32633
diff
changeset
|
1903 | if ((buddy = purple_find_buddy(purple_connection_get_account(gc), new_user)) != NULL) |
| 15884 | 1904 | new_alias = purple_buddy_get_contact_alias(buddy); |
|
11485
fe334b13d1d0
[gaim-migrate @ 13727]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11481
diff
changeset
|
1905 | } |
|
fe334b13d1d0
[gaim-migrate @ 13727]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11481
diff
changeset
|
1906 | |
|
18360
24a00376266d
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18193
diff
changeset
|
1907 | flags = purple_conv_chat_user_get_flags(chat, old_user); |
|
24a00376266d
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18193
diff
changeset
|
1908 | cb = purple_conv_chat_cb_new(new_user, new_alias, flags); |
|
24a00376266d
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18193
diff
changeset
|
1909 | cb->buddy = purple_find_buddy(conv->account, new_user) != NULL; |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
1910 | |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
1911 | chat->in_room = g_list_prepend(chat->in_room, cb); |
|
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
|
1912 | g_hash_table_replace(chat->users, g_strdup(cb->name), cb); |
|
18360
24a00376266d
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18193
diff
changeset
|
1913 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1914 | if (ops != NULL && ops->chat_rename_user != NULL) |
|
11485
fe334b13d1d0
[gaim-migrate @ 13727]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11481
diff
changeset
|
1915 | ops->chat_rename_user(conv, old_user, new_user, new_alias); |
| 3671 | 1916 | |
| 15884 | 1917 | cb = purple_conv_chat_cb_find(chat, old_user); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1918 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1919 | if (cb) { |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
1920 | chat->in_room = g_list_remove(chat->in_room, cb); |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
1921 | g_hash_table_remove(chat->users, cb->name); |
| 15884 | 1922 | purple_conv_chat_cb_destroy(cb); |
|
4506
e4ef1834b415
[gaim-migrate @ 4781]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
1923 | } |
|
1428
c14bab2b74bb
[gaim-migrate @ 1438]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1414
diff
changeset
|
1924 | |
| 15884 | 1925 | if (purple_conv_chat_is_user_ignored(chat, old_user)) { |
| 1926 | purple_conv_chat_unignore(chat, old_user); | |
| 1927 | purple_conv_chat_ignore(chat, new_user); | |
|
1428
c14bab2b74bb
[gaim-migrate @ 1438]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1414
diff
changeset
|
1928 | } |
| 15884 | 1929 | else if (purple_conv_chat_is_user_ignored(chat, new_user)) |
| 1930 | purple_conv_chat_unignore(chat, new_user); | |
|
1573
878f7c59ee85
[gaim-migrate @ 1583]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1532
diff
changeset
|
1931 | |
|
11500
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1932 | if (is_me) |
| 15884 | 1933 | purple_conv_chat_set_nick(chat, new_user); |
| 1934 | ||
|
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
|
1935 | if (purple_prefs_get_bool("/purple/conversations/chat/show_nick_change") && |
| 15884 | 1936 | !purple_conv_chat_is_user_ignored(chat, new_user)) { |
|
11481
498f90760488
[gaim-migrate @ 13723]
Richard Laager <rlaager@pidgin.im>
parents:
11478
diff
changeset
|
1937 | |
|
11500
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1938 | if (is_me) { |
|
12853
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1939 | char *escaped = g_markup_escape_text(new_user, -1); |
| 8158 | 1940 | g_snprintf(tmp, sizeof(tmp), |
|
12853
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1941 | _("You are now known as %s"), escaped); |
|
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1942 | g_free(escaped); |
| 8158 | 1943 | } else { |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1944 | const char *old_alias = old_user; |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1945 | const char *new_alias = new_user; |
|
12853
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1946 | char *escaped; |
|
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1947 | char *escaped2; |
| 11581 | 1948 | |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1949 | if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
| 15884 | 1950 | PurpleBuddy *buddy; |
| 1951 | ||
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32633
diff
changeset
|
1952 | if ((buddy = purple_find_buddy(purple_connection_get_account(gc), old_user)) != NULL) |
| 15884 | 1953 | old_alias = purple_buddy_get_contact_alias(buddy); |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32633
diff
changeset
|
1954 | if ((buddy = purple_find_buddy(purple_connection_get_account(gc), new_user)) != NULL) |
| 15884 | 1955 | new_alias = purple_buddy_get_contact_alias(buddy); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1956 | } |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1957 | |
|
12853
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1958 | escaped = g_markup_escape_text(old_alias, -1); |
|
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1959 | escaped2 = g_markup_escape_text(new_alias, -1); |
| 8158 | 1960 | g_snprintf(tmp, sizeof(tmp), |
|
12853
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1961 | _("%s is now known as %s"), escaped, escaped2); |
|
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1962 | g_free(escaped); |
|
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1963 | g_free(escaped2); |
| 8158 | 1964 | } |
|
1573
878f7c59ee85
[gaim-migrate @ 1583]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1532
diff
changeset
|
1965 | |
| 18090 | 1966 | purple_conversation_write(conv, NULL, tmp, |
| 1967 | PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, | |
| 1968 | time(NULL)); | |
|
2843
6dd0497437e3
[gaim-migrate @ 2856]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2834
diff
changeset
|
1969 | } |
|
6dd0497437e3
[gaim-migrate @ 2856]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2834
diff
changeset
|
1970 | } |
|
6dd0497437e3
[gaim-migrate @ 2856]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2834
diff
changeset
|
1971 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1972 | void |
| 15884 | 1973 | purple_conv_chat_remove_user(PurpleConvChat *chat, const char *user, const char *reason) |
|
2843
6dd0497437e3
[gaim-migrate @ 2856]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2834
diff
changeset
|
1974 | { |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1975 | GList *users = g_list_append(NULL, (char *)user); |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1976 | |
| 15884 | 1977 | purple_conv_chat_remove_users(chat, users, reason); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1978 | |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1979 | g_list_free(users); |
|
1759
e5987be557ab
[gaim-migrate @ 1769]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1757
diff
changeset
|
1980 | } |
|
2191
a40e37f5bf27
[gaim-migrate @ 2201]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2167
diff
changeset
|
1981 | |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1982 | void |
| 15884 | 1983 | purple_conv_chat_remove_users(PurpleConvChat *chat, GList *users, const char *reason) |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1984 | { |
| 15884 | 1985 | PurpleConversation *conv; |
| 1986 | PurpleConnection *gc; | |
| 1987 | PurplePluginProtocolInfo *prpl_info; | |
| 1988 | PurpleConversationUiOps *ops; | |
| 1989 | PurpleConvChatBuddy *cb; | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1990 | GList *l; |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1991 | gboolean quiet; |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1992 | |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1993 | g_return_if_fail(chat != NULL); |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1994 | g_return_if_fail(users != NULL); |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1995 | |
| 15884 | 1996 | conv = purple_conv_chat_get_conversation(chat); |
| 1997 | ||
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
1998 | gc = purple_conversation_get_connection(conv); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1999 | g_return_if_fail(gc != NULL); |
|
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
|
2000 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2001 | g_return_if_fail(prpl_info != NULL); |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2002 | |
| 15884 | 2003 | ops = purple_conversation_get_ui_ops(conv); |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
2004 | |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
2005 | for (l = users; l != NULL; l = l->next) { |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2006 | const char *user = (const char *)l->data; |
| 15884 | 2007 | quiet = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_conversations_get_handle(), |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2008 | "chat-buddy-leaving", conv, user, reason)) | |
| 15884 | 2009 | purple_conv_chat_is_user_ignored(chat, user); |
| 2010 | ||
| 2011 | cb = purple_conv_chat_cb_find(chat, user); | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2012 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2013 | if (cb) { |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
2014 | chat->in_room = g_list_remove(chat->in_room, cb); |
|
31908
f21c53266e55
conversation: Okay, one final fix.
Paul Aurich <darkrain42@pidgin.im>
parents:
31906
diff
changeset
|
2015 | g_hash_table_remove(chat->users, cb->name); |
| 15884 | 2016 | purple_conv_chat_cb_destroy(cb); |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
2017 | } |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2018 | |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2019 | /* NOTE: Don't remove them from ignored in case they re-enter. */ |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
2020 | |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2021 | if (!quiet) { |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2022 | const char *alias = user; |
|
23559
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
2023 | char *alias_esc; |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2024 | char *tmp; |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2025 | |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2026 | if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
| 15884 | 2027 | PurpleBuddy *buddy; |
| 2028 | ||
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32633
diff
changeset
|
2029 | if ((buddy = purple_find_buddy(purple_connection_get_account(gc), user)) != NULL) |
| 15884 | 2030 | alias = purple_buddy_get_contact_alias(buddy); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2031 | } |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2032 | |
|
23559
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
2033 | alias_esc = g_markup_escape_text(alias, -1); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2034 | |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2035 | if (reason == NULL || !*reason) |
|
23559
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
2036 | tmp = g_strdup_printf(_("%s left the room."), alias_esc); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2037 | else { |
|
23559
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
2038 | char *reason_esc = g_markup_escape_text(reason, -1); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2039 | tmp = g_strdup_printf(_("%s left the room (%s)."), |
|
23559
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
2040 | alias_esc, reason_esc); |
|
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
2041 | g_free(reason_esc); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2042 | } |
|
23559
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
2043 | g_free(alias_esc); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2044 | |
|
18088
2e08852cc6c5
use the new NO_LINKIFY flag for join and part messages
Nathan Walp <nwalp@pidgin.im>
parents:
18087
diff
changeset
|
2045 | purple_conversation_write(conv, NULL, tmp, |
|
2e08852cc6c5
use the new NO_LINKIFY flag for join and part messages
Nathan Walp <nwalp@pidgin.im>
parents:
18087
diff
changeset
|
2046 | PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, |
|
2e08852cc6c5
use the new NO_LINKIFY flag for join and part messages
Nathan Walp <nwalp@pidgin.im>
parents:
18087
diff
changeset
|
2047 | time(NULL)); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2048 | g_free(tmp); |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2049 | } |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2050 | |
| 15884 | 2051 | purple_signal_emit(purple_conversations_get_handle(), "chat-buddy-left", |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2052 | conv, user, reason); |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
2053 | } |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
2054 | |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2055 | if (ops != NULL && ops->chat_remove_users != NULL) |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
2056 | ops->chat_remove_users(conv, users); |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
2057 | } |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
2058 | |
|
6414
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
2059 | void |
| 15884 | 2060 | purple_conv_chat_clear_users(PurpleConvChat *chat) |
|
6414
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
2061 | { |
| 15884 | 2062 | PurpleConversation *conv; |
| 2063 | PurpleConversationUiOps *ops; | |
|
18187
d560300fa2ab
Re-apply a good change from 2d8ea56b90971e7851442d96b7d74ecb4f052126:
Richard Laager <rlaager@pidgin.im>
parents:
18122
diff
changeset
|
2064 | GList *users; |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
2065 | GList *l; |
|
18187
d560300fa2ab
Re-apply a good change from 2d8ea56b90971e7851442d96b7d74ecb4f052126:
Richard Laager <rlaager@pidgin.im>
parents:
18122
diff
changeset
|
2066 | GList *names = NULL; |
|
6414
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
2067 | |
|
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
2068 | g_return_if_fail(chat != NULL); |
|
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
2069 | |
| 15884 | 2070 | conv = purple_conv_chat_get_conversation(chat); |
| 2071 | ops = purple_conversation_get_ui_ops(conv); | |
|
18187
d560300fa2ab
Re-apply a good change from 2d8ea56b90971e7851442d96b7d74ecb4f052126:
Richard Laager <rlaager@pidgin.im>
parents:
18122
diff
changeset
|
2072 | users = chat->in_room; |
|
6414
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
2073 | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2074 | if (ops != NULL && ops->chat_remove_users != NULL) { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2075 | for (l = users; l; l = l->next) { |
| 15884 | 2076 | PurpleConvChatBuddy *cb = l->data; |
|
17621
2c27d0e86859
In purple_conv_chat_clear_users(), use g_list_prepend() instead of
Richard Laager <rlaager@pidgin.im>
parents:
17567
diff
changeset
|
2077 | names = g_list_prepend(names, cb->name); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2078 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2079 | ops->chat_remove_users(conv, names); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2080 | g_list_free(names); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2081 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2082 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2083 | for (l = users; l; l = l->next) |
|
6414
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
2084 | { |
| 15884 | 2085 | PurpleConvChatBuddy *cb = l->data; |
| 2086 | ||
| 2087 | purple_signal_emit(purple_conversations_get_handle(), | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2088 | "chat-buddy-leaving", conv, cb->name, NULL); |
| 15884 | 2089 | purple_signal_emit(purple_conversations_get_handle(), |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2090 | "chat-buddy-left", conv, cb->name, NULL); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2091 | |
| 15884 | 2092 | purple_conv_chat_cb_destroy(cb); |
|
6414
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
2093 | } |
|
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
2094 | |
|
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
|
2095 | g_hash_table_remove_all(chat->users); |
|
1a27482becf4
conversation: Use a copy of the name and clear hash after emitting "left" signals
Paul Aurich <darkrain42@pidgin.im>
parents:
31903
diff
changeset
|
2096 | |
|
6414
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
2097 | g_list_free(users); |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
2098 | chat->in_room = NULL; |
|
6414
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
2099 | } |
|
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
2100 | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2101 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2102 | gboolean |
| 15884 | 2103 | purple_conv_chat_find_user(PurpleConvChat *chat, const char *user) |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2104 | { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2105 | g_return_val_if_fail(chat != NULL, FALSE); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2106 | g_return_val_if_fail(user != NULL, FALSE); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2107 | |
| 15884 | 2108 | return (purple_conv_chat_cb_find(chat, user) != NULL); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2109 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2110 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2111 | void |
| 15884 | 2112 | purple_conv_chat_user_set_flags(PurpleConvChat *chat, const char *user, |
| 2113 | PurpleConvChatBuddyFlags flags) | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2114 | { |
| 15884 | 2115 | PurpleConversation *conv; |
| 2116 | PurpleConversationUiOps *ops; | |
| 2117 | PurpleConvChatBuddy *cb; | |
| 2118 | PurpleConvChatBuddyFlags oldflags; | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2119 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2120 | g_return_if_fail(chat != NULL); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2121 | g_return_if_fail(user != NULL); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2122 | |
| 15884 | 2123 | cb = purple_conv_chat_cb_find(chat, user); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2124 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2125 | if (!cb) |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2126 | return; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2127 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2128 | if (flags == cb->flags) |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2129 | return; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2130 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2131 | oldflags = cb->flags; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2132 | cb->flags = flags; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2133 | |
| 15884 | 2134 | conv = purple_conv_chat_get_conversation(chat); |
| 2135 | ops = purple_conversation_get_ui_ops(conv); | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2136 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2137 | if (ops != NULL && ops->chat_update_user != NULL) |
|
11500
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
2138 | ops->chat_update_user(conv, user); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2139 | |
| 15884 | 2140 | purple_signal_emit(purple_conversations_get_handle(), |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2141 | "chat-buddy-flags", conv, user, oldflags, flags); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2142 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2143 | |
| 15884 | 2144 | PurpleConvChatBuddyFlags |
| 2145 | purple_conv_chat_user_get_flags(PurpleConvChat *chat, const char *user) | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2146 | { |
| 15884 | 2147 | PurpleConvChatBuddy *cb; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2148 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2149 | g_return_val_if_fail(chat != NULL, 0); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2150 | g_return_val_if_fail(user != NULL, 0); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2151 | |
| 15884 | 2152 | cb = purple_conv_chat_cb_find(chat, user); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2153 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2154 | if (!cb) |
| 15884 | 2155 | return PURPLE_CBFLAGS_NONE; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2156 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2157 | return cb->flags; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2158 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2159 | |
| 15884 | 2160 | void purple_conv_chat_set_nick(PurpleConvChat *chat, const char *nick) { |
| 8158 | 2161 | g_return_if_fail(chat != NULL); |
| 2162 | ||
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
2163 | g_free(chat->nick); |
| 15884 | 2164 | chat->nick = g_strdup(purple_normalize(chat->conv->account, nick)); |
| 8158 | 2165 | } |
| 2166 | ||
| 15884 | 2167 | const char *purple_conv_chat_get_nick(PurpleConvChat *chat) { |
| 8158 | 2168 | g_return_val_if_fail(chat != NULL, NULL); |
| 2169 | ||
| 2170 | return chat->nick; | |
| 2171 | } | |
| 2172 | ||
| 15884 | 2173 | PurpleConversation * |
| 2174 | purple_find_chat(const PurpleConnection *gc, int id) | |
|
2191
a40e37f5bf27
[gaim-migrate @ 2201]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2167
diff
changeset
|
2175 | { |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
2176 | GList *l; |
| 15884 | 2177 | PurpleConversation *conv; |
| 2178 | ||
| 2179 | for (l = purple_get_chats(); l != NULL; l = l->next) { | |
| 2180 | conv = (PurpleConversation *)l->data; | |
| 2181 | ||
| 2182 | if (purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)) == id && | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
2183 | purple_conversation_get_connection(conv) == gc) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
2184 | return conv; |
|
2499
0e48d0a33bf7
[gaim-migrate @ 2512]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2487
diff
changeset
|
2185 | } |
|
0e48d0a33bf7
[gaim-migrate @ 2512]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2487
diff
changeset
|
2186 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
2187 | return NULL; |
|
2191
a40e37f5bf27
[gaim-migrate @ 2201]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2167
diff
changeset
|
2188 | } |
|
4469
ef60c820b884
[gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents:
4467
diff
changeset
|
2189 | |
| 8256 | 2190 | void |
| 15884 | 2191 | purple_conv_chat_left(PurpleConvChat *chat) |
| 8256 | 2192 | { |
| 2193 | g_return_if_fail(chat != NULL); | |
| 2194 | ||
| 2195 | chat->left = TRUE; | |
| 15884 | 2196 | purple_conversation_update(chat->conv, PURPLE_CONV_UPDATE_CHATLEFT); |
| 8256 | 2197 | } |
| 2198 | ||
|
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
|
2199 | 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
|
2200 | 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
|
2201 | { |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2202 | 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
|
2203 | PurpleConvChat *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
|
2204 | 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
|
2205 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2206 | conv = data; |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2207 | chat = PURPLE_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
|
2208 | 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
|
2209 | 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
|
2210 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
2211 | 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
|
2212 | } |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2213 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2214 | void purple_conv_chat_invite_user(PurpleConvChat *chat, const char *user, |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2215 | 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
|
2216 | { |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2217 | 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
|
2218 | 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
|
2219 | 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
|
2220 | 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
|
2221 | 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
|
2222 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2223 | 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
|
2224 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2225 | 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
|
2226 | 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
|
2227 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2228 | 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
|
2229 | 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
|
2230 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2231 | 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
|
2232 | serv_chat_invite(purple_account_get_connection(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
|
2233 | purple_conv_chat_get_id(chat), message, user); |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2234 | 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
|
2235 | } |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2236 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2237 | 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
|
2238 | 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
|
2239 | 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
|
2240 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2241 | 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
|
2242 | 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
|
2243 | 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
|
2244 | 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
|
2245 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2246 | 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
|
2247 | 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
|
2248 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2249 | 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
|
2250 | _("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
|
2251 | "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
|
2252 | 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
|
2253 | _("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
|
2254 | _("Cancel"), NULL, |
|
34332
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
2255 | purple_request_cpar_from_conversation(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
|
2256 | 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
|
2257 | } |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2258 | |
| 8256 | 2259 | gboolean |
| 15884 | 2260 | purple_conv_chat_has_left(PurpleConvChat *chat) |
| 8256 | 2261 | { |
| 2262 | g_return_val_if_fail(chat != NULL, TRUE); | |
| 2263 | ||
| 2264 | return chat->left; | |
| 2265 | } | |
|
18360
24a00376266d
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18193
diff
changeset
|
2266 | |
| 15884 | 2267 | PurpleConvChatBuddy * |
| 2268 | purple_conv_chat_cb_new(const char *name, const char *alias, PurpleConvChatBuddyFlags flags) | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2269 | { |
| 15884 | 2270 | PurpleConvChatBuddy *cb; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2271 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2272 | g_return_val_if_fail(name != NULL, NULL); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2273 | |
| 15884 | 2274 | cb = g_new0(PurpleConvChatBuddy, 1); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2275 | cb->name = g_strdup(name); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2276 | cb->flags = flags; |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
2277 | cb->alias = g_strdup(alias); |
|
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
|
2278 | cb->attributes = g_hash_table_new_full(g_str_hash, g_str_equal, |
|
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
|
2279 | g_free, g_free); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2280 | |
| 15884 | 2281 | PURPLE_DBUS_REGISTER_POINTER(cb, PurpleConvChatBuddy); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2282 | return cb; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2283 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2284 | |
| 15884 | 2285 | PurpleConvChatBuddy * |
| 2286 | purple_conv_chat_cb_find(PurpleConvChat *chat, const char *name) | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2287 | { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2288 | g_return_val_if_fail(chat != NULL, NULL); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2289 | g_return_val_if_fail(name != NULL, NULL); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2290 | |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
2291 | return g_hash_table_lookup(chat->users, name); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2292 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2293 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2294 | void |
| 15884 | 2295 | purple_conv_chat_cb_destroy(PurpleConvChatBuddy *cb) |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2296 | { |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
2297 | if (cb == NULL) |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
2298 | return; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2299 | |
|
31906
d1ffe4b1de91
Add constant-time lookup of row in the userlist by way of PurpleConvChatBuddy ui_data
Paul Aurich <darkrain42@pidgin.im>
parents:
31905
diff
changeset
|
2300 | purple_signal_emit(purple_conversations_get_handle(), |
|
d1ffe4b1de91
Add constant-time lookup of row in the userlist by way of PurpleConvChatBuddy ui_data
Paul Aurich <darkrain42@pidgin.im>
parents:
31905
diff
changeset
|
2301 | "deleting-chat-buddy", cb); |
|
d1ffe4b1de91
Add constant-time lookup of row in the userlist by way of PurpleConvChatBuddy ui_data
Paul Aurich <darkrain42@pidgin.im>
parents:
31905
diff
changeset
|
2302 | |
|
14059
0acd139472fd
[gaim-migrate @ 16582]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
14043
diff
changeset
|
2303 | g_free(cb->alias); |
|
0acd139472fd
[gaim-migrate @ 16582]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
14043
diff
changeset
|
2304 | g_free(cb->alias_key); |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
2305 | g_free(cb->name); |
|
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
|
2306 | g_hash_table_destroy(cb->attributes); |
|
11146
c56333373e3c
[gaim-migrate @ 13217]
Piotr Zielinski <zielaj@users.sourceforge.net>
parents:
11137
diff
changeset
|
2307 | |
| 15884 | 2308 | PURPLE_DBUS_UNREGISTER_POINTER(cb); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2309 | g_free(cb); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2310 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2311 | |
|
32615
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2312 | void purple_conv_chat_cb_set_ui_data(PurpleConvChatBuddy *cb, gpointer ui_data) |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2313 | { |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2314 | g_return_if_fail(cb != NULL); |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2315 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2316 | cb->ui_data = ui_data; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2317 | } |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2318 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2319 | gpointer purple_conv_chat_cb_get_ui_data(const PurpleConvChatBuddy *cb) |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2320 | { |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2321 | g_return_val_if_fail(cb != NULL, NULL); |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2322 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2323 | return cb->ui_data; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2324 | } |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2325 | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2326 | const char * |
|
32615
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2327 | purple_conv_chat_cb_get_alias(const PurpleConvChatBuddy *cb) |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2328 | { |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2329 | g_return_val_if_fail(cb != NULL, NULL); |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2330 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2331 | return cb->alias; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2332 | } |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2333 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2334 | const char * |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2335 | purple_conv_chat_cb_get_name(const PurpleConvChatBuddy *cb) |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2336 | { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2337 | g_return_val_if_fail(cb != NULL, NULL); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2338 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2339 | return cb->name; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2340 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2341 | |
|
32615
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2342 | PurpleConvChatBuddyFlags |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2343 | purple_conv_chat_cb_get_flags(const PurpleConvChatBuddy *cb) |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2344 | { |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2345 | g_return_val_if_fail(cb != NULL, PURPLE_CBFLAGS_NONE); |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2346 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2347 | return cb->flags; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2348 | } |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2349 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2350 | gboolean purple_conv_chat_cb_is_buddy(const PurpleConvChatBuddy *cb) |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2351 | { |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2352 | g_return_val_if_fail(cb != NULL, FALSE); |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2353 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2354 | return cb->buddy; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2355 | } |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2356 | |
|
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
|
2357 | const char * |
|
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
|
2358 | purple_conv_chat_cb_get_attribute(PurpleConvChatBuddy *cb, const char *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
|
2359 | { |
|
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
|
2360 | g_return_val_if_fail(cb != NULL, NULL); |
|
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
|
2361 | g_return_val_if_fail(key != NULL, NULL); |
|
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
|
2362 | |
|
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
|
2363 | return g_hash_table_lookup(cb->attributes, 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
|
2364 | } |
|
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
|
2365 | |
|
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
|
2366 | 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
|
2367 | 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
|
2368 | { |
|
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
|
2369 | 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
|
2370 | *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
|
2371 | } |
|
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
|
2372 | |
|
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
|
2373 | GList * |
|
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
|
2374 | purple_conv_chat_cb_get_attribute_keys(PurpleConvChatBuddy *cb) |
|
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
|
2375 | { |
|
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
|
2376 | GList *keys = NULL; |
|
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
|
2377 | |
|
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
|
2378 | g_return_val_if_fail(cb != NULL, NULL); |
|
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
|
2379 | |
|
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
|
2380 | g_hash_table_foreach(cb->attributes, (GHFunc)append_attribute_key, &keys); |
|
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
|
2381 | |
|
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
|
2382 | return keys; |
|
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
|
2383 | } |
|
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
|
2384 | |
|
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
|
2385 | 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
|
2386 | purple_conv_chat_cb_set_attribute(PurpleConvChat *chat, PurpleConvChatBuddy *cb, const char *key, const char *value) |
|
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
|
2387 | { |
|
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
|
2388 | PurpleConversation *conv; |
|
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
|
2389 | PurpleConversationUiOps *ops; |
|
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
|
2390 | |
|
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
|
2391 | g_return_if_fail(cb != NULL); |
|
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
|
2392 | g_return_if_fail(key != NULL); |
|
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
|
2393 | g_return_if_fail(value != NULL); |
|
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
|
2394 | |
|
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
|
2395 | g_hash_table_replace(cb->attributes, g_strdup(key), g_strdup(value)); |
|
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
|
2396 | |
|
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
|
2397 | conv = purple_conv_chat_get_conversation(chat); |
|
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
|
2398 | ops = purple_conversation_get_ui_ops(conv); |
|
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
|
2399 | |
|
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
|
2400 | if (ops != NULL && ops->chat_update_user != NULL) |
|
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
|
2401 | ops->chat_update_user(conv, cb->name); |
|
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
|
2402 | } |
|
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
|
2403 | |
|
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
|
2404 | 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
|
2405 | purple_conv_chat_cb_set_attributes(PurpleConvChat *chat, PurpleConvChatBuddy *cb, GList *keys, GList *values) |
|
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
|
2406 | { |
|
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
|
2407 | PurpleConversation *conv; |
|
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
|
2408 | PurpleConversationUiOps *ops; |
|
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
|
2409 | |
|
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
|
2410 | g_return_if_fail(cb != NULL); |
|
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
|
2411 | g_return_if_fail(keys != NULL); |
|
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
|
2412 | g_return_if_fail(values != NULL); |
|
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
|
2413 | |
|
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
|
2414 | while (keys != NULL && values != NULL) { |
|
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
|
2415 | g_hash_table_replace(cb->attributes, g_strdup(keys->data), g_strdup(values->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
|
2416 | keys = g_list_next(keys); |
|
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
|
2417 | values = g_list_next(values); |
|
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
|
2418 | } |
|
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
|
2419 | |
|
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
|
2420 | conv = purple_conv_chat_get_conversation(chat); |
|
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
|
2421 | ops = purple_conversation_get_ui_ops(conv); |
|
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
|
2422 | |
|
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
|
2423 | if (ops != NULL && ops->chat_update_user != NULL) |
|
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
|
2424 | ops->chat_update_user(conv, cb->name); |
|
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
|
2425 | } |
|
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
|
2426 | |
|
17265
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2427 | GList * |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2428 | 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
|
2429 | { |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2430 | GList *menu = NULL; |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2431 | |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2432 | 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
|
2433 | |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2434 | 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
|
2435 | "conversation-extended-menu", conv, &menu); |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2436 | return menu; |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2437 | } |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2438 | |
|
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
|
2439 | 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
|
2440 | { |
|
19904
8abf4c2056eb
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2441 | 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
|
2442 | message_history_free(list); |
|
19904
8abf4c2056eb
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2443 | 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
|
2444 | |
|
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31602
diff
changeset
|
2445 | 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
|
2446 | "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
|
2447 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2448 | |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2449 | 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
|
2450 | { |
|
19904
8abf4c2056eb
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2451 | 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
|
2452 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2453 | |
|
32690
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2454 | const char *purple_conversation_message_get_sender(const PurpleConvMessage *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
|
2455 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2456 | 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
|
2457 | 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
|
2458 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2459 | |
|
32690
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2460 | const char *purple_conversation_message_get_message(const PurpleConvMessage *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
|
2461 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2462 | 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
|
2463 | 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
|
2464 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2465 | |
|
32690
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2466 | PurpleMessageFlags purple_conversation_message_get_flags(const PurpleConvMessage *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
|
2467 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2468 | 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
|
2469 | 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
|
2470 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2471 | |
|
32690
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2472 | time_t purple_conversation_message_get_timestamp(const PurpleConvMessage *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
|
2473 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2474 | 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
|
2475 | 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
|
2476 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2477 | |
|
32690
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2478 | const char *purple_conversation_message_get_alias(const PurpleConvMessage *msg) |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2479 | { |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2480 | g_return_val_if_fail(msg, NULL); |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2481 | return msg->alias; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2482 | } |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2483 | |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2484 | PurpleConversation *purple_conversation_message_get_conv(const PurpleConvMessage *msg) |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2485 | { |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2486 | g_return_val_if_fail(msg, NULL); |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2487 | return msg->conv; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2488 | } |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2489 | |
|
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
|
2490 | 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
|
2491 | { |
|
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
|
2492 | 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
|
2493 | |
|
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
|
2494 | 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
|
2495 | } |
|
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
|
2496 | |
|
32256
620e4580252a
These pointers should rather be marked const.
Andrew Victor <andrew.victor@mxit.com>
parents:
32253
diff
changeset
|
2497 | 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
|
2498 | { |
|
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
|
2499 | 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
|
2500 | |
|
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
|
2501 | 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
|
2502 | } |
|
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
|
2503 | |
|
33578
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2504 | |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2505 | gboolean |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2506 | purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline, |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2507 | const gchar *markup, gchar **error) |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2508 | { |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2509 | 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
|
2510 | 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
|
2511 | g_free(mark); |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2512 | g_free(err); |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2513 | return (status == PURPLE_CMD_STATUS_OK); |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2514 | } |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2515 | |
|
34321
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2516 | gssize |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2517 | purple_conversation_get_max_message_size(PurpleConversation *conv) |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2518 | { |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2519 | PurplePlugin *prpl; |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2520 | PurplePluginProtocolInfo *prpl_info; |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2521 | |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2522 | g_return_val_if_fail(conv != NULL, 0); |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2523 | |
|
34322
39acbde408f3
Fix compilation error
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34321
diff
changeset
|
2524 | prpl = purple_connection_get_prpl( |
|
39acbde408f3
Fix compilation error
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34321
diff
changeset
|
2525 | purple_conversation_get_connection(conv)); |
|
34321
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2526 | g_return_val_if_fail(prpl != NULL, 0); |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2527 | |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2528 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2529 | g_return_val_if_fail(prpl_info != NULL, 0); |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2530 | |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2531 | if (!PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_max_message_size)) |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2532 | return 0; |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2533 | |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2534 | return prpl_info->get_max_message_size(conv); |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2535 | } |
|
f60fcab02bd4
Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33578
diff
changeset
|
2536 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2537 | void * |
| 15884 | 2538 | purple_conversations_get_handle(void) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2539 | { |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2540 | static int handle; |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2541 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2542 | return &handle; |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2543 | } |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2544 | |
| 5858 | 2545 | void |
| 15884 | 2546 | purple_conversations_init(void) |
| 5858 | 2547 | { |
| 15884 | 2548 | void *handle = purple_conversations_get_handle(); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2549 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
2550 | conversation_cache = g_hash_table_new_full((GHashFunc)_purple_conversations_hconv_hash, |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
2551 | (GEqualFunc)_purple_conversations_hconv_equal, |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
2552 | (GDestroyNotify)_purple_conversations_hconv_free_key, NULL); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
2553 | |
|
6846
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
2554 | /********************************************************************** |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
2555 | * Register preferences |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
2556 | **********************************************************************/ |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2557 | |
| 5858 | 2558 | /* Conversations */ |
|
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
|
2559 | purple_prefs_add_none("/purple/conversations"); |
| 5858 | 2560 | |
| 2561 | /* Conversations -> Chat */ | |
|
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
|
2562 | purple_prefs_add_none("/purple/conversations/chat"); |
|
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
|
2563 | purple_prefs_add_bool("/purple/conversations/chat/show_nick_change", TRUE); |
| 5858 | 2564 | |
| 2565 | /* Conversations -> IM */ | |
|
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
|
2566 | purple_prefs_add_none("/purple/conversations/im"); |
|
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
|
2567 | purple_prefs_add_bool("/purple/conversations/im/send_typing", TRUE); |
| 5858 | 2568 | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2569 | |
|
6846
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
2570 | /********************************************************************** |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
2571 | * Register signals |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
2572 | **********************************************************************/ |
| 15884 | 2573 | purple_signal_register(handle, "writing-im-msg", |
|
18744
e6b4c7abe951
Fix up writing-im-msg and writing-chat-msg to use a marshaller which treats the
Will Thompson <resiak@pidgin.im>
parents:
18360
diff
changeset
|
2574 | purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT, |
| 15884 | 2575 | purple_value_new(PURPLE_TYPE_BOOLEAN), 5, |
| 2576 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2577 | PURPLE_SUBTYPE_ACCOUNT), | |
| 2578 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2579 | purple_value_new_outgoing(PURPLE_TYPE_STRING), | |
| 2580 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2581 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2582 | purple_value_new(PURPLE_TYPE_UINT)); | |
| 2583 | ||
| 2584 | purple_signal_register(handle, "wrote-im-msg", | |
| 2585 | purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, | |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
2586 | NULL, 5, |
| 15884 | 2587 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
| 2588 | PURPLE_SUBTYPE_ACCOUNT), | |
| 2589 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2590 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2591 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2592 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2593 | purple_value_new(PURPLE_TYPE_UINT)); | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30706
diff
changeset
|
2594 | |
|
24457
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2595 | purple_signal_register(handle, "sent-attention", |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2596 | purple_marshal_VOID__POINTER_POINTER_POINTER_UINT, |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2597 | NULL, 4, |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2598 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2599 | PURPLE_SUBTYPE_ACCOUNT), |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2600 | purple_value_new(PURPLE_TYPE_STRING), |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2601 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2602 | PURPLE_SUBTYPE_CONVERSATION), |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2603 | purple_value_new(PURPLE_TYPE_UINT)); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30706
diff
changeset
|
2604 | |
|
24457
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2605 | purple_signal_register(handle, "got-attention", |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2606 | purple_marshal_VOID__POINTER_POINTER_POINTER_UINT, |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2607 | NULL, 4, |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2608 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2609 | PURPLE_SUBTYPE_ACCOUNT), |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2610 | purple_value_new(PURPLE_TYPE_STRING), |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2611 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2612 | PURPLE_SUBTYPE_CONVERSATION), |
|
adbbdb0532b0
Adds attention UI to Pidgin (can send attentions using a menu item)
Marcus Lundblad <malu@pidgin.im>
parents:
24051
diff
changeset
|
2613 | purple_value_new(PURPLE_TYPE_UINT)); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30706
diff
changeset
|
2614 | |
| 15884 | 2615 | purple_signal_register(handle, "sending-im-msg", |
| 2616 | purple_marshal_VOID__POINTER_POINTER_POINTER, | |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
2617 | NULL, 3, |
| 15884 | 2618 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
| 2619 | PURPLE_SUBTYPE_ACCOUNT), | |
| 2620 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2621 | purple_value_new_outgoing(PURPLE_TYPE_STRING)); | |
| 2622 | ||
| 2623 | purple_signal_register(handle, "sent-im-msg", | |
| 2624 | purple_marshal_VOID__POINTER_POINTER_POINTER, | |
|
6564
a7a2c1927544
[gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
2625 | NULL, 3, |
| 15884 | 2626 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
| 2627 | PURPLE_SUBTYPE_ACCOUNT), | |
| 2628 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2629 | purple_value_new(PURPLE_TYPE_STRING)); | |
| 2630 | ||
| 2631 | purple_signal_register(handle, "receiving-im-msg", | |
| 2632 | purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, | |
| 2633 | purple_value_new(PURPLE_TYPE_BOOLEAN), 5, | |
| 2634 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2635 | PURPLE_SUBTYPE_ACCOUNT), | |
| 2636 | purple_value_new_outgoing(PURPLE_TYPE_STRING), | |
| 2637 | purple_value_new_outgoing(PURPLE_TYPE_STRING), | |
| 2638 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2639 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2640 | purple_value_new_outgoing(PURPLE_TYPE_UINT)); | |
| 2641 | ||
| 2642 | purple_signal_register(handle, "received-im-msg", | |
| 2643 | purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, | |
|
10104
081392879815
[gaim-migrate @ 11131]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10087
diff
changeset
|
2644 | NULL, 5, |
| 15884 | 2645 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
| 2646 | PURPLE_SUBTYPE_ACCOUNT), | |
| 2647 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2648 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2649 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2650 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2651 | purple_value_new(PURPLE_TYPE_UINT)); | |
| 2652 | ||
|
23312
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2653 | purple_signal_register(handle, "blocked-im-msg", |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2654 | purple_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT, |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2655 | NULL, 5, |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2656 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2657 | PURPLE_SUBTYPE_ACCOUNT), |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2658 | purple_value_new(PURPLE_TYPE_STRING), |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2659 | purple_value_new(PURPLE_TYPE_STRING), |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2660 | purple_value_new(PURPLE_TYPE_UINT), |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2661 | purple_value_new(PURPLE_TYPE_UINT)); |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2662 | |
| 15884 | 2663 | purple_signal_register(handle, "writing-chat-msg", |
|
18744
e6b4c7abe951
Fix up writing-im-msg and writing-chat-msg to use a marshaller which treats the
Will Thompson <resiak@pidgin.im>
parents:
18360
diff
changeset
|
2664 | purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT, |
| 15884 | 2665 | purple_value_new(PURPLE_TYPE_BOOLEAN), 5, |
| 2666 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2667 | PURPLE_SUBTYPE_ACCOUNT), | |
| 2668 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2669 | purple_value_new_outgoing(PURPLE_TYPE_STRING), | |
| 2670 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2671 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2672 | purple_value_new(PURPLE_TYPE_UINT)); | |
| 2673 | ||
| 2674 | purple_signal_register(handle, "wrote-chat-msg", | |
| 2675 | purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, | |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
2676 | NULL, 5, |
| 15884 | 2677 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
| 2678 | PURPLE_SUBTYPE_ACCOUNT), | |
| 2679 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2680 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2681 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2682 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2683 | purple_value_new(PURPLE_TYPE_UINT)); | |
| 2684 | ||
| 2685 | purple_signal_register(handle, "sending-chat-msg", | |
| 2686 | purple_marshal_VOID__POINTER_POINTER_UINT, NULL, 3, | |
| 2687 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2688 | PURPLE_SUBTYPE_ACCOUNT), | |
| 2689 | purple_value_new_outgoing(PURPLE_TYPE_STRING), | |
| 2690 | purple_value_new(PURPLE_TYPE_UINT)); | |
| 2691 | ||
| 2692 | purple_signal_register(handle, "sent-chat-msg", | |
| 2693 | purple_marshal_VOID__POINTER_POINTER_UINT, NULL, 3, | |
| 2694 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2695 | PURPLE_SUBTYPE_ACCOUNT), | |
| 2696 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2697 | purple_value_new(PURPLE_TYPE_UINT)); | |
| 2698 | ||
| 2699 | purple_signal_register(handle, "receiving-chat-msg", | |
| 2700 | purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, | |
| 2701 | purple_value_new(PURPLE_TYPE_BOOLEAN), 5, | |
| 2702 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2703 | PURPLE_SUBTYPE_ACCOUNT), | |
| 2704 | purple_value_new_outgoing(PURPLE_TYPE_STRING), | |
| 2705 | purple_value_new_outgoing(PURPLE_TYPE_STRING), | |
| 2706 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2707 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2708 | purple_value_new_outgoing(PURPLE_TYPE_UINT)); | |
| 2709 | ||
| 2710 | purple_signal_register(handle, "received-chat-msg", | |
| 2711 | purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, | |
|
10104
081392879815
[gaim-migrate @ 11131]
Nathan Fredrickson <nathan@silverorange.com>
parents:
10087
diff
changeset
|
2712 | NULL, 5, |
| 15884 | 2713 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
| 2714 | PURPLE_SUBTYPE_ACCOUNT), | |
| 2715 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2716 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2717 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2718 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2719 | purple_value_new(PURPLE_TYPE_UINT)); | |
| 2720 | ||
| 2721 | purple_signal_register(handle, "conversation-created", | |
| 2722 | purple_marshal_VOID__POINTER, NULL, 1, | |
| 2723 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2724 | PURPLE_SUBTYPE_CONVERSATION)); | |
| 2725 | ||
| 2726 | purple_signal_register(handle, "conversation-updated", | |
| 2727 | purple_marshal_VOID__POINTER_UINT, NULL, 2, | |
| 2728 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2729 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2730 | purple_value_new(PURPLE_TYPE_UINT)); | |
| 2731 | ||
| 2732 | purple_signal_register(handle, "deleting-conversation", | |
| 2733 | purple_marshal_VOID__POINTER, NULL, 1, | |
| 2734 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2735 | PURPLE_SUBTYPE_CONVERSATION)); | |
| 2736 | ||
| 2737 | purple_signal_register(handle, "buddy-typing", | |
| 2738 | purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
| 2739 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2740 | PURPLE_SUBTYPE_ACCOUNT), | |
| 2741 | purple_value_new(PURPLE_TYPE_STRING)); | |
| 2742 | ||
| 2743 | purple_signal_register(handle, "buddy-typed", | |
| 2744 | purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
| 2745 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2746 | PURPLE_SUBTYPE_ACCOUNT), | |
| 2747 | purple_value_new(PURPLE_TYPE_STRING)); | |
| 2748 | ||
| 2749 | purple_signal_register(handle, "buddy-typing-stopped", | |
| 2750 | purple_marshal_VOID__POINTER_POINTER, NULL, 2, | |
| 2751 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2752 | PURPLE_SUBTYPE_ACCOUNT), | |
| 2753 | purple_value_new(PURPLE_TYPE_STRING)); | |
| 2754 | ||
| 2755 | purple_signal_register(handle, "chat-buddy-joining", | |
| 2756 | purple_marshal_BOOLEAN__POINTER_POINTER_UINT, | |
| 2757 | purple_value_new(PURPLE_TYPE_BOOLEAN), 3, | |
| 2758 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2759 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2760 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2761 | purple_value_new(PURPLE_TYPE_UINT)); | |
| 2762 | ||
| 2763 | purple_signal_register(handle, "chat-buddy-joined", | |
| 2764 | purple_marshal_VOID__POINTER_POINTER_UINT_UINT, NULL, 4, | |
| 2765 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2766 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2767 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2768 | purple_value_new(PURPLE_TYPE_UINT), | |
| 2769 | purple_value_new(PURPLE_TYPE_BOOLEAN)); | |
| 2770 | ||
| 2771 | purple_signal_register(handle, "chat-buddy-flags", | |
| 2772 | purple_marshal_VOID__POINTER_POINTER_UINT_UINT, NULL, 4, | |
| 2773 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2774 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2775 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2776 | purple_value_new(PURPLE_TYPE_UINT), | |
| 2777 | purple_value_new(PURPLE_TYPE_UINT)); | |
| 2778 | ||
| 2779 | purple_signal_register(handle, "chat-buddy-leaving", | |
| 2780 | purple_marshal_BOOLEAN__POINTER_POINTER_POINTER, | |
| 2781 | purple_value_new(PURPLE_TYPE_BOOLEAN), 3, | |
| 2782 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2783 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2784 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2785 | purple_value_new(PURPLE_TYPE_STRING)); | |
| 2786 | ||
| 2787 | purple_signal_register(handle, "chat-buddy-left", | |
| 2788 | purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, | |
| 2789 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2790 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2791 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2792 | purple_value_new(PURPLE_TYPE_STRING)); | |
| 2793 | ||
|
31906
d1ffe4b1de91
Add constant-time lookup of row in the userlist by way of PurpleConvChatBuddy ui_data
Paul Aurich <darkrain42@pidgin.im>
parents:
31905
diff
changeset
|
2794 | purple_signal_register(handle, "deleting-chat-buddy", |
|
d1ffe4b1de91
Add constant-time lookup of row in the userlist by way of PurpleConvChatBuddy ui_data
Paul Aurich <darkrain42@pidgin.im>
parents:
31905
diff
changeset
|
2795 | purple_marshal_VOID__POINTER, NULL, 1, |
|
d1ffe4b1de91
Add constant-time lookup of row in the userlist by way of PurpleConvChatBuddy ui_data
Paul Aurich <darkrain42@pidgin.im>
parents:
31905
diff
changeset
|
2796 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
|
d1ffe4b1de91
Add constant-time lookup of row in the userlist by way of PurpleConvChatBuddy ui_data
Paul Aurich <darkrain42@pidgin.im>
parents:
31905
diff
changeset
|
2797 | PURPLE_SUBTYPE_CHATBUDDY)); |
|
d1ffe4b1de91
Add constant-time lookup of row in the userlist by way of PurpleConvChatBuddy ui_data
Paul Aurich <darkrain42@pidgin.im>
parents:
31905
diff
changeset
|
2798 | |
| 15884 | 2799 | purple_signal_register(handle, "chat-inviting-user", |
| 2800 | purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, | |
| 2801 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2802 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2803 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2804 | purple_value_new_outgoing(PURPLE_TYPE_STRING)); | |
| 2805 | ||
| 2806 | purple_signal_register(handle, "chat-invited-user", | |
| 2807 | purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, | |
| 2808 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2809 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2810 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2811 | purple_value_new(PURPLE_TYPE_STRING)); | |
| 2812 | ||
| 2813 | purple_signal_register(handle, "chat-invited", | |
| 2814 | purple_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER, | |
|
20420
74b2d096bfe2
chat-invited handlers return an interger value.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19904
diff
changeset
|
2815 | purple_value_new(PURPLE_TYPE_INT), 5, |
| 15884 | 2816 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
| 2817 | PURPLE_SUBTYPE_ACCOUNT), | |
| 2818 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2819 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2820 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2821 | purple_value_new(PURPLE_TYPE_POINTER)); | |
| 2822 | ||
|
23312
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2823 | purple_signal_register(handle, "chat-invite-blocked", |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2824 | purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER, |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2825 | NULL, 5, |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2826 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2827 | PURPLE_SUBTYPE_ACCOUNT), |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2828 | purple_value_new(PURPLE_TYPE_STRING), |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2829 | purple_value_new(PURPLE_TYPE_STRING), |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2830 | purple_value_new(PURPLE_TYPE_STRING), |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2831 | purple_value_new(PURPLE_TYPE_BOXED, "GHashTable *")); |
|
0530decb56e4
Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23278
diff
changeset
|
2832 | |
| 15884 | 2833 | purple_signal_register(handle, "chat-joined", |
| 2834 | purple_marshal_VOID__POINTER, NULL, 1, | |
| 2835 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2836 | PURPLE_SUBTYPE_CONVERSATION)); | |
| 2837 | ||
|
22920
6681f6f71dfc
applied changes from feb2303b4209e0eeb4e20beaf151b1e4368c4e03
Evan Schoenberg <evands@pidgin.im>
parents:
22918
diff
changeset
|
2838 | purple_signal_register(handle, "chat-join-failed", |
|
6681f6f71dfc
applied changes from feb2303b4209e0eeb4e20beaf151b1e4368c4e03
Evan Schoenberg <evands@pidgin.im>
parents:
22918
diff
changeset
|
2839 | purple_marshal_VOID__POINTER_POINTER, NULL, 2, |
|
6681f6f71dfc
applied changes from feb2303b4209e0eeb4e20beaf151b1e4368c4e03
Evan Schoenberg <evands@pidgin.im>
parents:
22918
diff
changeset
|
2840 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
|
6681f6f71dfc
applied changes from feb2303b4209e0eeb4e20beaf151b1e4368c4e03
Evan Schoenberg <evands@pidgin.im>
parents:
22918
diff
changeset
|
2841 | PURPLE_SUBTYPE_CONNECTION), |
|
23270
2b7db16e721a
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evands@pidgin.im>
parents:
22920
diff
changeset
|
2842 | purple_value_new(PURPLE_TYPE_POINTER)); |
|
22920
6681f6f71dfc
applied changes from feb2303b4209e0eeb4e20beaf151b1e4368c4e03
Evan Schoenberg <evands@pidgin.im>
parents:
22918
diff
changeset
|
2843 | |
| 15884 | 2844 | purple_signal_register(handle, "chat-left", |
| 2845 | purple_marshal_VOID__POINTER, NULL, 1, | |
| 2846 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2847 | PURPLE_SUBTYPE_CONVERSATION)); | |
| 2848 | ||
| 2849 | purple_signal_register(handle, "chat-topic-changed", | |
| 2850 | purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, | |
| 2851 | purple_value_new(PURPLE_TYPE_SUBTYPE, | |
| 2852 | PURPLE_SUBTYPE_CONVERSATION), | |
| 2853 | purple_value_new(PURPLE_TYPE_STRING), | |
| 2854 | purple_value_new(PURPLE_TYPE_STRING)); | |
|
17265
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2855 | |
|
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
|
2856 | purple_signal_register(handle, "cleared-message-history", |
|
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31602
diff
changeset
|
2857 | purple_marshal_VOID__POINTER, NULL, 1, |
|
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31602
diff
changeset
|
2858 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
|
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31602
diff
changeset
|
2859 | PURPLE_SUBTYPE_CONVERSATION)); |
|
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31602
diff
changeset
|
2860 | |
|
17265
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2861 | purple_signal_register(handle, "conversation-extended-menu", |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2862 | purple_marshal_VOID__POINTER_POINTER, NULL, 2, |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2863 | purple_value_new(PURPLE_TYPE_SUBTYPE, |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2864 | PURPLE_SUBTYPE_CONVERSATION), |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2865 | purple_value_new(PURPLE_TYPE_BOXED, "GList **")); |
| 5858 | 2866 | } |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2867 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2868 | void |
| 15884 | 2869 | purple_conversations_uninit(void) |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2870 | { |
|
9909
b13c36f7d52b
[gaim-migrate @ 10801]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9846
diff
changeset
|
2871 | while (conversations) |
| 15884 | 2872 | purple_conversation_destroy((PurpleConversation*)conversations->data); |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
2873 | g_hash_table_destroy(conversation_cache); |
| 15884 | 2874 | purple_signals_unregister_by_instance(purple_conversations_get_handle()); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
2875 | } |
|
19904
8abf4c2056eb
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2876 |