Fri, 21 Jun 2013 23:11:45 +0530
Added GObject structures, moved things around, renamed functions as GObject methods.
* Added GObject instance, class and private structures for:
- PurpleChatConversation, subclassing PurpleConversation
- PurpleIMConversation, subclassing PurpleConversation
- PurpleChatConversationBuddy
- PurpleConversationMessage
* Renamed purple_chat_conversation_cb_ functions to purple_chat_conversation_buddy_ methods for PurpleChatConversationBuddy
* Renamed purple_find_conversation_with_account() to purple_conversations_find_with_account(), in conversations API
* Renamed purple_conv_ functions to purple_conversation_
* Renamed purple_conversation_present_error() to purple_conversation_helper_present_error since it's not a PurpleConversation method
* Renamed purple_chat_conversation_is_user_ignored() to purple_chat_conversation_is_ignored_user(), to match with other ignore API
* Renamed purple_chat_conversation_left() to purple_chat_conversation_leave()
| 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 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
38 | /** @copydoc _PurpleConversationPrivate */ |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
39 | typedef struct _PurpleConversationPrivate PurpleConversationPrivate; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
40 | /** @copydoc _PurpleChatConversationPrivate */ |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
41 | typedef struct _PurpleChatConversationPrivate PurpleChatConversationPrivate; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
42 | /** @copydoc _PurpleIMConversationPrivate */ |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
43 | typedef struct _PurpleIMConversationPrivate PurpleIMConversationPrivate; |
|
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
44 | /** @copydoc _PurpleChatConversationBuddyPrivate */ |
|
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
45 | typedef struct _PurpleChatConversationBuddyPrivate PurpleChatConversationBuddyPrivate; |
|
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
46 | /** @copydoc _PurpleConversationMessagePrivate */ |
|
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
47 | typedef struct _PurpleConversationMessagePrivate PurpleConversationMessagePrivate; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
48 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
49 | /** |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
50 | * A core representation of a conversation between two or more people. |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
51 | * |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
52 | * The conversation can be an IM or a chat. |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
53 | */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
54 | struct _PurpleConversationPrivate |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
55 | { |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
56 | PurpleConversationType type; /**< The type of conversation. */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
57 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
58 | PurpleAccount *account; /**< The user using this conversation. */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
59 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
60 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
61 | char *name; /**< The name of the conversation. */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
62 | char *title; /**< The window title. */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
63 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
64 | gboolean logging; /**< The status of logging. */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
65 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
66 | GList *logs; /**< This conversation's logs */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
67 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
68 | PurpleConversationUiOps *ui_ops; /**< UI-specific operations. */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
69 | void *ui_data; /**< UI-specific data. */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
70 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
71 | GHashTable *data; /**< Plugin-specific data. */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
72 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
73 | PurpleConnectionFlags features; /**< The supported features */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
74 | GList *message_history; /**< Message history, as a GList of PurpleConversationMessage's */ |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
75 | }; |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
76 | |
|
32613
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
77 | /** |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
78 | * Data specific to Chats. |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
79 | */ |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
80 | struct _PurpleChatConversationPrivate |
|
32613
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
81 | { |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
82 | GList *in_room; /**< The users in the room. |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
83 | * @deprecated Will be removed in 3.0.0 TODO |
|
32613
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
84 | */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
85 | GList *ignored; /**< Ignored users. */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
86 | char *who; /**< The person who set the topic. */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
87 | char *topic; /**< The topic. */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
88 | int id; /**< The chat ID. */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
89 | char *nick; /**< Your nick in this chat. */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
90 | |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
91 | 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
|
92 | GHashTable *users; /**< Hash table of the users in the room. */ |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
93 | }; |
|
cc59a239bdb9
Hide struct _PurpleConvChat.
Andrew Victor <andrew.victor@mxit.com>
parents:
32336
diff
changeset
|
94 | |
|
32614
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
95 | /** |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
96 | * Data specific to Instant Messages. |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
97 | */ |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
98 | struct _PurpleIMConversationPrivate |
|
32614
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
99 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
100 | PurpleIMConversationTypingState typing_state; /**< The current typing state. */ |
|
32614
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
101 | guint typing_timeout; /**< The typing timer handle. */ |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
102 | time_t type_again; /**< The type again time. */ |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
103 | guint send_typed_timeout; /**< The type again timer handle. */ |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
104 | |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
105 | PurpleBuddyIcon *icon; /**< The buddy icon. */ |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
106 | }; |
|
bd51e25ab7b6
Hide struct _PurpleConvIm.
Andrew Victor <andrew.victor@mxit.com>
parents:
32613
diff
changeset
|
107 | |
|
32615
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 | * Data for "Chat Buddies" |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
110 | */ |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
111 | struct _PurpleChatConversationBuddyPrivate |
|
32615
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
112 | { |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
113 | /** The chat participant's name in the chat. */ |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
114 | char *name; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
115 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
116 | /** The chat participant's alias, if known; @a NULL otherwise. */ |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
117 | char *alias; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
118 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
119 | /** |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
120 | * 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
|
121 | * 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
|
122 | * @c NULL. |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
123 | */ |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
124 | char *alias_key; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
125 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
126 | /** |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
127 | * @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
|
128 | * @a FALSE otherwise. |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
129 | */ |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
130 | gboolean buddy; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
131 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
132 | /** |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
133 | * 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
|
134 | * are a channel operator. |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
135 | */ |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
136 | PurpleChatConversationBuddyFlags flags; |
|
32615
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
137 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
138 | /** |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
139 | * 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
|
140 | * user\@host, etc. |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
141 | */ |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
142 | GHashTable *attributes; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
143 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
144 | /** The UI can put whatever it wants here. */ |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
145 | gpointer ui_data; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
146 | }; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
147 | |
|
32621
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 | * Description of a conversation message |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
150 | */ |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
151 | struct _PurpleConversationMessagePrivate |
|
32690
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
152 | { |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
153 | char *who; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
154 | char *what; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
155 | PurpleConversationMessageFlags flags; |
|
32690
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
156 | time_t when; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
157 | PurpleConversation *conv; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
158 | char *alias; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
159 | }; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
160 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
161 | /** |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
162 | * 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
|
163 | * struct _purple_hconv => PurpleConversation* |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
164 | */ |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
165 | static GHashTable *conversation_cache = NULL; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
166 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
167 | struct _purple_hconv { |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
168 | PurpleConversationType type; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
169 | char *name; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
170 | const PurpleAccount *account; |
|
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 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
173 | 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
|
174 | { |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
175 | 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
|
176 | } |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
177 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
178 | 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
|
179 | { |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
180 | return (hc1->type == hc2->type && |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
181 | hc1->account == hc2->account && |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
182 | 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
|
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 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
|
186 | { |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
187 | g_free(hc->name); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
188 | g_free(hc); |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
189 | } |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
190 | |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
191 | 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
|
192 | { |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
193 | 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
|
194 | gchar *collated; |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
195 | guint hash; |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
196 | |
|
31909
6367f2188824
conversation: Use the right comparison type (case-sensitive) for the hash table
Paul Aurich <darkrain42@pidgin.im>
parents:
31908
diff
changeset
|
197 | 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
|
198 | hash = g_str_hash(collated); |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
199 | g_free(collated); |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
200 | return hash; |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
201 | } |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
202 | |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
203 | 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
|
204 | { |
|
31909
6367f2188824
conversation: Use the right comparison type (case-sensitive) for the hash table
Paul Aurich <darkrain42@pidgin.im>
parents:
31908
diff
changeset
|
205 | 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
|
206 | } |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
207 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
208 | static gboolean |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
209 | reset_typing_cb(gpointer data) |
| 66 | 210 | { |
| 15884 | 211 | PurpleConversation *c = (PurpleConversation *)data; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
212 | PurpleIMConversationPrivate *priv; |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
213 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
214 | im = PURPLE_IM_CONVERSATION_GET_PRIVATE(c); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
215 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
216 | purple_im_conversation_set_typing_state(im, PURPLE_IM_CONVERSATION_NOT_TYPING); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
217 | purple_im_conversation_stop_typing_timeout(im); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
218 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
219 | return FALSE; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
220 | } |
| 3159 | 221 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
222 | static gboolean |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
223 | send_typed_cb(gpointer data) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
224 | { |
| 15884 | 225 | PurpleConversation *conv = (PurpleConversation *)data; |
| 226 | PurpleConnection *gc; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
227 | const char *name; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
228 | |
|
13714
babc08c1c499
[gaim-migrate @ 16116]
Richard Laager <rlaager@pidgin.im>
parents:
13664
diff
changeset
|
229 | g_return_val_if_fail(conv != NULL, FALSE); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
230 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
231 | gc = purple_conversation_get_connection(conv); |
| 15884 | 232 | name = purple_conversation_get_name(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
233 | |
|
13714
babc08c1c499
[gaim-migrate @ 16116]
Richard Laager <rlaager@pidgin.im>
parents:
13664
diff
changeset
|
234 | if (gc != NULL && name != NULL) { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
235 | /* We set this to 1 so that PURPLE_IM_CONVERSATION_TYPING will be sent |
| 15884 | 236 | * if the Purple user types anything else. |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
237 | */ |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
238 | purple_im_conversation_set_type_again(PURPLE_IM_CONVERSATION_GET_PRIVATE(conv), 1); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
239 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
240 | serv_send_typing(gc, name, PURPLE_IM_CONVERSATION_TYPED); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
241 | |
| 15884 | 242 | purple_debug(PURPLE_DEBUG_MISC, "conversation", "typed...\n"); |
|
573
a267d68a8240
[gaim-migrate @ 583]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
570
diff
changeset
|
243 | } |
| 66 | 244 | |
|
2725
a844d0964552
[gaim-migrate @ 2738]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2722
diff
changeset
|
245 | return FALSE; |
| 66 | 246 | } |
| 247 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
248 | static void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
249 | common_send(PurpleConversation *conv, const char *message, PurpleConversationMessageFlags msgflags) |
| 3790 | 250 | { |
| 15884 | 251 | PurpleConversationType type; |
| 252 | PurpleAccount *account; | |
| 253 | PurpleConnection *gc; | |
|
8076
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
254 | char *displayed = NULL, *sent = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
255 | int err = 0; |
| 3790 | 256 | |
|
23440
d20160530c78
Don't use strlen() when we can just check the first character
Mark Doliner <markdoliner@pidgin.im>
parents:
23312
diff
changeset
|
257 | if (*message == '\0') |
|
7947
76de4859a53a
[gaim-migrate @ 8621]
Mark Doliner <markdoliner@pidgin.im>
parents:
7930
diff
changeset
|
258 | return; |
|
76de4859a53a
[gaim-migrate @ 8621]
Mark Doliner <markdoliner@pidgin.im>
parents:
7930
diff
changeset
|
259 | |
| 15884 | 260 | 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
|
261 | gc = purple_conversation_get_connection(conv); |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
262 | |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
263 | g_return_if_fail(account != NULL); |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
264 | g_return_if_fail(gc != NULL); |
| 3731 | 265 | |
| 15884 | 266 | type = purple_conversation_get_type(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
267 | |
|
18087
b56ec2e9dae6
add a PURPLE_MESSAGE_NO_LINKIFY to prevent things from getting linkified
Nathan Walp <nwalp@pidgin.im>
parents:
18068
diff
changeset
|
268 | /* 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
|
269 | * explicitly asked to do otheriwse*/ |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
270 | if (!(msgflags & PURPLE_CONVERSATION_MESSAGE_INVISIBLE)) { |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
271 | if(msgflags & PURPLE_CONVERSATION_MESSAGE_NO_LINKIFY) |
|
19674
371069ae12fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19672
diff
changeset
|
272 | 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
|
273 | 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
|
274 | 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
|
275 | } |
|
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
|
276 | |
|
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
|
277 | if (displayed && (conv->features & PURPLE_CONNECTION_HTML) && |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
278 | !(msgflags & PURPLE_CONVERSATION_MESSAGE_RAW)) { |
|
12901
85ddd02a44d1
[gaim-migrate @ 15254]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12867
diff
changeset
|
279 | 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
|
280 | } else |
|
12901
85ddd02a44d1
[gaim-migrate @ 15254]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12867
diff
changeset
|
281 | sent = g_strdup(message); |
| 5136 | 282 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
283 | msgflags |= PURPLE_CONVERSATION_MESSAGE_SEND; |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
284 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
285 | if (type == PURPLE_CONVERSATION_TYPE_IM) { |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
286 | PurpleIMConversationPrivate *priv = PURPLE_IM_CONVERSATION_GET_PRIVATE(conv); |
| 15884 | 287 | |
| 288 | purple_signal_emit(purple_conversations_get_handle(), "sending-im-msg", | |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
289 | account, |
| 15884 | 290 | purple_conversation_get_name(conv), &sent); |
|
8076
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
291 | |
|
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
292 | if (sent != NULL && sent[0] != '\0') { |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12018
diff
changeset
|
293 | |
| 15884 | 294 | err = serv_send_im(gc, purple_conversation_get_name(conv), |
|
12216
d80739091a63
[gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12018
diff
changeset
|
295 | sent, msgflags); |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6846
diff
changeset
|
296 | |
|
8078
e8e087085339
[gaim-migrate @ 8777]
Mark Doliner <markdoliner@pidgin.im>
parents:
8076
diff
changeset
|
297 | if ((err > 0) && (displayed != NULL)) |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
298 | purple_im_conversation_write(im, NULL, displayed, msgflags, time(NULL)); |
| 15884 | 299 | |
| 300 | purple_signal_emit(purple_conversations_get_handle(), "sent-im-msg", | |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
301 | account, |
| 15884 | 302 | purple_conversation_get_name(conv), sent); |
|
2102
2d024ad2e07b
[gaim-migrate @ 2112]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2094
diff
changeset
|
303 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
304 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
305 | else { |
| 15884 | 306 | purple_signal_emit(purple_conversations_get_handle(), "sending-chat-msg", |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
307 | account, &sent, |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
308 | purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv))); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
309 | |
|
8076
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
310 | if (sent != NULL && sent[0] != '\0') { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
311 | err = serv_chat_send(gc, purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv)), sent, msgflags); |
| 15884 | 312 | |
| 313 | purple_signal_emit(purple_conversations_get_handle(), "sent-chat-msg", | |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
314 | account, sent, |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
315 | purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv))); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
316 | } |
|
472
9a5b8da2d760
[gaim-migrate @ 482]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
411
diff
changeset
|
317 | } |
|
1253
f02697a6aada
[gaim-migrate @ 1263]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
318 | |
|
2123
4cfdde0aa3f1
[gaim-migrate @ 2133]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2111
diff
changeset
|
319 | if (err < 0) { |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
320 | const char *who; |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12902
diff
changeset
|
321 | const char *msg; |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
322 | |
| 15884 | 323 | who = purple_conversation_get_name(conv); |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
324 | |
|
5213
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
325 | if (err == -E2BIG) { |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
326 | msg = _("Unable to send message: The message is too large."); |
|
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
327 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
328 | if (!purple_conversation_helper_present_error(who, account, msg)) { |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
12902
diff
changeset
|
329 | char *msg2 = g_strdup_printf(_("Unable to send message to %s."), who); |
| 15884 | 330 | 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
|
331 | g_free(msg2); |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
332 | } |
|
5213
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
333 | } |
|
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
334 | else if (err == -ENOTCONN) { |
| 15884 | 335 | purple_debug(PURPLE_DEBUG_ERROR, "conversation", |
|
5213
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
336 | "Not yet connected.\n"); |
|
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
337 | } |
|
d56ea526b80c
[gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
338 | else { |
|
10132
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
339 | msg = _("Unable to send message."); |
|
a11b4c81d70d
[gaim-migrate @ 11196]
Evan Schoenberg <evands@pidgin.im>
parents:
10116
diff
changeset
|
340 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
341 | if (!purple_conversation_helper_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, NULL); |
|
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 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
347 | } |
|
8076
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
348 | |
|
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
349 | g_free(displayed); |
|
1c3c1ad737e8
[gaim-migrate @ 8775]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
350 | g_free(sent); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
351 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
352 | |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
353 | static void |
| 15884 | 354 | open_log(PurpleConversation *conv) |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
355 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
356 | conv->logs = g_list_append(NULL, purple_log_new(conv->type == PURPLE_CONVERSATION_TYPE_CHAT ? PURPLE_LOG_CHAT : |
| 15884 | 357 | PURPLE_LOG_IM, conv->name, conv->account, |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13107
diff
changeset
|
358 | conv, time(NULL), NULL)); |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
359 | } |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
360 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
361 | /* Functions that deal with PurpleConversationMessage */ |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
362 | |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
363 | static void |
|
21253
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
364 | add_message_to_history(PurpleConversation *conv, const char *who, const char *alias, |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
365 | const char *message, PurpleConversationMessageFlags 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
|
366 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
367 | PurpleConversationMessage *msg; |
|
22458
42e804b6db56
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
368 | PurpleConnection *gc; |
|
42e804b6db56
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
369 | |
|
42e804b6db56
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
370 | 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
|
371 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
372 | if (flags & PURPLE_CONVERSATION_MESSAGE_SEND) { |
|
19601
8f000de5f9de
Do not duplicate the same message in the history, and store the correct
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19595
diff
changeset
|
373 | const char *me = NULL; |
|
22458
42e804b6db56
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
374 | if (gc) |
|
42e804b6db56
Kill off some uses of account->gc.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22390
diff
changeset
|
375 | 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
|
376 | 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
|
377 | 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
|
378 | 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
|
379 | } |
|
21253
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
380 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
381 | msg = g_new0(PurpleConversationMessage, 1); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
382 | PURPLE_DBUS_REGISTER_POINTER(msg, PurpleConversationMessage); |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
383 | msg->who = g_strdup(who); |
|
21253
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
384 | 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
|
385 | 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
|
386 | 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
|
387 | 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
|
388 | 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
|
389 | |
|
19904
8abf4c2056eb
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
390 | 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
|
391 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
392 | |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
393 | static void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
394 | free_conv_message(PurpleConversationMessage *msg) |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
395 | { |
|
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 | g_free(msg->who); |
|
21253
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
397 | 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
|
398 | g_free(msg->what); |
|
19595
acd61f0d6a81
DBus-ify the message history in a conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19593
diff
changeset
|
399 | 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
|
400 | 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
|
401 | } |
|
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 | |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
403 | 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
|
404 | 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
|
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 | 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
|
407 | 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
|
408 | } |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
409 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
410 | /************************************************************************** |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
411 | * Conversation API |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
412 | **************************************************************************/ |
| 8256 | 413 | static void |
| 15884 | 414 | purple_conversation_chat_cleanup_for_rejoin(PurpleConversation *conv) |
| 8256 | 415 | { |
| 416 | const char *disp; | |
| 15884 | 417 | PurpleAccount *account; |
| 418 | PurpleConnection *gc; | |
| 419 | ||
| 420 | account = purple_conversation_get_account(conv); | |
| 421 | ||
| 422 | purple_conversation_close_logs(conv); | |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
423 | open_log(conv); |
| 8373 | 424 | |
| 15884 | 425 | gc = purple_account_get_connection(account); |
| 426 | ||
| 427 | if ((disp = purple_connection_get_display_name(gc)) != NULL) | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
428 | purple_chat_conversation_set_nick(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv), disp); |
| 8373 | 429 | else |
| 430 | { | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
431 | purple_chat_conversation_set_nick(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv), |
| 15884 | 432 | purple_account_get_username(account)); |
| 8256 | 433 | } |
| 434 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
435 | purple_chat_conversation_clear_users(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv)); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
436 | purple_chat_conversation_set_topic(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv), NULL, NULL); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
437 | PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv)->left = FALSE; |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
438 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
439 | purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_CHATLEFT); |
| 8256 | 440 | } |
| 441 | ||
| 15884 | 442 | PurpleConversation * |
| 443 | purple_conversation_new(PurpleConversationType type, PurpleAccount *account, | |
|
4476
bf88170ba269
[gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents:
4471
diff
changeset
|
444 | const char *name) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
445 | { |
| 15884 | 446 | PurpleConversation *conv; |
| 447 | PurpleConnection *gc; | |
| 448 | PurpleConversationUiOps *ops; | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
449 | struct _purple_hconv *hc; |
| 15884 | 450 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
451 | g_return_val_if_fail(type != PURPLE_CONVERSATION_TYPE_UNKNOWN, NULL); |
|
7088
0920bc6160ae
[gaim-migrate @ 7653]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
452 | g_return_val_if_fail(account != NULL, NULL); |
|
0920bc6160ae
[gaim-migrate @ 7653]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
453 | g_return_val_if_fail(name != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
454 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
455 | /* Check if this conversation already exists. */ |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
456 | if ((conv = purple_conversations_find_with_account(type, name, account)) != NULL) |
|
8271
a79531291e7f
[gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents:
8256
diff
changeset
|
457 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
458 | if (purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_CHAT && |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
459 | !purple_chat_conversation_has_left(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv))) { |
|
27954
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
460 | 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
|
461 | "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
|
462 | "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
|
463 | } |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
464 | |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
465 | /* |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
466 | * 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
|
467 | * 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
|
468 | * 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
|
469 | * 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
|
470 | * chat. |
|
46719dcc12d1
Deprecate multiple chats having the same name and complain in the log.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
471 | * 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
|
472 | */ |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
473 | if (purple_conversation_get_type(conv) != PURPLE_CONVERSATION_TYPE_CHAT || |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
474 | purple_chat_conversation_has_left(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv))) |
|
22170
07ee0f226796
I am going to go ahead and commit+push this revision/fix of purple_conversation_new.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
475 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
476 | if (purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_CHAT) |
|
22170
07ee0f226796
I am going to go ahead and commit+push this revision/fix of purple_conversation_new.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
477 | 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
|
478 | |
|
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
|
479 | 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
|
480 | } |
| 8256 | 481 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
482 | |
| 15884 | 483 | gc = purple_account_get_connection(account); |
| 10665 | 484 | g_return_val_if_fail(gc != NULL, NULL); |
| 485 | ||
| 15884 | 486 | conv = g_new0(PurpleConversation, 1); |
| 487 | PURPLE_DBUS_REGISTER_POINTER(conv, PurpleConversation); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
488 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
489 | conv->type = type; |
| 4491 | 490 | conv->account = account; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
491 | conv->name = g_strdup(name); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
492 | conv->title = g_strdup(name); |
|
5139
24c56d94ed79
[gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
493 | 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
|
494 | g_free, NULL); |
| 10665 | 495 | /* 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
|
496 | conv->features = purple_connection_get_flags(gc); |
| 11581 | 497 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
498 | if (type == PURPLE_CONVERSATION_TYPE_IM) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
499 | { |
| 15884 | 500 | PurpleBuddyIcon *icon; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
501 | conv->u.im = g_new0(PurpleIMConversationPrivate, 1); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
502 | conv->u.im->conv = conv; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
503 | PURPLE_DBUS_REGISTER_POINTER(conv->u.im, PurpleIMConversationPrivate); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
504 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
505 | ims = g_list_prepend(ims, conv); |
| 15884 | 506 | 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
|
507 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
508 | purple_im_conversation_set_icon(conv->u.im, icon); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
509 | /* purple_im_conversation_set_icon refs the icon. */ |
|
16900
e9f12eb06c5b
Rework purple_buddy_icons_find() to return a reference for the caller, which
Richard Laager <rlaager@pidgin.im>
parents:
16545
diff
changeset
|
510 | 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
|
511 | } |
| 15884 | 512 | |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
15884
diff
changeset
|
513 | if (purple_prefs_get_bool("/purple/logging/log_ims")) |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
514 | { |
| 15884 | 515 | purple_conversation_set_logging(conv, TRUE); |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
516 | open_log(conv); |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
517 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
518 | } |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
519 | else if (type == PURPLE_CONVERSATION_TYPE_CHAT) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
520 | { |
| 8158 | 521 | const char *disp; |
| 522 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
523 | conv->u.chat = g_new0(PurpleChatConversationPrivate, 1); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
524 | conv->u.chat->conv = conv; |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
525 | 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
|
526 | _purple_conversation_user_equal, g_free, NULL); |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
527 | PURPLE_DBUS_REGISTER_POINTER(conv->u.chat, PurpleChatConversationPrivate); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
528 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
529 | chats = g_list_prepend(chats, conv); |
|
8271
a79531291e7f
[gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents:
8256
diff
changeset
|
530 | |
|
32624
f957ad287bcc
Convert code to use the purple_account accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
531 | if ((disp = purple_connection_get_display_name(purple_account_get_connection(account)))) |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
532 | purple_chat_conversation_set_nick(conv->u.chat, disp); |
|
8271
a79531291e7f
[gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents:
8256
diff
changeset
|
533 | else |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
534 | purple_chat_conversation_set_nick(conv->u.chat, |
| 15884 | 535 | purple_account_get_username(account)); |
| 536 | ||
|
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
|
537 | if (purple_prefs_get_bool("/purple/logging/log_chats")) |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
538 | { |
| 15884 | 539 | purple_conversation_set_logging(conv, TRUE); |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
540 | open_log(conv); |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
541 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
542 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
543 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
544 | 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
|
545 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
546 | 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
|
547 | 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
|
548 | hc->account = account; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
549 | hc->type = type; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
550 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
551 | g_hash_table_insert(conversation_cache, hc, conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
552 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
553 | /* Auto-set the title. */ |
| 15884 | 554 | purple_conversation_autoset_title(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
555 | |
|
11602
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
556 | /* 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
|
557 | * it causes mysterious crashes on my system. |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
558 | * -- Gary |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
559 | */ |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
560 | ops = conv->ui_ops = default_ops; |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
561 | if (ops != NULL && ops->create_conversation != NULL) |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
562 | ops->create_conversation(conv); |
|
bcbd0c5543ec
[gaim-migrate @ 13873]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11598
diff
changeset
|
563 | |
| 15884 | 564 | purple_signal_emit(purple_conversations_get_handle(), |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
565 | "conversation-created", conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
566 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
567 | return conv; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
568 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
569 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
570 | void |
| 15884 | 571 | purple_conversation_destroy(PurpleConversation *conv) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
572 | { |
| 15884 | 573 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 574 | PurpleConversationUiOps *ops; | |
| 575 | PurpleConnection *gc; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
576 | const char *name; |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
577 | struct _purple_hconv hc; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
578 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
579 | g_return_if_fail(conv != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
580 | |
| 15884 | 581 | purple_request_close_with_handle(conv); |
| 582 | ||
| 583 | 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
|
584 | gc = purple_conversation_get_connection(conv); |
| 15884 | 585 | name = purple_conversation_get_name(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
586 | |
| 8373 | 587 | if (gc != NULL) |
| 588 | { | |
|
5262
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
589 | /* 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
|
590 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
| 15884 | 591 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
592 | if (purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_IM) |
| 8373 | 593 | { |
|
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
|
594 | if (purple_prefs_get_bool("/purple/conversations/im/send_typing")) |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
595 | serv_send_typing(gc, name, PURPLE_IM_CONVERSATION_NOT_TYPING); |
|
5262
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
596 | |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
597 | if (gc && prpl_info->convo_closed != NULL) |
|
6403
9b2428783d7c
[gaim-migrate @ 6908]
Christian Hammond <chipx86@chipx86.com>
parents:
6402
diff
changeset
|
598 | 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
|
599 | } |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
600 | else if (purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_CHAT) |
| 8373 | 601 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
602 | int chat_id = purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv)); |
|
8271
a79531291e7f
[gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents:
8256
diff
changeset
|
603 | #if 0 |
|
5262
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
604 | /* |
|
6030
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
605 | * This is unfortunately necessary, because calling |
| 15884 | 606 | * serv_chat_leave() calls this purple_conversation_destroy(), |
|
6030
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
607 | * 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
|
608 | * 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
|
609 | * serv_got_chat_left(), which is eventually called from the |
|
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
610 | * prpl that serv_chat_leave() calls, removes this conversation |
|
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
611 | * 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
|
612 | * 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
|
613 | * calling this, because it'll be called again. If not, fall |
|
0e20bf585317
[gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents:
6020
diff
changeset
|
614 | * 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
|
615 | * be on the 2nd pass. |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
616 | * |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
617 | * Long paragraph. <-- Short sentence. |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
618 | * |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
619 | * -- ChipX86 |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
620 | */ |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
621 | |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
622 | if (gc && g_slist_find(gc->buddy_chats, conv) != NULL) { |
| 8373 | 623 | 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
|
624 | |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
625 | return; |
|
2e879b7de7fd
[gaim-migrate @ 5634]
José Mª Pérez Cáncer <jm_pc@users.sourceforge.net>
parents:
5213
diff
changeset
|
626 | } |
|
8271
a79531291e7f
[gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents:
8256
diff
changeset
|
627 | #endif |
| 8373 | 628 | /* |
| 629 | * Instead of all of that, lets just close the window when | |
| 630 | * the user tells us to, and let the prpl deal with the | |
| 631 | * internals on it's own time. Don't do this if the prpl already | |
| 632 | * knows it left the chat. | |
| 633 | */ | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
634 | if (!purple_chat_conversation_has_left(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv))) |
| 8373 | 635 | serv_chat_leave(gc, chat_id); |
| 636 | ||
| 637 | /* | |
| 638 | * If they didn't call serv_got_chat_left by now, it's too late. | |
| 639 | * So we better do it for them before we destroy the thing. | |
| 640 | */ | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
641 | if (!purple_chat_conversation_has_left(PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv))) |
| 8373 | 642 | serv_got_chat_left(gc, chat_id); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
643 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
644 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
645 | |
|
12018
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
646 | /* remove from conversations and im/chats lists prior to emit */ |
|
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
647 | conversations = g_list_remove(conversations, conv); |
|
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
648 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
649 | if(conv->type==PURPLE_CONVERSATION_TYPE_IM) |
|
12018
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
650 | ims = g_list_remove(ims, conv); |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
651 | else if(conv->type==PURPLE_CONVERSATION_TYPE_CHAT) |
|
12018
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
652 | chats = g_list_remove(chats, conv); |
|
60a434403f7e
[gaim-migrate @ 14311]
Casey Harkins <charkins@pidgin.im>
parents:
11921
diff
changeset
|
653 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
654 | 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
|
655 | hc.account = conv->account; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
656 | hc.type = conv->type; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
657 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
658 | 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
|
659 | |
| 15884 | 660 | purple_signal_emit(purple_conversations_get_handle(), |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
661 | "deleting-conversation", conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
662 | |
| 11606 | 663 | g_free(conv->name); |
| 664 | g_free(conv->title); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
665 | |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
666 | conv->name = NULL; |
|
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
667 | conv->title = NULL; |
|
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
668 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
669 | if (conv->type == PURPLE_CONVERSATION_TYPE_IM) { |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
670 | purple_im_conversation_stop_typing_timeout(conv->u.im); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
671 | purple_im_conversation_stop_send_typed_timeout(conv->u.im); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
672 | |
|
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
|
673 | purple_buddy_icon_unref(conv->u.im->icon); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
674 | conv->u.im->icon = NULL; |
|
6846
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
675 | |
| 15884 | 676 | PURPLE_DBUS_UNREGISTER_POINTER(conv->u.im); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
677 | g_free(conv->u.im); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
678 | conv->u.im = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
679 | } |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
680 | else if (conv->type == PURPLE_CONVERSATION_TYPE_CHAT) { |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
681 | 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
|
682 | conv->u.chat->users = NULL; |
| 15884 | 683 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
684 | g_list_foreach(conv->u.chat->in_room, (GFunc)purple_chat_conversation_buddy_destroy, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
685 | g_list_free(conv->u.chat->in_room); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
686 | |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
687 | 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
|
688 | g_list_free(conv->u.chat->ignored); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
689 | |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
690 | conv->u.chat->in_room = NULL; |
|
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
691 | conv->u.chat->ignored = NULL; |
|
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
692 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
693 | g_free(conv->u.chat->who); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
694 | conv->u.chat->who = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
695 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
696 | g_free(conv->u.chat->topic); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
697 | conv->u.chat->topic = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
698 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
699 | g_free(conv->u.chat->nick); |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10385
diff
changeset
|
700 | |
| 15884 | 701 | PURPLE_DBUS_UNREGISTER_POINTER(conv->u.chat); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
702 | g_free(conv->u.chat); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
703 | conv->u.chat = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
704 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
705 | |
|
4877
7d1f4381fed0
[gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents:
4876
diff
changeset
|
706 | g_hash_table_destroy(conv->data); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
707 | conv->data = NULL; |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
708 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
709 | if (ops != NULL && ops->destroy_conversation != NULL) |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
710 | 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
|
711 | conv->ui_data = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
712 | |
| 15884 | 713 | purple_conversation_close_logs(conv); |
| 714 | ||
|
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
|
715 | 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
|
716 | |
| 15884 | 717 | PURPLE_DBUS_UNREGISTER_POINTER(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
718 | g_free(conv); |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
719 | conv = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
720 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
721 | |
| 10665 | 722 | |
| 723 | void | |
| 15884 | 724 | purple_conversation_present(PurpleConversation *conv) { |
| 725 | PurpleConversationUiOps *ops; | |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
726 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
727 | g_return_if_fail(conv != NULL); |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
728 | |
| 15884 | 729 | ops = purple_conversation_get_ui_ops(conv); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
730 | if(ops && ops->present) |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
731 | ops->present(conv); |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
732 | } |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
733 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
734 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12618
diff
changeset
|
735 | void |
| 15884 | 736 | purple_conversation_set_features(PurpleConversation *conv, PurpleConnectionFlags features) |
| 10665 | 737 | { |
| 738 | g_return_if_fail(conv != NULL); | |
| 739 | ||
| 740 | conv->features = features; | |
| 741 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
742 | purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_FEATURES); |
| 10665 | 743 | } |
| 744 | ||
| 745 | ||
| 15884 | 746 | PurpleConnectionFlags |
| 747 | purple_conversation_get_features(PurpleConversation *conv) | |
| 10665 | 748 | { |
| 749 | g_return_val_if_fail(conv != NULL, 0); | |
| 750 | return conv->features; | |
| 751 | } | |
| 752 | ||
| 753 | ||
| 15884 | 754 | PurpleConversationType |
| 755 | purple_conversation_get_type(const PurpleConversation *conv) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
756 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
757 | g_return_val_if_fail(conv != NULL, PURPLE_CONVERSATION_TYPE_UNKNOWN); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
758 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
759 | return conv->type; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
760 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
761 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
762 | void |
| 15884 | 763 | purple_conversation_set_ui_ops(PurpleConversation *conv, |
| 764 | PurpleConversationUiOps *ops) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
765 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
766 | g_return_if_fail(conv != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
767 | |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
768 | if (conv->ui_ops == ops) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
769 | return; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
770 | |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4425
diff
changeset
|
771 | if (conv->ui_ops != NULL && conv->ui_ops->destroy_conversation != NULL) |
|
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4425
diff
changeset
|
772 | conv->ui_ops->destroy_conversation(conv); |
|
4359
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 | conv->ui_data = NULL; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
775 | |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4425
diff
changeset
|
776 | conv->ui_ops = ops; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
777 | } |
| 66 | 778 | |
| 15884 | 779 | PurpleConversationUiOps * |
| 780 | purple_conversation_get_ui_ops(const PurpleConversation *conv) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
781 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
782 | g_return_val_if_fail(conv != NULL, NULL); |
|
4359
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 | return conv->ui_ops; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
785 | } |
|
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 | void |
| 15884 | 788 | purple_conversation_set_account(PurpleConversation *conv, PurpleAccount *account) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
789 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
790 | g_return_if_fail(conv != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
791 | |
| 15884 | 792 | if (account == purple_conversation_get_account(conv)) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
793 | return; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
794 | |
| 4491 | 795 | conv->account = account; |
| 796 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
797 | purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_ACCOUNT); |
|
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 | |
| 15884 | 800 | PurpleAccount * |
| 801 | purple_conversation_get_account(const PurpleConversation *conv) | |
|
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_val_if_fail(conv != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
804 | |
| 4491 | 805 | return conv->account; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
806 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
807 | |
| 15884 | 808 | 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
|
809 | purple_conversation_get_connection(const PurpleConversation *conv) |
| 66 | 810 | { |
| 15884 | 811 | PurpleAccount *account; |
|
4425
b2ccc08ed727
[gaim-migrate @ 4700]
Christian Hammond <chipx86@chipx86.com>
parents:
4415
diff
changeset
|
812 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
813 | g_return_val_if_fail(conv != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
814 | |
| 15884 | 815 | account = purple_conversation_get_account(conv); |
| 4491 | 816 | |
| 817 | if (account == NULL) | |
|
4425
b2ccc08ed727
[gaim-migrate @ 4700]
Christian Hammond <chipx86@chipx86.com>
parents:
4415
diff
changeset
|
818 | return NULL; |
|
b2ccc08ed727
[gaim-migrate @ 4700]
Christian Hammond <chipx86@chipx86.com>
parents:
4415
diff
changeset
|
819 | |
|
32624
f957ad287bcc
Convert code to use the purple_account accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32623
diff
changeset
|
820 | return purple_account_get_connection(account); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
821 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
822 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
823 | void |
| 15884 | 824 | purple_conversation_set_title(PurpleConversation *conv, const char *title) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
825 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
826 | g_return_if_fail(conv != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
827 | g_return_if_fail(title != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
828 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
829 | g_free(conv->title); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
830 | conv->title = g_strdup(title); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
831 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
832 | purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_TITLE); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
833 | } |
|
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 | const char * |
| 15884 | 836 | purple_conversation_get_title(const PurpleConversation *conv) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
837 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
838 | g_return_val_if_fail(conv != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
839 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
840 | return conv->title; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
841 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
842 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
843 | void |
| 15884 | 844 | purple_conversation_autoset_title(PurpleConversation *conv) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
845 | { |
| 15884 | 846 | PurpleAccount *account; |
| 847 | PurpleBuddy *b; | |
| 848 | PurpleChat *chat; | |
| 8015 | 849 | const char *text = NULL, *name; |
| 3799 | 850 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
851 | g_return_if_fail(conv != NULL); |
|
2267
9704c0f60689
[gaim-migrate @ 2277]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2264
diff
changeset
|
852 | |
| 15884 | 853 | account = purple_conversation_get_account(conv); |
| 854 | name = purple_conversation_get_name(conv); | |
| 855 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
856 | if(purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_IM) { |
| 15884 | 857 | if(account && ((b = purple_find_buddy(account, name)) != NULL)) |
| 858 | text = purple_buddy_get_contact_alias(b); | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
859 | } else if(purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_CHAT) { |
| 15884 | 860 | 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
|
861 | text = purple_chat_get_name(chat); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
862 | } |
| 11581 | 863 | |
| 8015 | 864 | |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10104
diff
changeset
|
865 | if(text == NULL) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
866 | text = name; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
867 | |
| 15884 | 868 | purple_conversation_set_title(conv, text); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
869 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
870 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
871 | void |
| 15884 | 872 | purple_conversation_set_name(PurpleConversation *conv, const char *name) |
|
7256
311c8febfc92
[gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents:
7125
diff
changeset
|
873 | { |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
874 | struct _purple_hconv *hc; |
|
7256
311c8febfc92
[gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents:
7125
diff
changeset
|
875 | g_return_if_fail(conv != NULL); |
|
311c8febfc92
[gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents:
7125
diff
changeset
|
876 | |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
877 | 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
|
878 | hc->type = conv->type; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
879 | hc->account = conv->account; |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
880 | 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
|
881 | |
|
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
882 | g_hash_table_remove(conversation_cache, hc); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
883 | g_free(conv->name); |
|
27967
01a64c630e35
More efficient purple_find_conversation_with_account. Closes #9703.
Aman Gupta <aman@tmm1.net>
parents:
27954
diff
changeset
|
884 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
885 | 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
|
886 | 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
|
887 | g_hash_table_insert(conversation_cache, hc, conv); |
|
7257
599b8494e6ee
[gaim-migrate @ 7834]
Christian Hammond <chipx86@chipx86.com>
parents:
7256
diff
changeset
|
888 | |
| 15884 | 889 | purple_conversation_autoset_title(conv); |
|
7256
311c8febfc92
[gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents:
7125
diff
changeset
|
890 | } |
|
311c8febfc92
[gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents:
7125
diff
changeset
|
891 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
892 | const char * |
| 15884 | 893 | purple_conversation_get_name(const PurpleConversation *conv) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
894 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
895 | g_return_val_if_fail(conv != NULL, NULL); |
|
4359
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 | return conv->name; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
898 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
899 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
900 | void |
| 15884 | 901 | purple_conversation_set_logging(PurpleConversation *conv, gboolean log) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
902 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
903 | g_return_if_fail(conv != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
904 | |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
905 | if (conv->logging != log) |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
906 | { |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
907 | conv->logging = log; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
908 | purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_LOGGING); |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
909 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
910 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
911 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
912 | gboolean |
| 15884 | 913 | purple_conversation_is_logging(const PurpleConversation *conv) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
914 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
915 | g_return_val_if_fail(conv != NULL, FALSE); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
916 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
917 | return conv->logging; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
918 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
919 | |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
920 | void |
| 15884 | 921 | purple_conversation_close_logs(PurpleConversation *conv) |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
922 | { |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
923 | g_return_if_fail(conv != NULL); |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
924 | |
| 15884 | 925 | g_list_foreach(conv->logs, (GFunc)purple_log_free, NULL); |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
926 | g_list_free(conv->logs); |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
927 | conv->logs = NULL; |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
928 | } |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
929 | |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
930 | void |
| 15884 | 931 | purple_conversation_set_data(PurpleConversation *conv, const char *key, |
|
4877
7d1f4381fed0
[gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents:
4876
diff
changeset
|
932 | gpointer data) |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
933 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
934 | g_return_if_fail(conv != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
935 | g_return_if_fail(key != NULL); |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
936 | |
|
4877
7d1f4381fed0
[gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents:
4876
diff
changeset
|
937 | g_hash_table_replace(conv->data, g_strdup(key), data); |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
938 | } |
|
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
939 | |
|
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
940 | gpointer |
| 15884 | 941 | purple_conversation_get_data(PurpleConversation *conv, const char *key) |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
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, NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
944 | g_return_val_if_fail(key != NULL, NULL); |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
945 | |
|
4877
7d1f4381fed0
[gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents:
4876
diff
changeset
|
946 | return g_hash_table_lookup(conv->data, key); |
|
4876
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
947 | } |
|
b6ec886c8c77
[gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents:
4818
diff
changeset
|
948 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
949 | void |
| 15884 | 950 | purple_conversation_write(PurpleConversation *conv, const char *who, |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
951 | const char *message, PurpleConversationMessageFlags flags, |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
952 | time_t mtime) |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
953 | { |
| 15884 | 954 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 955 | PurpleConnection *gc = NULL; | |
| 956 | PurpleAccount *account; | |
| 957 | PurpleConversationUiOps *ops; | |
|
11468
3411c0d7f597
[gaim-migrate @ 13708]
Richard Laager <rlaager@pidgin.im>
parents:
11454
diff
changeset
|
958 | const char *alias; |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
959 | char *displayed = NULL; |
| 15884 | 960 | PurpleBuddy *b; |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
961 | int plugin_return; |
| 15884 | 962 | PurpleConversationType type; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
963 | /* int logging_font_options = 0; */ |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
964 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
965 | g_return_if_fail(conv != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
966 | g_return_if_fail(message != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
967 | |
| 15884 | 968 | ops = purple_conversation_get_ui_ops(conv); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
969 | |
| 15884 | 970 | account = purple_conversation_get_account(conv); |
| 971 | type = purple_conversation_get_type(conv); | |
|
6496
9833c2665143
[gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
972 | |
|
9833c2665143
[gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
973 | if (account != NULL) |
| 15884 | 974 | gc = purple_account_get_connection(account); |
| 975 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
976 | if (purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_CHAT && |
|
22805
92825aac9549
When you try to execute a command (e.g., /part etc.) in a chat on a
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22458
diff
changeset
|
977 | (gc != NULL && !g_slist_find(gc->buddy_chats, conv))) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
978 | return; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
979 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
980 | if (purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_IM && |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
981 | !g_list_find(purple_conversations_get(), conv)) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
982 | return; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
983 | |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
984 | displayed = g_strdup(message); |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
985 | |
|
19769
9420f2078435
writing-im-msg now receives the conversation name as the who argument if
Richard Laager <rlaager@pidgin.im>
parents:
19674
diff
changeset
|
986 | 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
|
987 | 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
|
988 | 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
|
989 | |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
990 | plugin_return = |
| 15884 | 991 | GPOINTER_TO_INT(purple_signal_emit_return_1( |
| 992 | purple_conversations_get_handle(), | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
993 | (type == PURPLE_CONVERSATION_TYPE_IM ? "writing-im-msg" : "writing-chat-msg"), |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
994 | account, who, &displayed, conv, flags)); |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
995 | |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
996 | if (displayed == NULL) |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
997 | return; |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
998 | |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
999 | if (plugin_return) { |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1000 | g_free(displayed); |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1001 | return; |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1002 | } |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1003 | |
| 9613 | 1004 | if (account != NULL) { |
| 15884 | 1005 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(account))); |
| 1006 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1007 | if (purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_IM || |
|
5350
966c6d4d7bdd
[gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents:
5262
diff
changeset
|
1008 | !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
|
966c6d4d7bdd
[gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents:
5262
diff
changeset
|
1009 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1010 | if (flags & PURPLE_CONVERSATION_MESSAGE_SEND) { |
| 15884 | 1011 | b = purple_find_buddy(account, |
| 1012 | purple_account_get_username(account)); | |
| 1013 | ||
|
34589
428e92c79631
Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents:
33578
diff
changeset
|
1014 | if (purple_account_get_private_alias(account) != NULL) |
|
428e92c79631
Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents:
33578
diff
changeset
|
1015 | alias = purple_account_get_private_alias(account); |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
24955
diff
changeset
|
1016 | else if (b != NULL && !purple_strequal(purple_buddy_get_name(b), purple_buddy_get_contact_alias(b))) |
| 15884 | 1017 | alias = purple_buddy_get_contact_alias(b); |
| 1018 | else if (purple_connection_get_display_name(gc) != NULL) | |
| 1019 | alias = purple_connection_get_display_name(gc); | |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1020 | else |
| 15884 | 1021 | alias = purple_account_get_username(account); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1022 | } |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1023 | else |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1024 | { |
| 15884 | 1025 | b = purple_find_buddy(account, who); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1026 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1027 | if (b != NULL) |
| 15884 | 1028 | alias = purple_buddy_get_contact_alias(b); |
|
1772
c759c01bd66f
[gaim-migrate @ 1782]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1764
diff
changeset
|
1029 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1030 | } |
|
474
8e9acf2f6c48
[gaim-migrate @ 484]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
473
diff
changeset
|
1031 | } |
| 8256 | 1032 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1033 | if (!(flags & PURPLE_CONVERSATION_MESSAGE_NO_LOG) && purple_conversation_is_logging(conv)) { |
|
11672
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
1034 | GList *log; |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
1035 | |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
1036 | if (conv->logs == NULL) |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
1037 | open_log(conv); |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
1038 | |
|
018c70c8134c
[gaim-migrate @ 13958]
Richard Laager <rlaager@pidgin.im>
parents:
11671
diff
changeset
|
1039 | log = conv->logs; |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1040 | while (log != NULL) { |
| 15884 | 1041 | purple_log_write((PurpleLog *)log->data, flags, alias, mtime, displayed); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1042 | log = log->next; |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1043 | } |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1044 | } |
| 66 | 1045 | |
|
19593
608995889b11
A conversation shouldn't need ui-ops for logging the messages.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19590
diff
changeset
|
1046 | 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
|
1047 | 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
|
1048 | |
|
121075afcdbc
Show alias in restored conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21233
diff
changeset
|
1049 | 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
|
1050 | |
| 15884 | 1051 | purple_signal_emit(purple_conversations_get_handle(), |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1052 | (type == PURPLE_CONVERSATION_TYPE_IM ? "wrote-im-msg" : "wrote-chat-msg"), |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1053 | account, who, displayed, conv, flags); |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1054 | |
|
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
1055 | g_free(displayed); |
| 66 | 1056 | } |
| 1057 | ||
|
9260
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1058 | gboolean |
| 15884 | 1059 | purple_conversation_has_focus(PurpleConversation *conv) |
|
9260
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1060 | { |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1061 | gboolean ret = FALSE; |
| 15884 | 1062 | PurpleConversationUiOps *ops; |
|
9260
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1063 | |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1064 | g_return_val_if_fail(conv != NULL, FALSE); |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1065 | |
| 15884 | 1066 | ops = purple_conversation_get_ui_ops(conv); |
|
9260
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1067 | |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1068 | if (ops != NULL && ops->has_focus != NULL) |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1069 | ret = ops->has_focus(conv); |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1070 | |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1071 | return ret; |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1072 | } |
|
82d7b380220a
[gaim-migrate @ 10059]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9251
diff
changeset
|
1073 | |
|
7930
3005873ac411
[gaim-migrate @ 8601]
Mark Doliner <markdoliner@pidgin.im>
parents:
7879
diff
changeset
|
1074 | /* |
| 8256 | 1075 | * TODO: Need to make sure calls to this function happen in the core |
| 1076 | * instead of the UI. That way UIs have less work to do, and the | |
| 1077 | * 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
|
1078 | * when chats are added/removed from the blist. |
|
3005873ac411
[gaim-migrate @ 8601]
Mark Doliner <markdoliner@pidgin.im>
parents:
7879
diff
changeset
|
1079 | */ |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1080 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1081 | purple_conversation_update(PurpleConversation *conv, PurpleConversationUpdateType type) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1082 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1083 | g_return_if_fail(conv != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1084 | |
| 15884 | 1085 | purple_signal_emit(purple_conversations_get_handle(), |
| 9734 | 1086 | "conversation-updated", conv, type); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1087 | } |
| 2993 | 1088 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1089 | /************************************************************************** |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1090 | * IM Conversation API |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1091 | **************************************************************************/ |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1092 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1093 | purple_im_conversation_set_icon(PurpleIMConversation *im, PurpleBuddyIcon *icon) |
|
6846
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1094 | { |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1095 | g_return_if_fail(im != NULL); |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1096 | |
|
9261
a0ed867a459e
[gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents:
9260
diff
changeset
|
1097 | if (im->icon != icon) |
|
a0ed867a459e
[gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents:
9260
diff
changeset
|
1098 | { |
|
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
|
1099 | purple_buddy_icon_unref(im->icon); |
| 15884 | 1100 | |
| 1101 | im->icon = (icon == NULL ? NULL : purple_buddy_icon_ref(icon)); | |
|
9261
a0ed867a459e
[gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents:
9260
diff
changeset
|
1102 | } |
|
6846
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1103 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1104 | purple_conversation_update(purple_im_conversation_get_conversation(im), |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1105 | PURPLE_CONVERSATION_UPDATE_ICON); |
|
6846
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1106 | } |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1107 | |
| 15884 | 1108 | PurpleBuddyIcon * |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1109 | purple_im_conversation_get_icon(const PurpleIMConversation *im) |
|
6846
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1110 | { |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1111 | g_return_val_if_fail(im != NULL, NULL); |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1112 | |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1113 | return im->icon; |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1114 | } |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1115 | |
|
f814f02dca87
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6837
diff
changeset
|
1116 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1117 | purple_im_conversation_set_typing_state(PurpleIMConversation *im, PurpleIMConversationTypingState state) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1118 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1119 | g_return_if_fail(im != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1120 | |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12639
diff
changeset
|
1121 | if (im->typing_state != state) |
|
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12639
diff
changeset
|
1122 | { |
|
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12639
diff
changeset
|
1123 | im->typing_state = state; |
|
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12639
diff
changeset
|
1124 | |
|
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
|
1125 | switch (state) |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
1126 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1127 | case PURPLE_IM_CONVERSATION_TYPING: |
|
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
|
1128 | 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
|
1129 | "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
|
1130 | break; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1131 | case PURPLE_IM_CONVERSATION_TYPED: |
|
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
|
1132 | 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
|
1133 | "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
|
1134 | break; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1135 | case PURPLE_IM_CONVERSATION_NOT_TYPING: |
|
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
|
1136 | 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
|
1137 | "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
|
1138 | break; |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12639
diff
changeset
|
1139 | } |
|
27250
47fc0f87ce94
Consistently emit conversation-updated for typing state changes.
Florian Quèze <florian@instantbird.org>
parents:
26889
diff
changeset
|
1140 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1141 | purple_im_conversation_update_typing(im); |
|
12797
d0f51cfde6bc
[gaim-migrate @ 15144]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12639
diff
changeset
|
1142 | } |
| 2993 | 1143 | } |
| 66 | 1144 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1145 | PurpleIMConversationTypingState |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1146 | purple_im_conversation_get_typing_state(const PurpleIMConversation *im) |
| 3671 | 1147 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1148 | g_return_val_if_fail(im != NULL, 0); |
| 3671 | 1149 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1150 | return im->typing_state; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1151 | } |
| 3704 | 1152 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1153 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1154 | purple_im_conversation_start_typing_timeout(PurpleIMConversation *im, int timeout) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1155 | { |
| 15884 | 1156 | PurpleConversation *conv; |
| 3671 | 1157 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1158 | g_return_if_fail(im != NULL); |
| 3671 | 1159 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1160 | if (im->typing_timeout > 0) |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1161 | purple_im_conversation_stop_typing_timeout(im); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1162 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1163 | conv = purple_im_conversation_get_conversation(im); |
| 15884 | 1164 | |
|
18068
b6554e3c8224
merge of '1442df274a24edc9a31194327bd00dfbcf478720'
Richard Laager <rlaager@pidgin.im>
diff
changeset
|
1165 | 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
|
1166 | } |
| 3671 | 1167 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1168 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1169 | purple_im_conversation_stop_typing_timeout(PurpleIMConversation *im) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1170 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1171 | g_return_if_fail(im != NULL); |
| 3671 | 1172 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1173 | if (im->typing_timeout == 0) |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1174 | return; |
| 3671 | 1175 | |
| 15884 | 1176 | purple_timeout_remove(im->typing_timeout); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1177 | im->typing_timeout = 0; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1178 | } |
| 3671 | 1179 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1180 | guint |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1181 | purple_im_conversation_get_typing_timeout(const PurpleIMConversation *im) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1182 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1183 | g_return_val_if_fail(im != NULL, 0); |
| 3699 | 1184 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1185 | return im->typing_timeout; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1186 | } |
| 3699 | 1187 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1188 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1189 | purple_im_conversation_set_type_again(PurpleIMConversation *im, unsigned int val) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1190 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1191 | g_return_if_fail(im != NULL); |
| 3671 | 1192 | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
1193 | if (val == 0) |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
1194 | im->type_again = 0; |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
1195 | else |
|
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
1196 | im->type_again = time(NULL) + val; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1197 | } |
| 3671 | 1198 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1199 | time_t |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1200 | purple_im_conversation_get_type_again(const PurpleIMConversation *im) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1201 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1202 | g_return_val_if_fail(im != NULL, 0); |
| 3671 | 1203 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1204 | return im->type_again; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1205 | } |
| 3671 | 1206 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1207 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1208 | purple_im_conversation_start_send_typed_timeout(PurpleIMConversation *im) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1209 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1210 | g_return_if_fail(im != NULL); |
| 3671 | 1211 | |
|
25716
1b5be208d5ba
applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents:
24051
diff
changeset
|
1212 | 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
|
1213 | send_typed_cb, |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1214 | purple_im_conversation_get_conversation(im)); |
| 3671 | 1215 | } |
| 1216 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1217 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1218 | purple_im_conversation_stop_send_typed_timeout(PurpleIMConversation *im) |
| 3671 | 1219 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1220 | g_return_if_fail(im != NULL); |
| 3671 | 1221 | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
1222 | if (im->send_typed_timeout == 0) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1223 | return; |
| 3671 | 1224 | |
| 15884 | 1225 | purple_timeout_remove(im->send_typed_timeout); |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
1226 | im->send_typed_timeout = 0; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1227 | } |
| 3671 | 1228 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1229 | guint |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1230 | purple_im_conversation_get_send_typed_timeout(const PurpleIMConversation *im) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1231 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1232 | g_return_val_if_fail(im != NULL, 0); |
| 3671 | 1233 | |
|
13844
835b8f7b3d1d
[gaim-migrate @ 16295]
Mark Doliner <markdoliner@pidgin.im>
parents:
13840
diff
changeset
|
1234 | return im->send_typed_timeout; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1235 | } |
| 3671 | 1236 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1237 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1238 | purple_im_conversation_update_typing(PurpleIMConversation *im) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1239 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1240 | g_return_if_fail(im != NULL); |
| 3671 | 1241 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1242 | purple_conversation_update(purple_im_conversation_get_conversation(im), |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1243 | PURPLE_CONVERSATION_UPDATE_TYPING); |
| 3671 | 1244 | } |
| 1245 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1246 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1247 | purple_im_conversation_write(PurpleIMConversation *im, const char *who, const char *message, |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1248 | PurpleConversationMessageFlags flags, time_t mtime) |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1249 | { |
| 15884 | 1250 | PurpleConversation *c; |
|
1898
695a31e4452b
[gaim-migrate @ 1908]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1889
diff
changeset
|
1251 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1252 | g_return_if_fail(im != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1253 | g_return_if_fail(message != NULL); |
|
1898
695a31e4452b
[gaim-migrate @ 1908]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1889
diff
changeset
|
1254 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1255 | c = purple_im_conversation_get_conversation(im); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1256 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1257 | if ((flags & PURPLE_CONVERSATION_MESSAGE_RECV) == PURPLE_CONVERSATION_MESSAGE_RECV) { |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1258 | purple_im_conversation_set_typing_state(im, PURPLE_IM_CONVERSATION_NOT_TYPING); |
|
31449
2c75e32cecc6
applied changes from 471aa5f04627823959bd9accda5d5e5630f119d5
Evan Schoenberg <evands@pidgin.im>
parents:
31448
diff
changeset
|
1259 | } |
|
2c75e32cecc6
applied changes from 471aa5f04627823959bd9accda5d5e5630f119d5
Evan Schoenberg <evands@pidgin.im>
parents:
31448
diff
changeset
|
1260 | |
|
19118
c242294f21d1
Correct an inaccurate comment.
Will Thompson <resiak@pidgin.im>
parents:
18744
diff
changeset
|
1261 | /* 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
|
1262 | 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
|
1263 | c->ui_ops->write_im(c, who, message, flags, mtime); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1264 | else |
| 15884 | 1265 | purple_conversation_write(c, who, message, flags, mtime); |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1266 | } |
|
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1267 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1268 | gboolean purple_conversation_helper_present_error(const char *who, PurpleAccount *account, const char *what) |
| 9627 | 1269 | { |
| 15884 | 1270 | PurpleConversation *conv; |
| 9627 | 1271 | |
| 1272 | g_return_val_if_fail(who != NULL, FALSE); | |
| 1273 | g_return_val_if_fail(account !=NULL, FALSE); | |
| 1274 | g_return_val_if_fail(what != NULL, FALSE); | |
| 1275 | ||
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1276 | conv = purple_conversations_find_with_account(PURPLE_CONVERSATION_TYPE_ANY, who, account); |
| 9627 | 1277 | if (conv != NULL) |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1278 | purple_conversation_write(conv, NULL, what, PURPLE_CONVERSATION_MESSAGE_ERROR, time(NULL)); |
| 9627 | 1279 | else |
| 1280 | return FALSE; | |
| 1281 | ||
| 1282 | return TRUE; | |
| 1283 | } | |
| 1284 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1285 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1286 | purple_im_conversation_send(PurpleIMConversation *im, const char *message) |
|
2379
cffc8ebf1bd4
[gaim-migrate @ 2392]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2375
diff
changeset
|
1287 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1288 | purple_im_conversation_send_with_flags(im, message, 0); |
|
11921
fe74264ce36c
[gaim-migrate @ 14212]
Evan Schoenberg <evands@pidgin.im>
parents:
11869
diff
changeset
|
1289 | } |
|
fe74264ce36c
[gaim-migrate @ 14212]
Evan Schoenberg <evands@pidgin.im>
parents:
11869
diff
changeset
|
1290 | |
| 14582 | 1291 | static void |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1292 | purple_conversation_send_confirm_cb(gpointer *data) |
| 14582 | 1293 | { |
| 15884 | 1294 | PurpleConversation *conv = data[0]; |
| 14582 | 1295 | char *message = data[1]; |
| 1296 | ||
| 1297 | g_free(data); | |
| 1298 | common_send(conv, message, 0); | |
| 1299 | } | |
| 1300 | ||
| 1301 | void | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1302 | purple_conversation_send_confirm(PurpleConversation *conv, const char *message) |
| 14582 | 1303 | { |
| 1304 | char *text; | |
| 1305 | gpointer *data; | |
| 1306 | ||
| 1307 | g_return_if_fail(conv != NULL); | |
| 1308 | g_return_if_fail(message != NULL); | |
| 1309 | ||
| 1310 | if (conv->ui_ops != NULL && conv->ui_ops->send_confirm != NULL) | |
| 1311 | { | |
| 1312 | conv->ui_ops->send_confirm(conv, message); | |
| 1313 | return; | |
| 1314 | } | |
| 1315 | ||
| 1316 | text = g_strdup_printf("You are about to send the following message:\n%s", message); | |
| 1317 | data = g_new0(gpointer, 2); | |
| 1318 | data[0] = conv; | |
| 1319 | data[1] = (gpointer)message; | |
| 1320 | ||
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1321 | purple_request_action(conv, NULL, _("Send Message"), text, 0, |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16478
diff
changeset
|
1322 | purple_conversation_get_account(conv), NULL, conv, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1323 | data, 2, |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1324 | _("_Send Message"), G_CALLBACK(purple_conversation_send_confirm_cb), |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16478
diff
changeset
|
1325 | _("Cancel"), NULL); |
| 14582 | 1326 | } |
| 1327 | ||
|
11921
fe74264ce36c
[gaim-migrate @ 14212]
Evan Schoenberg <evands@pidgin.im>
parents:
11869
diff
changeset
|
1328 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1329 | purple_im_conversation_send_with_flags(PurpleIMConversation *im, const char *message, PurpleConversationMessageFlags flags) |
|
11921
fe74264ce36c
[gaim-migrate @ 14212]
Evan Schoenberg <evands@pidgin.im>
parents:
11869
diff
changeset
|
1330 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1331 | g_return_if_fail(im != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1332 | g_return_if_fail(message != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1333 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1334 | common_send(purple_im_conversation_get_conversation(im), message, flags); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1335 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1336 | |
| 10526 | 1337 | gboolean |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1338 | purple_conversation_custom_smiley_add(PurpleConversation *conv, const char *smile, |
|
12618
b83b6bab0703
[gaim-migrate @ 14954]
Richard Laager <rlaager@pidgin.im>
parents:
12604
diff
changeset
|
1339 | const char *cksum_type, const char *chksum, |
|
b83b6bab0703
[gaim-migrate @ 14954]
Richard Laager <rlaager@pidgin.im>
parents:
12604
diff
changeset
|
1340 | gboolean remote) |
| 10526 | 1341 | { |
| 1342 | if (conv == NULL || smile == NULL || !*smile) { | |
| 1343 | return FALSE; | |
| 1344 | } | |
| 1345 | ||
| 1346 | /* TODO: check if the icon is in the cache and return false if so */ | |
| 1347 | /* TODO: add an icon cache (that doesn't suck) */ | |
| 1348 | 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
|
1349 | return conv->ui_ops->custom_smiley_add(conv, smile, remote); |
| 10526 | 1350 | } else { |
| 15884 | 1351 | purple_debug_info("conversation", "Could not find add custom smiley function"); |
| 10526 | 1352 | return FALSE; |
| 1353 | } | |
| 1354 | ||
| 1355 | } | |
| 1356 | ||
| 1357 | void | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1358 | purple_conversation_custom_smiley_write(PurpleConversation *conv, const char *smile, |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11064
diff
changeset
|
1359 | const guchar *data, gsize size) |
| 10526 | 1360 | { |
| 1361 | g_return_if_fail(conv != NULL); | |
| 1362 | g_return_if_fail(smile != NULL && *smile); | |
| 1363 | ||
| 1364 | if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_write != NULL) | |
| 1365 | conv->ui_ops->custom_smiley_write(conv, smile, data, size); | |
| 1366 | else | |
| 15884 | 1367 | purple_debug_info("conversation", "Could not find the smiley write function"); |
| 10526 | 1368 | } |
| 1369 | ||
| 1370 | void | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1371 | purple_conversation_custom_smiley_close(PurpleConversation *conv, const char *smile) |
| 10526 | 1372 | { |
| 1373 | g_return_if_fail(conv != NULL); | |
| 1374 | g_return_if_fail(smile != NULL && *smile); | |
| 1375 | ||
| 1376 | if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_close != NULL) | |
| 1377 | conv->ui_ops->custom_smiley_close(conv, smile); | |
| 1378 | else | |
| 15884 | 1379 | purple_debug_info("conversation", "Could not find custom smiley close function"); |
| 10526 | 1380 | } |
| 1381 | ||
| 1382 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1383 | /************************************************************************** |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1384 | * Chat Conversation API |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1385 | **************************************************************************/ |
|
2379
cffc8ebf1bd4
[gaim-migrate @ 2392]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2375
diff
changeset
|
1386 | |
| 15884 | 1387 | PurpleConversation * |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1388 | purple_chat_conversation_get_conversation(const PurpleChatConversation *chat) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1389 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1390 | g_return_val_if_fail(chat != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1391 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1392 | return chat->conv; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1393 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1394 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1395 | GList * |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1396 | purple_chat_conversation_get_users(const PurpleChatConversation *chat) |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1002
diff
changeset
|
1397 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1398 | g_return_val_if_fail(chat != NULL, NULL); |
|
1253
f02697a6aada
[gaim-migrate @ 1263]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1250
diff
changeset
|
1399 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1400 | return chat->in_room; |
|
1030
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1002
diff
changeset
|
1401 | } |
|
b9fa9eadc0a4
[gaim-migrate @ 1040]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1002
diff
changeset
|
1402 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1403 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1404 | purple_chat_conversation_ignore(PurpleChatConversation *chat, const char *name) |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1405 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1406 | g_return_if_fail(chat != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1407 | g_return_if_fail(name != NULL); |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1408 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1409 | /* Make sure the user isn't already ignored. */ |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1410 | if (purple_chat_conversation_is_ignored_user(chat, name)) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1411 | return; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1412 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1413 | purple_chat_conversation_set_ignored(chat, |
|
18187
d560300fa2ab
Re-apply a good change from 2d8ea56b90971e7851442d96b7d74ecb4f052126:
Richard Laager <rlaager@pidgin.im>
parents:
18122
diff
changeset
|
1414 | g_list_append(chat->ignored, g_strdup(name))); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1415 | } |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1416 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1417 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1418 | purple_chat_conversation_unignore(PurpleChatConversation *chat, const char *name) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1419 | { |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1420 | GList *item; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1421 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1422 | g_return_if_fail(chat != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1423 | g_return_if_fail(name != NULL); |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1424 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1425 | /* Make sure the user is actually ignored. */ |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1426 | if (!purple_chat_conversation_is_ignored_user(chat, name)) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1427 | return; |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1428 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1429 | item = g_list_find(purple_chat_conversation_get_ignored(chat), |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1430 | purple_chat_conversation_get_ignored_user(chat, name)); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1431 | |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1432 | purple_chat_conversation_set_ignored(chat, |
|
18187
d560300fa2ab
Re-apply a good change from 2d8ea56b90971e7851442d96b7d74ecb4f052126:
Richard Laager <rlaager@pidgin.im>
parents:
18122
diff
changeset
|
1433 | g_list_remove_link(chat->ignored, item)); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1434 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1435 | g_free(item->data); |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1436 | g_list_free_1(item); |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1437 | } |
|
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1438 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1439 | GList * |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1440 | purple_chat_conversation_set_ignored(PurpleChatConversation *chat, GList *ignored) |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1441 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1442 | g_return_val_if_fail(chat != NULL, NULL); |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1443 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1444 | chat->ignored = ignored; |
|
993
8798e0ac047d
[gaim-migrate @ 1003]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
980
diff
changeset
|
1445 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1446 | return ignored; |
|
2111
34615a640c59
[gaim-migrate @ 2121]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2109
diff
changeset
|
1447 | } |
|
34615a640c59
[gaim-migrate @ 2121]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2109
diff
changeset
|
1448 | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1449 | GList * |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1450 | purple_chat_conversation_get_ignored(const PurpleChatConversation *chat) |
|
2111
34615a640c59
[gaim-migrate @ 2121]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2109
diff
changeset
|
1451 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1452 | g_return_val_if_fail(chat != NULL, NULL); |
|
1898
695a31e4452b
[gaim-migrate @ 1908]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1889
diff
changeset
|
1453 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1454 | return chat->ignored; |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1455 | } |
|
472
9a5b8da2d760
[gaim-migrate @ 482]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
411
diff
changeset
|
1456 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1457 | const char * |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1458 | purple_chat_conversation_get_ignored_user(const PurpleChatConversation *chat, const char *user) |
| 1340 | 1459 | { |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1460 | GList *ignored; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1461 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1462 | g_return_val_if_fail(chat != NULL, NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1463 | g_return_val_if_fail(user != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1464 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1465 | for (ignored = purple_chat_conversation_get_ignored(chat); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1466 | ignored != NULL; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1467 | ignored = ignored->next) { |
|
2372
c24942700dfd
[gaim-migrate @ 2385]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2363
diff
changeset
|
1468 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1469 | const char *ign = (const char *)ignored->data; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1470 | |
| 15884 | 1471 | if (!purple_utf8_strcasecmp(user, ign) || |
| 1472 | ((*ign == '+' || *ign == '%') && !purple_utf8_strcasecmp(user, ign + 1))) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1473 | return ign; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1474 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1475 | if (*ign == '@') { |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1476 | ign++; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1477 | |
| 15884 | 1478 | if ((*ign == '+' && !purple_utf8_strcasecmp(user, ign + 1)) || |
| 1479 | (*ign != '+' && !purple_utf8_strcasecmp(user, ign))) | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1480 | return ign; |
| 3671 | 1481 | } |
| 2094 | 1482 | } |
| 1341 | 1483 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1484 | return NULL; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1485 | } |
| 1341 | 1486 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1487 | gboolean |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1488 | purple_chat_conversation_is_ignored_user(const PurpleChatConversation *chat, const char *user) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1489 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1490 | g_return_val_if_fail(chat != NULL, FALSE); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1491 | g_return_val_if_fail(user != NULL, FALSE); |
| 1341 | 1492 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1493 | return (purple_chat_conversation_get_ignored_user(chat, user) != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1494 | } |
| 1343 | 1495 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1496 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1497 | purple_chat_conversation_set_topic(PurpleChatConversation *chat, const char *who, const char *topic) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1498 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1499 | g_return_if_fail(chat != NULL); |
| 1343 | 1500 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1501 | g_free(chat->who); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1502 | g_free(chat->topic); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1503 | |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1504 | chat->who = g_strdup(who); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1505 | chat->topic = g_strdup(topic); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1506 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1507 | purple_conversation_update(purple_chat_conversation_get_conversation(chat), |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1508 | PURPLE_CONVERSATION_UPDATE_TOPIC); |
| 15884 | 1509 | |
| 1510 | purple_signal_emit(purple_conversations_get_handle(), "chat-topic-changed", | |
| 9517 | 1511 | chat->conv, chat->who, chat->topic); |
| 1340 | 1512 | } |
| 1513 | ||
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1514 | const char * |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1515 | purple_chat_conversation_get_topic(const PurpleChatConversation *chat) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1516 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1517 | g_return_val_if_fail(chat != NULL, NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1518 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1519 | return chat->topic; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1520 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1521 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1522 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1523 | purple_chat_conversation_set_id(PurpleChatConversation *chat, int id) |
|
1573
878f7c59ee85
[gaim-migrate @ 1583]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1532
diff
changeset
|
1524 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1525 | g_return_if_fail(chat != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1526 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1527 | chat->id = id; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1528 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1529 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1530 | int |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1531 | purple_chat_conversation_get_id(const PurpleChatConversation *chat) |
|
4359
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_val_if_fail(chat != NULL, -1); |
| 3951 | 1534 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1535 | return chat->id; |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1536 | } |
| 3951 | 1537 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1538 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1539 | purple_chat_conversation_write(PurpleChatConversation *chat, const char *who, const char *message, |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1540 | PurpleConversationMessageFlags flags, time_t mtime) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1541 | { |
| 15884 | 1542 | PurpleAccount *account; |
| 1543 | PurpleConversation *conv; | |
| 1544 | PurpleConnection *gc; | |
| 3866 | 1545 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1546 | g_return_if_fail(chat != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1547 | g_return_if_fail(who != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1548 | g_return_if_fail(message != NULL); |
| 3866 | 1549 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1550 | conv = purple_chat_conversation_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
|
1551 | gc = purple_conversation_get_connection(conv); |
| 15884 | 1552 | account = purple_connection_get_account(gc); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1553 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1554 | /* Don't display this if the person who wrote it is ignored. */ |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1555 | if (purple_chat_conversation_is_ignored_user(chat, who)) |
|
1573
878f7c59ee85
[gaim-migrate @ 1583]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1532
diff
changeset
|
1556 | return; |
| 3677 | 1557 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1558 | if (!(flags & PURPLE_CONVERSATION_MESSAGE_WHISPER)) { |
|
25721
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25716
diff
changeset
|
1559 | const char *str; |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25716
diff
changeset
|
1560 | |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25716
diff
changeset
|
1561 | str = purple_normalize(account, who); |
|
d49e93a18899
*** Plucked rev 0257ab6e (wabz@pidgin.im):
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25716
diff
changeset
|
1562 | |
|
26889
4de21edc9dc7
Chat's nick is normalized. So normalize before comparing with it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26762
diff
changeset
|
1563 | if (purple_strequal(str, chat->nick)) { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1564 | flags |= PURPLE_CONVERSATION_MESSAGE_SEND; |
| 8158 | 1565 | } else { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1566 | flags |= PURPLE_CONVERSATION_MESSAGE_RECV; |
| 15884 | 1567 | |
| 1568 | if (purple_utf8_has_word(message, chat->nick)) | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1569 | flags |= PURPLE_CONVERSATION_MESSAGE_NICK; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1570 | } |
| 3677 | 1571 | } |
| 3705 | 1572 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1573 | /* 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
|
1574 | if (conv->ui_ops != NULL && conv->ui_ops->write_chat != NULL) |
|
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4425
diff
changeset
|
1575 | conv->ui_ops->write_chat(conv, who, message, flags, mtime); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1576 | else |
| 15884 | 1577 | purple_conversation_write(conv, who, message, flags, mtime); |
|
1573
878f7c59ee85
[gaim-migrate @ 1583]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1532
diff
changeset
|
1578 | } |
|
878f7c59ee85
[gaim-migrate @ 1583]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1532
diff
changeset
|
1579 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1580 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1581 | purple_chat_conversation_send(PurpleChatConversation *chat, const char *message) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1582 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1583 | purple_chat_conversation_send_with_flags(chat, message, 0); |
|
11921
fe74264ce36c
[gaim-migrate @ 14212]
Evan Schoenberg <evands@pidgin.im>
parents:
11869
diff
changeset
|
1584 | } |
|
fe74264ce36c
[gaim-migrate @ 14212]
Evan Schoenberg <evands@pidgin.im>
parents:
11869
diff
changeset
|
1585 | |
|
fe74264ce36c
[gaim-migrate @ 14212]
Evan Schoenberg <evands@pidgin.im>
parents:
11869
diff
changeset
|
1586 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1587 | purple_chat_conversation_send_with_flags(PurpleChatConversation *chat, const char *message, PurpleConversationMessageFlags flags) |
|
11921
fe74264ce36c
[gaim-migrate @ 14212]
Evan Schoenberg <evands@pidgin.im>
parents:
11869
diff
changeset
|
1588 | { |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1589 | g_return_if_fail(chat != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1590 | g_return_if_fail(message != NULL); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1591 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1592 | common_send(purple_chat_conversation_get_conversation(chat), message, flags); |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1593 | } |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1594 | |
|
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1595 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1596 | purple_chat_conversation_add_user(PurpleChatConversation *chat, const char *user, |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1597 | const char *extra_msg, PurpleChatConversationBuddyFlags flags, |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1598 | gboolean new_arrival) |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1599 | { |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1600 | GList *users = g_list_append(NULL, (char *)user); |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1601 | GList *extra_msgs = g_list_append(NULL, (char *)extra_msg); |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1602 | GList *flags2 = g_list_append(NULL, GINT_TO_POINTER(flags)); |
| 11581 | 1603 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1604 | purple_chat_conversation_add_users(chat, users, extra_msgs, flags2, new_arrival); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1605 | |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1606 | g_list_free(users); |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1607 | g_list_free(extra_msgs); |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1608 | g_list_free(flags2); |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1609 | } |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1610 | |
|
14043
3b7f131dbb20
[gaim-migrate @ 16548]
Mark Doliner <markdoliner@pidgin.im>
parents:
14031
diff
changeset
|
1611 | static int |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1612 | purple_chat_conversation_buddy_compare(PurpleChatConversationBuddy *a, PurpleChatConversationBuddy *b) |
|
14027
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1613 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1614 | PurpleChatConversationBuddyFlags f1 = 0, f2 = 0; |
|
14027
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1615 | char *user1 = NULL, *user2 = NULL; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1616 | gint ret = 0; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1617 | |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1618 | if (a) { |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1619 | f1 = a->flags; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1620 | if (a->alias_key) |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1621 | user1 = a->alias_key; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1622 | else if (a->name) |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1623 | user1 = a->name; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1624 | } |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1625 | |
|
14027
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1626 | if (b) { |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1627 | f2 = b->flags; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1628 | if (b->alias_key) |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1629 | user2 = b->alias_key; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1630 | else if (b->name) |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1631 | user2 = b->name; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1632 | } |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1633 | |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1634 | if (user1 == NULL || user2 == NULL) { |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1635 | if (!(user1 == NULL && user2 == NULL)) |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1636 | ret = (user1 == NULL) ? -1: 1; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1637 | } else if (f1 != f2) { |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1638 | /* sort more important users first */ |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1639 | ret = (f1 > f2) ? -1 : 1; |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1640 | } else if (a->buddy != b->buddy) { |
|
14027
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1641 | ret = a->buddy ? -1 : 1; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1642 | } else { |
|
17155
143ff2796376
Replace strcasecmp() calls with glib equivalents.
Richard Laager <rlaager@pidgin.im>
parents:
17106
diff
changeset
|
1643 | ret = purple_utf8_strcasecmp(user1, user2); |
|
14027
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1644 | } |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1645 | |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1646 | return ret; |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1647 | } |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1648 | |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1649 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1650 | purple_chat_conversation_add_users(PurpleChatConversation *chat, GList *users, GList *extra_msgs, |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1651 | GList *flags, gboolean new_arrivals) |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1652 | { |
| 15884 | 1653 | PurpleConversation *conv; |
| 1654 | PurpleConversationUiOps *ops; | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1655 | PurpleChatConversationBuddy *cbuddy; |
| 15884 | 1656 | PurpleConnection *gc; |
| 1657 | PurplePluginProtocolInfo *prpl_info; | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1658 | GList *ul, *fl; |
|
14027
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1659 | GList *cbuddies = NULL; |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1660 | |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1661 | g_return_if_fail(chat != NULL); |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1662 | g_return_if_fail(users != NULL); |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1663 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1664 | conv = purple_chat_conversation_get_conversation(chat); |
| 15884 | 1665 | ops = purple_conversation_get_ui_ops(conv); |
| 1666 | ||
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
1667 | gc = purple_conversation_get_connection(conv); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1668 | 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
|
1669 | 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
|
1670 | g_return_if_fail(prpl_info != NULL); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1671 | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1672 | ul = users; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1673 | fl = flags; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1674 | while ((ul != NULL) && (fl != NULL)) { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1675 | const char *user = (const char *)ul->data; |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1676 | const char *alias = user; |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1677 | gboolean quiet; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1678 | PurpleChatConversationBuddyFlags flag = GPOINTER_TO_INT(fl->data); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1679 | const char *extra_msg = (extra_msgs ? extra_msgs->data : NULL); |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1680 | |
|
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
|
1681 | 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
|
1682 | if (purple_strequal(chat->nick, purple_normalize(conv->account, user))) { |
|
34589
428e92c79631
Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents:
33578
diff
changeset
|
1683 | const char *alias2 = purple_account_get_private_alias(conv->account); |
|
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
|
1684 | 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
|
1685 | 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
|
1686 | 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
|
1687 | { |
|
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
|
1688 | 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
|
1689 | 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
|
1690 | 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
|
1691 | } |
|
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
|
1692 | } 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
|
1693 | PurpleBuddy *buddy; |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32633
diff
changeset
|
1694 | 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
|
1695 | alias = purple_buddy_get_contact_alias(buddy); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1696 | } |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1697 | } |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1698 | |
| 15884 | 1699 | 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
|
1700 | "chat-buddy-joining", conv, user, flag)) || |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1701 | purple_chat_conversation_is_ignored_user(chat, user); |
|
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1702 | |
|
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1703 | cbuddy = purple_chat_conversation_buddy_new(user, alias, flag); |
|
18360
24a00376266d
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18193
diff
changeset
|
1704 | 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
|
1705 | |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
1706 | 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
|
1707 | 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
|
1708 | |
|
14027
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1709 | cbuddies = g_list_prepend(cbuddies, cbuddy); |
|
11454
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 | 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
|
1712 | char *alias_esc = g_markup_escape_text(alias, -1); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1713 | char *tmp; |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1714 | |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1715 | 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
|
1716 | tmp = g_strdup_printf(_("%s entered the room."), alias_esc); |
|
12840
548fd34f1f87
[gaim-migrate @ 15188]
Richard Laager <rlaager@pidgin.im>
parents:
12797
diff
changeset
|
1717 | else { |
|
23559
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
1718 | 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
|
1719 | 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
|
1720 | 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
|
1721 | g_free(extra_msg_esc); |
|
12840
548fd34f1f87
[gaim-migrate @ 15188]
Richard Laager <rlaager@pidgin.im>
parents:
12797
diff
changeset
|
1722 | } |
|
23559
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
1723 | g_free(alias_esc); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1724 | |
|
18088
2e08852cc6c5
use the new NO_LINKIFY flag for join and part messages
Nathan Walp <nwalp@pidgin.im>
parents:
18087
diff
changeset
|
1725 | purple_conversation_write(conv, NULL, tmp, |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1726 | PURPLE_CONVERSATION_MESSAGE_SYSTEM | PURPLE_CONVERSATION_MESSAGE_NO_LINKIFY, |
|
18088
2e08852cc6c5
use the new NO_LINKIFY flag for join and part messages
Nathan Walp <nwalp@pidgin.im>
parents:
18087
diff
changeset
|
1727 | time(NULL)); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1728 | g_free(tmp); |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1729 | } |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
1730 | |
| 15884 | 1731 | purple_signal_emit(purple_conversations_get_handle(), |
|
14031
c9283f5bf3da
[gaim-migrate @ 16527]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
14027
diff
changeset
|
1732 | "chat-buddy-joined", conv, user, flag, new_arrivals); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1733 | ul = ul->next; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1734 | fl = fl->next; |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1735 | if (extra_msgs != NULL) |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1736 | extra_msgs = extra_msgs->next; |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1737 | } |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1738 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1739 | cbuddies = g_list_sort(cbuddies, (GCompareFunc)purple_chat_conversation_buddy_compare); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
1740 | |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1741 | if (ops != NULL && ops->chat_add_users != NULL) |
|
14027
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1742 | ops->chat_add_users(conv, cbuddies, new_arrivals); |
|
708c2047424f
[gaim-migrate @ 16521]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
13985
diff
changeset
|
1743 | |
|
14031
c9283f5bf3da
[gaim-migrate @ 16527]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
14027
diff
changeset
|
1744 | g_list_free(cbuddies); |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1745 | } |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1746 | |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1747 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1748 | purple_chat_conversation_rename_user(PurpleChatConversation *chat, const char *old_user, |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1749 | const char *new_user) |
|
472
9a5b8da2d760
[gaim-migrate @ 482]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
411
diff
changeset
|
1750 | { |
| 15884 | 1751 | PurpleConversation *conv; |
| 1752 | PurpleConversationUiOps *ops; | |
| 1753 | PurpleConnection *gc; | |
| 1754 | PurplePluginProtocolInfo *prpl_info; | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1755 | PurpleChatConversationBuddy *cb; |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1756 | PurpleChatConversationBuddyFlags flags; |
|
11485
fe334b13d1d0
[gaim-migrate @ 13727]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11481
diff
changeset
|
1757 | const char *new_alias = new_user; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1758 | char tmp[BUF_LONG]; |
|
11485
fe334b13d1d0
[gaim-migrate @ 13727]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11481
diff
changeset
|
1759 | gboolean is_me = FALSE; |
| 3866 | 1760 | |
|
5677
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1761 | g_return_if_fail(chat != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1762 | g_return_if_fail(old_user != NULL); |
|
2cce4c8654e9
[gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1763 | g_return_if_fail(new_user != NULL); |
|
960
c4012584334f
[gaim-migrate @ 970]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
936
diff
changeset
|
1764 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1765 | conv = purple_chat_conversation_get_conversation(chat); |
| 15884 | 1766 | ops = purple_conversation_get_ui_ops(conv); |
| 1767 | ||
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
1768 | gc = purple_conversation_get_connection(conv); |
|
11485
fe334b13d1d0
[gaim-migrate @ 13727]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11481
diff
changeset
|
1769 | 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
|
1770 | 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
|
1771 | g_return_if_fail(prpl_info != NULL); |
|
fe334b13d1d0
[gaim-migrate @ 13727]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11481
diff
changeset
|
1772 | |
|
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
|
1773 | 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
|
1774 | const char *alias; |
|
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1775 | |
|
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1776 | /* Note this for later. */ |
|
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1777 | is_me = TRUE; |
|
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1778 | |
|
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
|
1779 | if(!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
|
34589
428e92c79631
Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents:
33578
diff
changeset
|
1780 | alias = purple_account_get_private_alias(conv->account); |
|
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
|
1781 | 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
|
1782 | 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
|
1783 | 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
|
1784 | { |
|
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
|
1785 | 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
|
1786 | 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
|
1787 | 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
|
1788 | } |
|
11500
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1789 | } |
|
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1790 | } else if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
| 15884 | 1791 | PurpleBuddy *buddy; |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32633
diff
changeset
|
1792 | if ((buddy = purple_find_buddy(purple_connection_get_account(gc), new_user)) != NULL) |
| 15884 | 1793 | new_alias = purple_buddy_get_contact_alias(buddy); |
|
11485
fe334b13d1d0
[gaim-migrate @ 13727]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11481
diff
changeset
|
1794 | } |
|
fe334b13d1d0
[gaim-migrate @ 13727]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11481
diff
changeset
|
1795 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1796 | flags = purple_chat_conversation_user_get_flags(chat, old_user); |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1797 | cb = purple_chat_conversation_buddy_new(new_user, new_alias, flags); |
|
18360
24a00376266d
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18193
diff
changeset
|
1798 | 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
|
1799 | |
|
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
1800 | 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
|
1801 | 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
|
1802 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1803 | if (ops != NULL && ops->chat_rename_user != NULL) |
|
11485
fe334b13d1d0
[gaim-migrate @ 13727]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11481
diff
changeset
|
1804 | ops->chat_rename_user(conv, old_user, new_user, new_alias); |
| 3671 | 1805 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1806 | cb = purple_chat_conversation_find_buddy(chat, old_user); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1807 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1808 | if (cb) { |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
1809 | 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
|
1810 | g_hash_table_remove(chat->users, cb->name); |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1811 | purple_chat_conversation_buddy_destroy(cb); |
|
4506
e4ef1834b415
[gaim-migrate @ 4781]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
1812 | } |
|
1428
c14bab2b74bb
[gaim-migrate @ 1438]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1414
diff
changeset
|
1813 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1814 | if (purple_chat_conversation_is_ignored_user(chat, old_user)) { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1815 | purple_chat_conversation_unignore(chat, old_user); |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1816 | purple_chat_conversation_ignore(chat, new_user); |
|
1428
c14bab2b74bb
[gaim-migrate @ 1438]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1414
diff
changeset
|
1817 | } |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1818 | else if (purple_chat_conversation_is_ignored_user(chat, new_user)) |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1819 | purple_chat_conversation_unignore(chat, new_user); |
|
1573
878f7c59ee85
[gaim-migrate @ 1583]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1532
diff
changeset
|
1820 | |
|
11500
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1821 | if (is_me) |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1822 | purple_chat_conversation_set_nick(chat, new_user); |
| 15884 | 1823 | |
|
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
|
1824 | if (purple_prefs_get_bool("/purple/conversations/chat/show_nick_change") && |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1825 | !purple_chat_conversation_is_ignored_user(chat, new_user)) { |
|
11481
498f90760488
[gaim-migrate @ 13723]
Richard Laager <rlaager@pidgin.im>
parents:
11478
diff
changeset
|
1826 | |
|
11500
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
1827 | if (is_me) { |
|
12853
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1828 | char *escaped = g_markup_escape_text(new_user, -1); |
| 8158 | 1829 | g_snprintf(tmp, sizeof(tmp), |
|
12853
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1830 | _("You are now known as %s"), escaped); |
|
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1831 | g_free(escaped); |
| 8158 | 1832 | } else { |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1833 | const char *old_alias = old_user; |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1834 | const char *new_alias = new_user; |
|
12853
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1835 | char *escaped; |
|
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1836 | char *escaped2; |
| 11581 | 1837 | |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1838 | if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
| 15884 | 1839 | PurpleBuddy *buddy; |
| 1840 | ||
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32633
diff
changeset
|
1841 | if ((buddy = purple_find_buddy(purple_connection_get_account(gc), old_user)) != NULL) |
| 15884 | 1842 | 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
|
1843 | if ((buddy = purple_find_buddy(purple_connection_get_account(gc), new_user)) != NULL) |
| 15884 | 1844 | new_alias = purple_buddy_get_contact_alias(buddy); |
|
11454
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1845 | } |
|
a604c2097a6e
[gaim-migrate @ 13693]
Richard Laager <rlaager@pidgin.im>
parents:
11338
diff
changeset
|
1846 | |
|
12853
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1847 | escaped = g_markup_escape_text(old_alias, -1); |
|
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1848 | escaped2 = g_markup_escape_text(new_alias, -1); |
| 8158 | 1849 | g_snprintf(tmp, sizeof(tmp), |
|
12853
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1850 | _("%s is now known as %s"), escaped, escaped2); |
|
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1851 | g_free(escaped); |
|
4afa7cfd2741
[gaim-migrate @ 15203]
Richard Laager <rlaager@pidgin.im>
parents:
12850
diff
changeset
|
1852 | g_free(escaped2); |
| 8158 | 1853 | } |
|
1573
878f7c59ee85
[gaim-migrate @ 1583]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1532
diff
changeset
|
1854 | |
| 18090 | 1855 | purple_conversation_write(conv, NULL, tmp, |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1856 | PURPLE_CONVERSATION_MESSAGE_SYSTEM | PURPLE_CONVERSATION_MESSAGE_NO_LINKIFY, |
| 18090 | 1857 | time(NULL)); |
|
2843
6dd0497437e3
[gaim-migrate @ 2856]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2834
diff
changeset
|
1858 | } |
|
6dd0497437e3
[gaim-migrate @ 2856]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2834
diff
changeset
|
1859 | } |
|
6dd0497437e3
[gaim-migrate @ 2856]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2834
diff
changeset
|
1860 | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
1861 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1862 | purple_chat_conversation_remove_user(PurpleChatConversation *chat, const char *user, const char *reason) |
|
2843
6dd0497437e3
[gaim-migrate @ 2856]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2834
diff
changeset
|
1863 | { |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1864 | GList *users = g_list_append(NULL, (char *)user); |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1865 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1866 | purple_chat_conversation_remove_users(chat, users, reason); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1867 | |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1868 | g_list_free(users); |
|
1759
e5987be557ab
[gaim-migrate @ 1769]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1757
diff
changeset
|
1869 | } |
|
2191
a40e37f5bf27
[gaim-migrate @ 2201]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2167
diff
changeset
|
1870 | |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1871 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1872 | purple_chat_conversation_remove_users(PurpleChatConversation *chat, GList *users, const char *reason) |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1873 | { |
| 15884 | 1874 | PurpleConversation *conv; |
| 1875 | PurpleConnection *gc; | |
| 1876 | PurplePluginProtocolInfo *prpl_info; | |
| 1877 | PurpleConversationUiOps *ops; | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1878 | PurpleChatConversationBuddy *cb; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1879 | GList *l; |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1880 | gboolean quiet; |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1881 | |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1882 | g_return_if_fail(chat != NULL); |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1883 | g_return_if_fail(users != NULL); |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1884 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1885 | conv = purple_chat_conversation_get_conversation(chat); |
| 15884 | 1886 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
1887 | gc = purple_conversation_get_connection(conv); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1888 | 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
|
1889 | 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
|
1890 | g_return_if_fail(prpl_info != NULL); |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1891 | |
| 15884 | 1892 | ops = purple_conversation_get_ui_ops(conv); |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1893 | |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1894 | for (l = users; l != NULL; l = l->next) { |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
1895 | const char *user = (const char *)l->data; |
| 15884 | 1896 | 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
|
1897 | "chat-buddy-leaving", conv, user, reason)) | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1898 | purple_chat_conversation_is_ignored_user(chat, user); |
|
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1899 | |
|
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1900 | cb = purple_chat_conversation_find_buddy(chat, user); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1901 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1902 | if (cb) { |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
1903 | 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
|
1904 | g_hash_table_remove(chat->users, cb->name); |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1905 | purple_chat_conversation_buddy_destroy(cb); |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1906 | } |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
1907 | |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1908 | /* 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
|
1909 | |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1910 | if (!quiet) { |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1911 | 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
|
1912 | char *alias_esc; |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1913 | char *tmp; |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1914 | |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1915 | if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
| 15884 | 1916 | PurpleBuddy *buddy; |
| 1917 | ||
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32633
diff
changeset
|
1918 | if ((buddy = purple_find_buddy(purple_connection_get_account(gc), user)) != NULL) |
| 15884 | 1919 | alias = purple_buddy_get_contact_alias(buddy); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1920 | } |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1921 | |
|
23559
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
1922 | alias_esc = g_markup_escape_text(alias, -1); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1923 | |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1924 | 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
|
1925 | 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
|
1926 | else { |
|
23559
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
1927 | char *reason_esc = g_markup_escape_text(reason, -1); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1928 | 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
|
1929 | 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
|
1930 | g_free(reason_esc); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1931 | } |
|
23559
e7847951a0c6
Give some variables holding escaped versions of other strings more meaningful names.
Will Thompson <resiak@pidgin.im>
parents:
23558
diff
changeset
|
1932 | g_free(alias_esc); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1933 | |
|
18088
2e08852cc6c5
use the new NO_LINKIFY flag for join and part messages
Nathan Walp <nwalp@pidgin.im>
parents:
18087
diff
changeset
|
1934 | purple_conversation_write(conv, NULL, tmp, |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1935 | PURPLE_CONVERSATION_MESSAGE_SYSTEM | PURPLE_CONVERSATION_MESSAGE_NO_LINKIFY, |
|
18088
2e08852cc6c5
use the new NO_LINKIFY flag for join and part messages
Nathan Walp <nwalp@pidgin.im>
parents:
18087
diff
changeset
|
1936 | time(NULL)); |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1937 | g_free(tmp); |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1938 | } |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1939 | |
| 15884 | 1940 | purple_signal_emit(purple_conversations_get_handle(), "chat-buddy-left", |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6478
diff
changeset
|
1941 | conv, user, reason); |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1942 | } |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1943 | |
|
12867
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1944 | if (ops != NULL && ops->chat_remove_users != NULL) |
|
080393331813
[gaim-migrate @ 15218]
Andrea Canciani <ranma42@users.sourceforge.net>
parents:
12853
diff
changeset
|
1945 | ops->chat_remove_users(conv, users); |
|
6407
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1946 | } |
|
d67b6a6ba7d2
[gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents:
6405
diff
changeset
|
1947 | |
|
6414
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
1948 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1949 | purple_chat_conversation_clear_users(PurpleChatConversation *chat) |
|
6414
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
1950 | { |
| 15884 | 1951 | PurpleConversation *conv; |
| 1952 | PurpleConversationUiOps *ops; | |
|
18187
d560300fa2ab
Re-apply a good change from 2d8ea56b90971e7851442d96b7d74ecb4f052126:
Richard Laager <rlaager@pidgin.im>
parents:
18122
diff
changeset
|
1953 | GList *users; |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1954 | GList *l; |
|
18187
d560300fa2ab
Re-apply a good change from 2d8ea56b90971e7851442d96b7d74ecb4f052126:
Richard Laager <rlaager@pidgin.im>
parents:
18122
diff
changeset
|
1955 | GList *names = NULL; |
|
6414
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
1956 | |
|
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
1957 | g_return_if_fail(chat != NULL); |
|
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
1958 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1959 | conv = purple_chat_conversation_get_conversation(chat); |
| 15884 | 1960 | 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
|
1961 | users = chat->in_room; |
|
6414
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
1962 | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1963 | if (ops != NULL && ops->chat_remove_users != NULL) { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1964 | for (l = users; l; l = l->next) { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1965 | PurpleChatConversationBuddy *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
|
1966 | names = g_list_prepend(names, cb->name); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1967 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1968 | ops->chat_remove_users(conv, names); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1969 | g_list_free(names); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1970 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1971 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1972 | for (l = users; l; l = l->next) |
|
6414
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
1973 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1974 | PurpleChatConversationBuddy *cb = l->data; |
| 15884 | 1975 | |
| 1976 | purple_signal_emit(purple_conversations_get_handle(), | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1977 | "chat-buddy-leaving", conv, cb->name, NULL); |
| 15884 | 1978 | purple_signal_emit(purple_conversations_get_handle(), |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1979 | "chat-buddy-left", conv, cb->name, NULL); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1980 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1981 | purple_chat_conversation_buddy_destroy(cb); |
|
6414
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
1982 | } |
|
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
1983 | |
|
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
|
1984 | 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
|
1985 | |
|
6414
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
1986 | g_list_free(users); |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
1987 | chat->in_room = NULL; |
|
6414
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
1988 | } |
|
f78eb072fcc0
[gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents:
6407
diff
changeset
|
1989 | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1990 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1991 | gboolean |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
1992 | purple_chat_conversation_find_user(PurpleChatConversation *chat, const char *user) |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1993 | { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1994 | g_return_val_if_fail(chat != NULL, FALSE); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1995 | g_return_val_if_fail(user != NULL, FALSE); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1996 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
1997 | return (purple_chat_conversation_find_buddy(chat, user) != NULL); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1998 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
1999 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2000 | void |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2001 | purple_chat_conversation_user_set_flags(PurpleChatConversation *chat, const char *user, |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2002 | PurpleChatConversationBuddyFlags flags) |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2003 | { |
| 15884 | 2004 | PurpleConversation *conv; |
| 2005 | PurpleConversationUiOps *ops; | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2006 | PurpleChatConversationBuddy *cb; |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2007 | PurpleChatConversationBuddyFlags oldflags; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2008 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2009 | g_return_if_fail(chat != NULL); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2010 | g_return_if_fail(user != NULL); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2011 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
2012 | cb = purple_chat_conversation_find_buddy(chat, user); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2013 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2014 | if (!cb) |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2015 | return; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2016 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2017 | if (flags == cb->flags) |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2018 | return; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2019 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2020 | oldflags = cb->flags; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2021 | cb->flags = flags; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2022 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2023 | conv = purple_chat_conversation_get_conversation(chat); |
| 15884 | 2024 | ops = purple_conversation_get_ui_ops(conv); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2025 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2026 | if (ops != NULL && ops->chat_update_user != NULL) |
|
11500
e0965fb5bcd8
[gaim-migrate @ 13745]
Richard Laager <rlaager@pidgin.im>
parents:
11485
diff
changeset
|
2027 | ops->chat_update_user(conv, user); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2028 | |
| 15884 | 2029 | purple_signal_emit(purple_conversations_get_handle(), |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2030 | "chat-buddy-flags", conv, user, oldflags, flags); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2031 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2032 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2033 | PurpleChatConversationBuddyFlags |
|
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2034 | purple_chat_conversation_user_get_flags(PurpleChatConversation *chat, const char *user) |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2035 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2036 | PurpleChatConversationBuddy *cb; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2037 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2038 | g_return_val_if_fail(chat != NULL, 0); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2039 | g_return_val_if_fail(user != NULL, 0); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2040 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
2041 | cb = purple_chat_conversation_find_buddy(chat, user); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2042 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2043 | if (!cb) |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2044 | return PURPLE_CHAT_CONVERSATION_BUDDY_NONE; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2045 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2046 | return cb->flags; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2047 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2048 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2049 | void purple_chat_conversation_set_nick(PurpleChatConversation *chat, const char *nick) { |
| 8158 | 2050 | g_return_if_fail(chat != NULL); |
| 2051 | ||
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
2052 | g_free(chat->nick); |
| 15884 | 2053 | chat->nick = g_strdup(purple_normalize(chat->conv->account, nick)); |
| 8158 | 2054 | } |
| 2055 | ||
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2056 | const char *purple_chat_conversation_get_nick(PurpleChatConversation *chat) { |
| 8158 | 2057 | g_return_val_if_fail(chat != NULL, NULL); |
| 2058 | ||
| 2059 | return chat->nick; | |
| 2060 | } | |
| 2061 | ||
| 8256 | 2062 | void |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
2063 | purple_chat_conversation_leave(PurpleChatConversation *chat) |
| 8256 | 2064 | { |
| 2065 | g_return_if_fail(chat != NULL); | |
| 2066 | ||
| 2067 | chat->left = TRUE; | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2068 | purple_conversation_update(chat->conv, PURPLE_CONVERSATION_UPDATE_CHATLEFT); |
| 8256 | 2069 | } |
| 2070 | ||
|
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
|
2071 | 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
|
2072 | 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
|
2073 | { |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2074 | PurpleConversation *conv; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2075 | PurpleChatConversationPrivate *priv; |
|
26762
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2076 | 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
|
2077 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2078 | conv = data; |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2079 | chat = PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv); |
|
26762
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2080 | 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
|
2081 | 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
|
2082 | |
|
32698
154e4a2a6287
Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32690
diff
changeset
|
2083 | 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
|
2084 | } |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2085 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2086 | void purple_chat_conversation_invite_user(PurpleChatConversation *chat, const char *user, |
|
26762
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2087 | 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
|
2088 | { |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2089 | 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
|
2090 | 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
|
2091 | 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
|
2092 | 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
|
2093 | 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
|
2094 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2095 | 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
|
2096 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2097 | 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
|
2098 | 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
|
2099 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2100 | 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
|
2101 | 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
|
2102 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2103 | 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
|
2104 | serv_chat_invite(purple_account_get_connection(account), |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2105 | purple_chat_conversation_get_id(chat), message, user); |
|
26762
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2106 | 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
|
2107 | } |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2108 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2109 | 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
|
2110 | 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
|
2111 | 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
|
2112 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2113 | 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
|
2114 | 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
|
2115 | 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
|
2116 | 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
|
2117 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2118 | 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
|
2119 | 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
|
2120 | |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2121 | 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
|
2122 | _("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
|
2123 | "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
|
2124 | 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
|
2125 | _("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
|
2126 | _("Cancel"), NULL, |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2127 | account, user, conv, |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2128 | 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
|
2129 | } |
|
8cd83b679338
Open a chat-invite dialog when a buddy is dragged onto a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26752
diff
changeset
|
2130 | |
| 8256 | 2131 | gboolean |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2132 | purple_chat_conversation_has_left(PurpleChatConversation *chat) |
| 8256 | 2133 | { |
| 2134 | g_return_val_if_fail(chat != NULL, TRUE); | |
| 2135 | ||
| 2136 | return chat->left; | |
| 2137 | } | |
|
18360
24a00376266d
Set and use convchatbuddy->buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18193
diff
changeset
|
2138 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2139 | PurpleChatConversationBuddy * |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
2140 | purple_chat_conversation_buddy_new(const char *name, const char *alias, PurpleChatConversationBuddyFlags flags) |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2141 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2142 | PurpleChatConversationBuddy *cb; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2143 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2144 | g_return_val_if_fail(name != NULL, NULL); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2145 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2146 | cb = g_new0(PurpleChatConversationBuddy, 1); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2147 | cb->name = g_strdup(name); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2148 | cb->flags = flags; |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
2149 | 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
|
2150 | 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
|
2151 | g_free, g_free); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2152 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2153 | PURPLE_DBUS_REGISTER_POINTER(cb, PurpleChatConversationBuddy); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2154 | return cb; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2155 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2156 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2157 | PurpleChatConversationBuddy * |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
2158 | purple_chat_conversation_find_buddy(PurpleChatConversation *chat, const char *name) |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2159 | { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2160 | g_return_val_if_fail(chat != NULL, NULL); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2161 | g_return_val_if_fail(name != NULL, NULL); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2162 | |
|
31900
bd3ee9587add
conversation: O(1) purple_conv_chat_cb_find
Paul Aurich <darkrain42@pidgin.im>
parents:
31643
diff
changeset
|
2163 | return g_hash_table_lookup(chat->users, name); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2164 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2165 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2166 | void |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
2167 | purple_chat_conversation_buddy_destroy(PurpleChatConversationBuddy *cb) |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2168 | { |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
2169 | if (cb == NULL) |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14059
diff
changeset
|
2170 | return; |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2171 | |
|
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
|
2172 | 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
|
2173 | "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
|
2174 | |
|
14059
0acd139472fd
[gaim-migrate @ 16582]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
14043
diff
changeset
|
2175 | g_free(cb->alias); |
|
0acd139472fd
[gaim-migrate @ 16582]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents:
14043
diff
changeset
|
2176 | g_free(cb->alias_key); |
|
13234
1d8e569b2053
[gaim-migrate @ 15598]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13120
diff
changeset
|
2177 | 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
|
2178 | g_hash_table_destroy(cb->attributes); |
|
11146
c56333373e3c
[gaim-migrate @ 13217]
Piotr Zielinski <zielaj@users.sourceforge.net>
parents:
11137
diff
changeset
|
2179 | |
| 15884 | 2180 | PURPLE_DBUS_UNREGISTER_POINTER(cb); |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2181 | g_free(cb); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2182 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2183 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
2184 | void purple_chat_conversation_buddy_set_ui_data(PurpleChatConversationBuddy *cb, gpointer ui_data) |
|
32615
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2185 | { |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2186 | g_return_if_fail(cb != NULL); |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2187 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2188 | cb->ui_data = ui_data; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2189 | } |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2190 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
2191 | gpointer purple_chat_conversation_buddy_get_ui_data(const PurpleChatConversationBuddy *cb) |
|
32615
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2192 | { |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2193 | g_return_val_if_fail(cb != NULL, NULL); |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2194 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2195 | return cb->ui_data; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2196 | } |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2197 | |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2198 | const char * |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
2199 | purple_chat_conversation_buddy_get_alias(const PurpleChatConversationBuddy *cb) |
|
32615
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2200 | { |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2201 | g_return_val_if_fail(cb != NULL, NULL); |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2202 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2203 | return cb->alias; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2204 | } |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2205 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2206 | const char * |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
2207 | purple_chat_conversation_buddy_get_name(const PurpleChatConversationBuddy *cb) |
|
9554
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2208 | { |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2209 | g_return_val_if_fail(cb != NULL, NULL); |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2210 | |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2211 | return cb->name; |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2212 | } |
|
1609ba3612c3
[gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9528
diff
changeset
|
2213 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2214 | PurpleChatConversationBuddyFlags |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
2215 | purple_chat_conversation_buddy_get_flags(const PurpleChatConversationBuddy *cb) |
|
32615
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2216 | { |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2217 | g_return_val_if_fail(cb != NULL, PURPLE_CHAT_CONVERSATION_BUDDY_NONE); |
|
32615
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2218 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2219 | return cb->flags; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2220 | } |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2221 | |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
2222 | gboolean purple_chat_conversation_buddy_is_buddy(const PurpleChatConversationBuddy *cb) |
|
32615
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2223 | { |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2224 | g_return_val_if_fail(cb != NULL, FALSE); |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2225 | |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2226 | return cb->buddy; |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2227 | } |
|
18515e130606
Hide struct _PurpleConvChatBuddy.
Andrew Victor <andrew.victor@mxit.com>
parents:
32614
diff
changeset
|
2228 | |
|
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
|
2229 | const char * |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
2230 | purple_chat_conversation_buddy_get_attribute(PurpleChatConversationBuddy *cb, const char *key) |
|
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
|
2231 | { |
|
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
|
2232 | 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
|
2233 | 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
|
2234 | |
|
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
|
2235 | 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
|
2236 | } |
|
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
|
2237 | |
|
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
|
2238 | 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
|
2239 | 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
|
2240 | { |
|
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
|
2241 | 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
|
2242 | *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
|
2243 | } |
|
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
|
2244 | |
|
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
|
2245 | GList * |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
2246 | purple_chat_conversation_buddy_get_attribute_keys(PurpleChatConversationBuddy *cb) |
|
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
|
2247 | { |
|
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
|
2248 | 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
|
2249 | |
|
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
|
2250 | 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
|
2251 | |
|
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
|
2252 | 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
|
2253 | |
|
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
|
2254 | 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
|
2255 | } |
|
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
|
2256 | |
|
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
|
2257 | void |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
2258 | purple_chat_conversation_buddy_set_attribute(PurpleChatConversation *chat, PurpleChatConversationBuddy *cb, const char *key, const char *value) |
|
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
|
2259 | { |
|
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
|
2260 | 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
|
2261 | 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
|
2262 | |
|
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
|
2263 | 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
|
2264 | 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
|
2265 | 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
|
2266 | |
|
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
|
2267 | 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
|
2268 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2269 | conv = purple_chat_conversation_get_conversation(chat); |
|
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
|
2270 | 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
|
2271 | |
|
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
|
2272 | 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
|
2273 | 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
|
2274 | } |
|
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
|
2275 | |
|
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
|
2276 | void |
|
34600
3180ebbd06be
Added GObject structures, moved things around, renamed functions as GObject methods.
Ankit Vani <a@nevitus.org>
parents:
34599
diff
changeset
|
2277 | purple_chat_conversation_buddy_set_attributes(PurpleChatConversation *chat, PurpleChatConversationBuddy *cb, GList *keys, GList *values) |
|
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 | { |
|
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 | 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
|
2280 | 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
|
2281 | |
|
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
|
2282 | 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
|
2283 | 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
|
2284 | 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
|
2285 | |
|
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
|
2286 | 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
|
2287 | 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
|
2288 | 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
|
2289 | 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
|
2290 | } |
|
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
|
2291 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2292 | conv = purple_chat_conversation_get_conversation(chat); |
|
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
|
2293 | 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
|
2294 | |
|
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
|
2295 | 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
|
2296 | 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
|
2297 | } |
|
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
|
2298 | |
|
17265
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2299 | GList * |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2300 | 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
|
2301 | { |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2302 | GList *menu = NULL; |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2303 | |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2304 | 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
|
2305 | |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2306 | 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
|
2307 | "conversation-extended-menu", conv, &menu); |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2308 | return menu; |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2309 | } |
|
fd5b0ca330a3
New api function purple_conversation_get_extended_menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
2310 | |
|
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
|
2311 | 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
|
2312 | { |
|
19904
8abf4c2056eb
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2313 | 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
|
2314 | message_history_free(list); |
|
19904
8abf4c2056eb
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2315 | 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
|
2316 | |
|
805b37d317a2
Add a cleared-message-history conversation signal, and use it in Pidgin and Finch
Paul Aurich <darkrain42@pidgin.im>
parents:
31602
diff
changeset
|
2317 | 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
|
2318 | "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
|
2319 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2320 | |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2321 | 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
|
2322 | { |
|
19904
8abf4c2056eb
Keep the message history in PurpleConversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2323 | 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
|
2324 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2325 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2326 | const char *purple_conversation_message_get_sender(const PurpleConversationMessage *msg) |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2327 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2328 | 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
|
2329 | 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
|
2330 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2331 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2332 | const char *purple_conversation_message_get_message(const PurpleConversationMessage *msg) |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2333 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2334 | 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
|
2335 | 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
|
2336 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2337 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2338 | PurpleConversationMessageFlags purple_conversation_message_get_flags(const PurpleConversationMessage *msg) |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2339 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2340 | 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
|
2341 | 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
|
2342 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2343 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2344 | time_t purple_conversation_message_get_timestamp(const PurpleConversationMessage *msg) |
|
19590
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2345 | { |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2346 | 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
|
2347 | 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
|
2348 | } |
|
cf4e3e71bbc0
Store message history in a conversation, and provide API to access the history.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19118
diff
changeset
|
2349 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2350 | const char *purple_conversation_message_get_alias(const PurpleConversationMessage *msg) |
|
32690
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2351 | { |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2352 | g_return_val_if_fail(msg, NULL); |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2353 | return msg->alias; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2354 | } |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2355 | |
|
34599
0b1b22f5e2ec
Begun GObjectification of PurpleConversation.
Ankit Vani <a@nevitus.org>
parents:
34589
diff
changeset
|
2356 | PurpleConversation *purple_conversation_message_get_conv(const PurpleConversationMessage *msg) |
|
32690
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2357 | { |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2358 | g_return_val_if_fail(msg, NULL); |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2359 | return msg->conv; |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2360 | } |
|
ec1fca0a6b5d
Hide struct _PurpleConvMessage.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2361 | |
|
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
|
2362 | 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
|
2363 | { |
|
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
|
2364 | 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
|
2365 | |
|
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
|
2366 | 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
|
2367 | } |
|
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
|
2368 | |
|
32256
620e4580252a
These pointers should rather be marked const.
Andrew Victor <andrew.victor@mxit.com>
parents:
32253
diff
changeset
|
2369 | 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
|
2370 | { |
|
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
|
2371 | 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
|
2372 | |
|
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
|
2373 | 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
|
2374 | } |
|
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
|
2375 | |
|
33578
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2376 | |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2377 | gboolean |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2378 | purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline, |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2379 | const gchar *markup, gchar **error) |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2380 | { |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2381 | 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
|
2382 | 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
|
2383 | g_free(mark); |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2384 | g_free(err); |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2385 | return (status == PURPLE_CMD_STATUS_OK); |
|
d6d18b8e3c46
Revert my revision 485b1a932990
Mark Doliner <mark@kingant.net>
parents:
33567
diff
changeset
|
2386 | } |