Thu, 07 Feb 2019 05:17:39 -0500
Use g_value_dup_string where needed.
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1 | /* |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
2 | * purple |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
3 | * |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too numerous |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
6 | * source distribution. |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
7 | * |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
11 | * (at your option) any later version. |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
12 | * |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
16 | * GNU General Public License for more details. |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
17 | * |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
21 | */ |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
22 | #include "internal.h" |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
23 | #include "glibcompat.h" |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
24 | #include "conversationtypes.h" |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
25 | #include "debug.h" |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
26 | #include "enums.h" |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
27 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
28 | #define SEND_TYPED_TIMEOUT_SECONDS 5 |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
29 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
30 | typedef struct _PurpleChatConversationPrivate PurpleChatConversationPrivate; |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
31 | |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
32 | typedef struct _PurpleIMConversationPrivate PurpleIMConversationPrivate; |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
33 | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
34 | typedef struct _PurpleChatUserPrivate PurpleChatUserPrivate; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
35 | |
|
35460
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
36 | /* |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
37 | * Data specific to Chats. |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
38 | */ |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
39 | struct _PurpleChatConversationPrivate |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
40 | { |
|
35460
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
41 | GList *ignored; /* Ignored users. */ |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
42 | char *who; /* The person who set the topic. */ |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
43 | char *topic; /* The topic. */ |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
44 | int id; /* The chat ID. */ |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
45 | char *nick; /* Your nick in this chat. */ |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
46 | gboolean left; /* We left the chat and kept the window open */ |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
47 | GHashTable *users; /* Hash table of the users in the room. */ |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
48 | }; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
49 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
50 | /* Chat Property enums */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
51 | enum { |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
52 | CHAT_PROP_0, |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
53 | CHAT_PROP_TOPIC_WHO, |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
54 | CHAT_PROP_TOPIC, |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
55 | CHAT_PROP_ID, |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
56 | CHAT_PROP_NICK, |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
57 | CHAT_PROP_LEFT, |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
58 | CHAT_PROP_LAST |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
59 | }; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
60 | |
|
35460
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
61 | /* |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
62 | * Data specific to Instant Messages. |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
63 | */ |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
64 | struct _PurpleIMConversationPrivate |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
65 | { |
|
35460
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
66 | PurpleIMTypingState typing_state; /* The current typing state. */ |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
67 | guint typing_timeout; /* The typing timer handle. */ |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
68 | time_t type_again; /* The type again time. */ |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
69 | guint send_typed_timeout; /* The type again timer handle. */ |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
70 | PurpleBuddyIcon *icon; /* The buddy icon. */ |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
71 | }; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
72 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
73 | /* IM Property enums */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
74 | enum { |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
75 | IM_PROP_0, |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
76 | IM_PROP_TYPING_STATE, |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
77 | IM_PROP_ICON, |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
78 | IM_PROP_LAST |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
79 | }; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
80 | |
|
35460
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
81 | /* |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
82 | * Data for "Chat Buddies" |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
83 | */ |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
84 | struct _PurpleChatUserPrivate |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
85 | { |
|
35460
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
86 | PurpleChatConversation *chat; /* The chat */ |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
87 | char *name; /* The chat participant's name in the |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
88 | chat. */ |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
89 | char *alias; /* The chat participant's alias, if known; |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
90 | NULL otherwise. */ |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
91 | char *alias_key; /* A string by which this user will be |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
92 | sorted, or @c NULL if the user should be |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
93 | sorted by its @name. |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
94 | (This is currently always NULL. */ |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
95 | gboolean buddy; /* TRUE if this chat participant is on |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
96 | the buddy list; FALSE otherwise. */ |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
97 | PurpleChatUserFlags flags; /* A bitwise OR of flags for this |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
98 | participant, such as whether they |
|
96946e21fce5
Fix some more gtk-doc warnings till dnssrv
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
99 | are a channel operator. */ |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
100 | }; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
101 | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
102 | /* Chat User Property enums */ |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
103 | enum { |
|
34672
7293ef617eb9
Replaced CB_PROP_* enums with CU_PROP_*
Ankit Vani <a@nevitus.org>
parents:
34671
diff
changeset
|
104 | CU_PROP_0, |
|
7293ef617eb9
Replaced CB_PROP_* enums with CU_PROP_*
Ankit Vani <a@nevitus.org>
parents:
34671
diff
changeset
|
105 | CU_PROP_CHAT, |
|
7293ef617eb9
Replaced CB_PROP_* enums with CU_PROP_*
Ankit Vani <a@nevitus.org>
parents:
34671
diff
changeset
|
106 | CU_PROP_NAME, |
|
7293ef617eb9
Replaced CB_PROP_* enums with CU_PROP_*
Ankit Vani <a@nevitus.org>
parents:
34671
diff
changeset
|
107 | CU_PROP_ALIAS, |
|
7293ef617eb9
Replaced CB_PROP_* enums with CU_PROP_*
Ankit Vani <a@nevitus.org>
parents:
34671
diff
changeset
|
108 | CU_PROP_FLAGS, |
|
7293ef617eb9
Replaced CB_PROP_* enums with CU_PROP_*
Ankit Vani <a@nevitus.org>
parents:
34671
diff
changeset
|
109 | CU_PROP_LAST |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
110 | }; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
111 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
112 | static GParamSpec *chat_properties[CHAT_PROP_LAST]; |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
113 | static GParamSpec *im_properties[IM_PROP_LAST]; |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
114 | static GParamSpec *cu_properties[CU_PROP_LAST]; |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
115 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
116 | G_DEFINE_TYPE_WITH_PRIVATE(PurpleChatConversation, purple_chat_conversation, |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
117 | PURPLE_TYPE_CONVERSATION); |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
118 | G_DEFINE_TYPE_WITH_PRIVATE(PurpleIMConversation, purple_im_conversation, |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
119 | PURPLE_TYPE_CONVERSATION); |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
120 | G_DEFINE_TYPE_WITH_PRIVATE(PurpleChatUser, purple_chat_user, |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
121 | G_TYPE_OBJECT); |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
122 | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
123 | static int purple_chat_user_compare(PurpleChatUser *a, |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
124 | PurpleChatUser *b); |
|
34648
a6587d8cf907
Added missing API implementations to PurpleConversation and subclasses
Ankit Vani <a@nevitus.org>
parents:
34646
diff
changeset
|
125 | |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
126 | /************************************************************************** |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
127 | * IM Conversation API |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
128 | **************************************************************************/ |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
129 | static gboolean |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
130 | reset_typing_cb(gpointer data) |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
131 | { |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
132 | PurpleIMConversation *im = (PurpleIMConversation *)data; |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
133 | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
134 | purple_im_conversation_set_typing_state(im, PURPLE_IM_NOT_TYPING); |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
135 | purple_im_conversation_stop_typing_timeout(im); |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
136 | |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
137 | return FALSE; |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
138 | } |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
139 | |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
140 | static gboolean |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
141 | send_typed_cb(gpointer data) |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
142 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
143 | PurpleIMConversation *im = PURPLE_IM_CONVERSATION(data); |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
144 | PurpleConnection *gc; |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
145 | const char *name; |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
146 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
147 | g_return_val_if_fail(im != NULL, FALSE); |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
148 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
149 | gc = purple_conversation_get_connection(PURPLE_CONVERSATION(im)); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
150 | name = purple_conversation_get_name(PURPLE_CONVERSATION(im)); |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
151 | |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
152 | if (gc != NULL && name != NULL) { |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
153 | /* We set this to 1 so that PURPLE_IM_TYPING will be sent |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
154 | * if the Purple user types anything else. |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
155 | */ |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
156 | purple_im_conversation_set_type_again(im, 1); |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
157 | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35460
diff
changeset
|
158 | purple_serv_send_typing(gc, name, PURPLE_IM_TYPED); |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
159 | |
|
35176
b0659f31989d
Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents:
35098
diff
changeset
|
160 | purple_debug(PURPLE_DEBUG_MISC, "conversationtypes", "typed...\n"); |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
161 | } |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
162 | |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
163 | return FALSE; |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
164 | } |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
165 | |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
166 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
167 | purple_im_conversation_set_icon(PurpleIMConversation *im, PurpleBuddyIcon *icon) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
168 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
169 | PurpleIMConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
170 | purple_im_conversation_get_instance_private(im); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
171 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
172 | g_return_if_fail(priv != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
173 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
174 | if (priv->icon != icon) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
175 | { |
|
34831
da607046d658
Backed out changeset d9b286af48ba
Ankit Vani <a@nevitus.org>
parents:
34830
diff
changeset
|
176 | purple_buddy_icon_unref(priv->icon); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
177 | |
|
34831
da607046d658
Backed out changeset d9b286af48ba
Ankit Vani <a@nevitus.org>
parents:
34830
diff
changeset
|
178 | priv->icon = (icon == NULL ? NULL : purple_buddy_icon_ref(icon)); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
179 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
180 | g_object_notify_by_pspec(G_OBJECT(im), im_properties[IM_PROP_ICON]); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
181 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
182 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
183 | purple_conversation_update(PURPLE_CONVERSATION(im), |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
184 | PURPLE_CONVERSATION_UPDATE_ICON); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
185 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
186 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
187 | PurpleBuddyIcon * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
188 | purple_im_conversation_get_icon(PurpleIMConversation *im) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
189 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
190 | PurpleIMConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
191 | purple_im_conversation_get_instance_private(im); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
192 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
193 | g_return_val_if_fail(priv != NULL, NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
194 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
195 | return priv->icon; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
196 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
197 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
198 | void |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
199 | purple_im_conversation_set_typing_state(PurpleIMConversation *im, PurpleIMTypingState state) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
200 | { |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
201 | PurpleAccount *account; |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
202 | const char *name; |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
203 | PurpleIMConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
204 | purple_im_conversation_get_instance_private(im); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
205 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
206 | g_return_if_fail(priv != NULL); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
207 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
208 | name = purple_conversation_get_name(PURPLE_CONVERSATION(im)); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
209 | account = purple_conversation_get_account(PURPLE_CONVERSATION(im)); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
210 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
211 | if (priv->typing_state != state) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
212 | { |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
213 | priv->typing_state = state; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
214 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
215 | g_object_notify_by_pspec(G_OBJECT(im), |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
216 | im_properties[IM_PROP_TYPING_STATE]); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
217 | |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
218 | switch (state) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
219 | { |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
220 | case PURPLE_IM_TYPING: |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
221 | purple_signal_emit(purple_conversations_get_handle(), |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
222 | "buddy-typing", account, name); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
223 | break; |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
224 | case PURPLE_IM_TYPED: |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
225 | purple_signal_emit(purple_conversations_get_handle(), |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
226 | "buddy-typed", account, name); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
227 | break; |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
228 | case PURPLE_IM_NOT_TYPING: |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
229 | purple_signal_emit(purple_conversations_get_handle(), |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
230 | "buddy-typing-stopped", account, name); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
231 | break; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
232 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
233 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
234 | purple_im_conversation_update_typing(im); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
235 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
236 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
237 | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
238 | PurpleIMTypingState |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
239 | purple_im_conversation_get_typing_state(PurpleIMConversation *im) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
240 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
241 | PurpleIMConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
242 | purple_im_conversation_get_instance_private(im); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
243 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
244 | g_return_val_if_fail(priv != NULL, 0); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
245 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
246 | return priv->typing_state; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
247 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
248 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
249 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
250 | purple_im_conversation_start_typing_timeout(PurpleIMConversation *im, int timeout) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
251 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
252 | PurpleIMConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
253 | purple_im_conversation_get_instance_private(im); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
254 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
255 | g_return_if_fail(priv != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
256 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
257 | if (priv->typing_timeout > 0) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
258 | purple_im_conversation_stop_typing_timeout(im); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
259 | |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
37153
diff
changeset
|
260 | priv->typing_timeout = g_timeout_add_seconds(timeout, reset_typing_cb, im); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
261 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
262 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
263 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
264 | purple_im_conversation_stop_typing_timeout(PurpleIMConversation *im) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
265 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
266 | PurpleIMConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
267 | purple_im_conversation_get_instance_private(im); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
268 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
269 | g_return_if_fail(priv != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
270 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
271 | if (priv->typing_timeout == 0) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
272 | return; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
273 | |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
37153
diff
changeset
|
274 | g_source_remove(priv->typing_timeout); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
275 | priv->typing_timeout = 0; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
276 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
277 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
278 | guint |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
279 | purple_im_conversation_get_typing_timeout(PurpleIMConversation *im) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
280 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
281 | PurpleIMConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
282 | purple_im_conversation_get_instance_private(im); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
283 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
284 | g_return_val_if_fail(priv != NULL, 0); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
285 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
286 | return priv->typing_timeout; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
287 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
288 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
289 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
290 | purple_im_conversation_set_type_again(PurpleIMConversation *im, unsigned int val) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
291 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
292 | PurpleIMConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
293 | purple_im_conversation_get_instance_private(im); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
294 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
295 | g_return_if_fail(priv != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
296 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
297 | if (val == 0) |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
298 | priv->type_again = 0; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
299 | else |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
300 | priv->type_again = time(NULL) + val; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
301 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
302 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
303 | time_t |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
304 | purple_im_conversation_get_type_again(PurpleIMConversation *im) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
305 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
306 | PurpleIMConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
307 | purple_im_conversation_get_instance_private(im); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
308 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
309 | g_return_val_if_fail(priv != NULL, 0); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
310 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
311 | return priv->type_again; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
312 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
313 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
314 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
315 | purple_im_conversation_start_send_typed_timeout(PurpleIMConversation *im) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
316 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
317 | PurpleIMConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
318 | purple_im_conversation_get_instance_private(im); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
319 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
320 | g_return_if_fail(priv != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
321 | |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
37153
diff
changeset
|
322 | priv->send_typed_timeout = g_timeout_add_seconds(SEND_TYPED_TIMEOUT_SECONDS, |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
323 | send_typed_cb, im); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
324 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
325 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
326 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
327 | purple_im_conversation_stop_send_typed_timeout(PurpleIMConversation *im) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
328 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
329 | PurpleIMConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
330 | purple_im_conversation_get_instance_private(im); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
331 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
332 | g_return_if_fail(priv != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
333 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
334 | if (priv->send_typed_timeout == 0) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
335 | return; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
336 | |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
37153
diff
changeset
|
337 | g_source_remove(priv->send_typed_timeout); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
338 | priv->send_typed_timeout = 0; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
339 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
340 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
341 | guint |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
342 | purple_im_conversation_get_send_typed_timeout(PurpleIMConversation *im) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
343 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
344 | PurpleIMConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
345 | purple_im_conversation_get_instance_private(im); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
346 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
347 | g_return_val_if_fail(priv != NULL, 0); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
348 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
349 | return priv->send_typed_timeout; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
350 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
351 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
352 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
353 | purple_im_conversation_update_typing(PurpleIMConversation *im) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
354 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
355 | g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im)); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
356 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
357 | purple_conversation_update(PURPLE_CONVERSATION(im), |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
358 | PURPLE_CONVERSATION_UPDATE_TYPING); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
359 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
360 | |
|
34648
a6587d8cf907
Added missing API implementations to PurpleConversation and subclasses
Ankit Vani <a@nevitus.org>
parents:
34646
diff
changeset
|
361 | static void |
|
36088
4c386387f6f3
Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36086
diff
changeset
|
362 | im_conversation_write_message(PurpleConversation *conv, PurpleMessage *msg) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
363 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
364 | PurpleIMConversation *im = PURPLE_IM_CONVERSATION(conv); |
|
36098
4951752ad038
Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36090
diff
changeset
|
365 | gboolean is_recv; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
366 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
367 | g_return_if_fail(im != NULL); |
|
36088
4c386387f6f3
Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36086
diff
changeset
|
368 | g_return_if_fail(msg != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
369 | |
|
36098
4951752ad038
Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36090
diff
changeset
|
370 | is_recv = (purple_message_get_flags(msg) & PURPLE_MESSAGE_RECV); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
371 | |
|
36098
4951752ad038
Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36090
diff
changeset
|
372 | if (is_recv) |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
373 | purple_im_conversation_set_typing_state(im, PURPLE_IM_NOT_TYPING); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
374 | |
|
36113
4c9faa80e58b
Use _purple_conversation_write_common for all types of clients
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36109
diff
changeset
|
375 | _purple_conversation_write_common(conv, msg); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
376 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
377 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
378 | /************************************************************************** |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
379 | * GObject code for IMs |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
380 | **************************************************************************/ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
381 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
382 | /* Set method for GObject properties */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
383 | static void |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
384 | purple_im_conversation_set_property(GObject *obj, guint param_id, const GValue *value, |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
385 | GParamSpec *pspec) |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
386 | { |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
387 | PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
388 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
389 | switch (param_id) { |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
390 | case IM_PROP_TYPING_STATE: |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
391 | purple_im_conversation_set_typing_state(im, g_value_get_enum(value)); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
392 | break; |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
393 | case IM_PROP_ICON: |
|
34831
da607046d658
Backed out changeset d9b286af48ba
Ankit Vani <a@nevitus.org>
parents:
34830
diff
changeset
|
394 | purple_im_conversation_set_icon(im, g_value_get_pointer(value)); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
395 | break; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
396 | default: |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
397 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
398 | break; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
399 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
400 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
401 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
402 | /* Get method for GObject properties */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
403 | static void |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
404 | purple_im_conversation_get_property(GObject *obj, guint param_id, GValue *value, |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
405 | GParamSpec *pspec) |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
406 | { |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
407 | PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
408 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
409 | switch (param_id) { |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
410 | case IM_PROP_TYPING_STATE: |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
411 | g_value_set_enum(value, purple_im_conversation_get_typing_state(im)); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
412 | break; |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
413 | case IM_PROP_ICON: |
|
34831
da607046d658
Backed out changeset d9b286af48ba
Ankit Vani <a@nevitus.org>
parents:
34830
diff
changeset
|
414 | g_value_set_pointer(value, purple_im_conversation_get_icon(im)); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
415 | break; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
416 | default: |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
417 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
418 | break; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
419 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
420 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
421 | |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
422 | /* GObject initialization function */ |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
423 | static void purple_im_conversation_init(PurpleIMConversation *im) |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
424 | { |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
425 | } |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
426 | |
|
34687
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
427 | /* Called when done constructing */ |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
428 | static void |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
429 | purple_im_conversation_constructed(GObject *object) |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
430 | { |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
431 | PurpleIMConversation *im = PURPLE_IM_CONVERSATION(object); |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
432 | PurpleAccount *account; |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
433 | PurpleBuddyIcon *icon; |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
434 | gchar *name; |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
435 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
436 | G_OBJECT_CLASS(purple_im_conversation_parent_class)-> |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
437 | constructed(object); |
|
34687
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
438 | |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
439 | g_object_get(object, |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
440 | "account", &account, |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
441 | "name", &name, |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
442 | NULL); |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
443 | |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
444 | if ((icon = purple_buddy_icons_find(account, name))) |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
445 | { |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
446 | purple_im_conversation_set_icon(im, icon); |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
447 | /* purple_im_conversation_set_icon refs the icon. */ |
|
34831
da607046d658
Backed out changeset d9b286af48ba
Ankit Vani <a@nevitus.org>
parents:
34830
diff
changeset
|
448 | purple_buddy_icon_unref(icon); |
|
34687
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
449 | } |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
450 | |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
451 | if (purple_prefs_get_bool("/purple/logging/log_ims")) |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
452 | purple_conversation_set_logging(PURPLE_CONVERSATION(im), TRUE); |
|
34769
427725f8ed54
Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents:
34768
diff
changeset
|
453 | |
|
34923
416a7736a401
Unref and free everything recieved from g_object_get
Ankit Vani <a@nevitus.org>
parents:
34833
diff
changeset
|
454 | g_object_unref(account); |
|
34769
427725f8ed54
Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents:
34768
diff
changeset
|
455 | g_free(name); |
|
34687
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
456 | } |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
457 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
458 | /* GObject dispose function */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
459 | static void |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
460 | purple_im_conversation_dispose(GObject *object) |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
461 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
462 | PurpleIMConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
463 | purple_im_conversation_get_instance_private( |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
464 | PURPLE_IM_CONVERSATION(object)); |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
465 | |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
466 | if (priv->icon) { |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
467 | purple_buddy_icon_unref(priv->icon); |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
468 | priv->icon = NULL; |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
469 | } |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
470 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
471 | G_OBJECT_CLASS(purple_im_conversation_parent_class)->dispose(object); |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
472 | } |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
473 | |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
474 | /* GObject finalize function */ |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
475 | static void |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
476 | purple_im_conversation_finalize(GObject *object) |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
477 | { |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
478 | PurpleIMConversation *im = PURPLE_IM_CONVERSATION(object); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
479 | PurpleConnection *gc = purple_conversation_get_connection(PURPLE_CONVERSATION(im)); |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36366
diff
changeset
|
480 | PurpleProtocol *protocol = NULL; |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
481 | const char *name = purple_conversation_get_name(PURPLE_CONVERSATION(im)); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
482 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
483 | if (gc != NULL) |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
484 | { |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
485 | /* Still connected */ |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36610
diff
changeset
|
486 | protocol = purple_connection_get_protocol(gc); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
487 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
488 | if (purple_prefs_get_bool("/purple/conversations/im/send_typing")) |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35460
diff
changeset
|
489 | purple_serv_send_typing(gc, name, PURPLE_IM_NOT_TYPING); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
490 | |
| 36719 | 491 | purple_protocol_client_iface_convo_closed(protocol, gc, name); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
492 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
493 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
494 | purple_im_conversation_stop_typing_timeout(im); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
495 | purple_im_conversation_stop_send_typed_timeout(im); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
496 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
497 | G_OBJECT_CLASS(purple_im_conversation_parent_class)->finalize(object); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
498 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
499 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
500 | /* Class initializer function */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
501 | static void purple_im_conversation_class_init(PurpleIMConversationClass *klass) |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
502 | { |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
503 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
34664
45ba05a4bb3b
Used the correct class to override write_message conversation method
Ankit Vani <a@nevitus.org>
parents:
34663
diff
changeset
|
504 | PurpleConversationClass *conv_class = PURPLE_CONVERSATION_CLASS(klass); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
505 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
506 | obj_class->dispose = purple_im_conversation_dispose; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
507 | obj_class->finalize = purple_im_conversation_finalize; |
|
34687
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
508 | obj_class->constructed = purple_im_conversation_constructed; |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
509 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
510 | /* Setup properties */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
511 | obj_class->get_property = purple_im_conversation_get_property; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
512 | obj_class->set_property = purple_im_conversation_set_property; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
513 | |
|
34664
45ba05a4bb3b
Used the correct class to override write_message conversation method
Ankit Vani <a@nevitus.org>
parents:
34663
diff
changeset
|
514 | conv_class->write_message = im_conversation_write_message; |
|
34648
a6587d8cf907
Added missing API implementations to PurpleConversation and subclasses
Ankit Vani <a@nevitus.org>
parents:
34646
diff
changeset
|
515 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
516 | im_properties[IM_PROP_TYPING_STATE] = g_param_spec_enum("typing-state", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
517 | "Typing state", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
518 | "Status of the user's typing of a message.", |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
519 | PURPLE_TYPE_IM_TYPING_STATE, PURPLE_IM_NOT_TYPING, |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
520 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
521 | G_PARAM_STATIC_STRINGS); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
522 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
523 | im_properties[IM_PROP_ICON] = g_param_spec_pointer("icon", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
524 | "Buddy icon", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
525 | "The buddy icon for the IM.", |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
526 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
527 | G_PARAM_STATIC_STRINGS); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
528 | |
|
35085
abab0adfa0ec
libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents:
35080
diff
changeset
|
529 | g_object_class_install_properties(obj_class, IM_PROP_LAST, im_properties); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
530 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
531 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
532 | PurpleIMConversation * |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
533 | purple_im_conversation_new(PurpleAccount *account, const char *name) |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
534 | { |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
535 | PurpleIMConversation *im; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
536 | PurpleConnection *gc; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
537 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
538 | g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL); |
|
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
539 | g_return_val_if_fail(name != NULL, NULL); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
540 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
541 | /* Check if this conversation already exists. */ |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
542 | if ((im = purple_conversations_find_im_with_account(name, account)) != NULL) |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
543 | return im; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
544 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
545 | gc = purple_account_get_connection(account); |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
546 | g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), NULL); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
547 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
548 | im = g_object_new(PURPLE_TYPE_IM_CONVERSATION, |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
549 | "account", account, |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
550 | "name", name, |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
551 | "title", name, |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
552 | NULL); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
553 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
554 | return im; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
555 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
556 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
557 | /************************************************************************** |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
558 | * Chat Conversation API |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
559 | **************************************************************************/ |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
560 | static guint |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
561 | _purple_conversation_user_hash(gconstpointer data) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
562 | { |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
563 | const gchar *name = data; |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
564 | gchar *collated; |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
565 | guint hash; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
566 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
567 | collated = g_utf8_collate_key(name, -1); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
568 | hash = g_str_hash(collated); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
569 | g_free(collated); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
570 | return hash; |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
571 | } |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
572 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
573 | static gboolean |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
574 | _purple_conversation_user_equal(gconstpointer a, gconstpointer b) |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
575 | { |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
576 | return !g_utf8_collate(a, b); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
577 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
578 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
579 | GList * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
580 | purple_chat_conversation_get_users(PurpleChatConversation *chat) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
581 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
582 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
583 | purple_chat_conversation_get_instance_private(chat); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
584 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
585 | g_return_val_if_fail(priv != NULL, NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
586 | |
|
35639
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
587 | return g_hash_table_get_values(priv->users); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
588 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
589 | |
|
35638
1ae6f7c41db3
Implement purple_chat_conversation_get_users_count and use it instead of counting the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
590 | guint |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
591 | purple_chat_conversation_get_users_count(PurpleChatConversation *chat) |
|
35638
1ae6f7c41db3
Implement purple_chat_conversation_get_users_count and use it instead of counting the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
592 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
593 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
594 | purple_chat_conversation_get_instance_private(chat); |
|
35638
1ae6f7c41db3
Implement purple_chat_conversation_get_users_count and use it instead of counting the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
595 | |
|
1ae6f7c41db3
Implement purple_chat_conversation_get_users_count and use it instead of counting the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
596 | g_return_val_if_fail(priv != NULL, 0); |
|
1ae6f7c41db3
Implement purple_chat_conversation_get_users_count and use it instead of counting the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
597 | |
|
1ae6f7c41db3
Implement purple_chat_conversation_get_users_count and use it instead of counting the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
598 | return g_hash_table_size(priv->users); |
|
1ae6f7c41db3
Implement purple_chat_conversation_get_users_count and use it instead of counting the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
599 | } |
|
1ae6f7c41db3
Implement purple_chat_conversation_get_users_count and use it instead of counting the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
600 | |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
601 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
602 | purple_chat_conversation_ignore(PurpleChatConversation *chat, const char *name) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
603 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
604 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
605 | purple_chat_conversation_get_instance_private(chat); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
606 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
607 | g_return_if_fail(priv != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
608 | g_return_if_fail(name != NULL); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
609 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
610 | /* Make sure the user isn't already ignored. */ |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
611 | if (purple_chat_conversation_is_ignored_user(chat, name)) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
612 | return; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
613 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
614 | purple_chat_conversation_set_ignored(chat, |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
615 | g_list_append(priv->ignored, g_strdup(name))); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
616 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
617 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
618 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
619 | purple_chat_conversation_unignore(PurpleChatConversation *chat, const char *name) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
620 | { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
621 | GList *item; |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
622 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
623 | purple_chat_conversation_get_instance_private(chat); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
624 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
625 | g_return_if_fail(priv != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
626 | g_return_if_fail(name != NULL); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
627 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
628 | /* Make sure the user is actually ignored. */ |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
629 | if (!purple_chat_conversation_is_ignored_user(chat, name)) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
630 | return; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
631 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
632 | item = g_list_find(purple_chat_conversation_get_ignored(chat), |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
633 | purple_chat_conversation_get_ignored_user(chat, name)); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
634 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
635 | purple_chat_conversation_set_ignored(chat, |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
636 | g_list_remove_link(priv->ignored, item)); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
637 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
638 | g_free(item->data); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
639 | g_list_free_1(item); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
640 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
641 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
642 | GList * |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
643 | purple_chat_conversation_set_ignored(PurpleChatConversation *chat, GList *ignored) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
644 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
645 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
646 | purple_chat_conversation_get_instance_private(chat); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
647 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
648 | g_return_val_if_fail(priv != NULL, NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
649 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
650 | priv->ignored = ignored; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
651 | return ignored; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
652 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
653 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
654 | GList * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
655 | purple_chat_conversation_get_ignored(PurpleChatConversation *chat) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
656 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
657 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
658 | purple_chat_conversation_get_instance_private(chat); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
659 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
660 | g_return_val_if_fail(priv != NULL, NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
661 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
662 | return priv->ignored; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
663 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
664 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
665 | const char * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
666 | purple_chat_conversation_get_ignored_user(PurpleChatConversation *chat, const char *user) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
667 | { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
668 | GList *ignored; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
669 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
670 | g_return_val_if_fail(PURPLE_IS_CHAT_CONVERSATION(chat), NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
671 | g_return_val_if_fail(user != NULL, NULL); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
672 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
673 | for (ignored = purple_chat_conversation_get_ignored(chat); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
674 | ignored != NULL; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
675 | ignored = ignored->next) { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
676 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
677 | const char *ign = (const char *)ignored->data; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
678 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
679 | if (!purple_utf8_strcasecmp(user, ign) || |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
680 | ((*ign == '+' || *ign == '%') && !purple_utf8_strcasecmp(user, ign + 1))) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
681 | return ign; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
682 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
683 | if (*ign == '@') { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
684 | ign++; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
685 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
686 | if ((*ign == '+' && !purple_utf8_strcasecmp(user, ign + 1)) || |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
687 | (*ign != '+' && !purple_utf8_strcasecmp(user, ign))) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
688 | return ign; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
689 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
690 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
691 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
692 | return NULL; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
693 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
694 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
695 | gboolean |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
696 | purple_chat_conversation_is_ignored_user(PurpleChatConversation *chat, const char *user) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
697 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
698 | g_return_val_if_fail(PURPLE_IS_CHAT_CONVERSATION(chat), FALSE); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
699 | g_return_val_if_fail(user != NULL, FALSE); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
700 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
701 | return (purple_chat_conversation_get_ignored_user(chat, user) != NULL); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
702 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
703 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
704 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
705 | purple_chat_conversation_set_topic(PurpleChatConversation *chat, const char *who, const char *topic) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
706 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
707 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
708 | purple_chat_conversation_get_instance_private(chat); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
709 | GObject *obj; |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
710 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
711 | g_return_if_fail(priv != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
712 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
713 | g_free(priv->who); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
714 | g_free(priv->topic); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
715 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
716 | priv->who = g_strdup(who); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
717 | priv->topic = g_strdup(topic); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
718 | |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
719 | obj = G_OBJECT(chat); |
|
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
720 | g_object_freeze_notify(obj); |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
721 | g_object_notify_by_pspec(obj, chat_properties[CHAT_PROP_TOPIC_WHO]); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
722 | g_object_notify_by_pspec(obj, chat_properties[CHAT_PROP_TOPIC]); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
723 | g_object_thaw_notify(obj); |
|
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
724 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
725 | purple_conversation_update(PURPLE_CONVERSATION(chat), |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
726 | PURPLE_CONVERSATION_UPDATE_TOPIC); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
727 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
728 | purple_signal_emit(purple_conversations_get_handle(), "chat-topic-changed", |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
729 | chat, priv->who, priv->topic); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
730 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
731 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
732 | const char * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
733 | purple_chat_conversation_get_topic(PurpleChatConversation *chat) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
734 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
735 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
736 | purple_chat_conversation_get_instance_private(chat); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
737 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
738 | g_return_val_if_fail(priv != NULL, NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
739 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
740 | return priv->topic; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
741 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
742 | |
|
34648
a6587d8cf907
Added missing API implementations to PurpleConversation and subclasses
Ankit Vani <a@nevitus.org>
parents:
34646
diff
changeset
|
743 | const char * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
744 | purple_chat_conversation_get_topic_who(PurpleChatConversation *chat) |
|
34648
a6587d8cf907
Added missing API implementations to PurpleConversation and subclasses
Ankit Vani <a@nevitus.org>
parents:
34646
diff
changeset
|
745 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
746 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
747 | purple_chat_conversation_get_instance_private(chat); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
748 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
749 | g_return_val_if_fail(priv != NULL, NULL); |
|
34648
a6587d8cf907
Added missing API implementations to PurpleConversation and subclasses
Ankit Vani <a@nevitus.org>
parents:
34646
diff
changeset
|
750 | |
|
a6587d8cf907
Added missing API implementations to PurpleConversation and subclasses
Ankit Vani <a@nevitus.org>
parents:
34646
diff
changeset
|
751 | return priv->who; |
|
a6587d8cf907
Added missing API implementations to PurpleConversation and subclasses
Ankit Vani <a@nevitus.org>
parents:
34646
diff
changeset
|
752 | } |
|
a6587d8cf907
Added missing API implementations to PurpleConversation and subclasses
Ankit Vani <a@nevitus.org>
parents:
34646
diff
changeset
|
753 | |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
754 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
755 | purple_chat_conversation_set_id(PurpleChatConversation *chat, int id) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
756 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
757 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
758 | purple_chat_conversation_get_instance_private(chat); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
759 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
760 | g_return_if_fail(priv != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
761 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
762 | priv->id = id; |
|
35012
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
763 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
764 | g_object_notify_by_pspec(G_OBJECT(chat), chat_properties[CHAT_PROP_ID]); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
765 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
766 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
767 | int |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
768 | purple_chat_conversation_get_id(PurpleChatConversation *chat) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
769 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
770 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
771 | purple_chat_conversation_get_instance_private(chat); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
772 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
773 | g_return_val_if_fail(priv != NULL, -1); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
774 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
775 | return priv->id; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
776 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
777 | |
|
34648
a6587d8cf907
Added missing API implementations to PurpleConversation and subclasses
Ankit Vani <a@nevitus.org>
parents:
34646
diff
changeset
|
778 | static void |
|
36088
4c386387f6f3
Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36086
diff
changeset
|
779 | chat_conversation_write_message(PurpleConversation *conv, PurpleMessage *msg) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
780 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
781 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
782 | purple_chat_conversation_get_instance_private( |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
783 | PURPLE_CHAT_CONVERSATION(conv)); |
|
36088
4c386387f6f3
Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36086
diff
changeset
|
784 | PurpleMessageFlags flags; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
785 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
786 | g_return_if_fail(priv != NULL); |
|
36088
4c386387f6f3
Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36086
diff
changeset
|
787 | g_return_if_fail(msg != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
788 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
789 | /* Don't display this if the person who wrote it is ignored. */ |
|
36108
69b4fce85ffa
Switch _purple_conversation_write_common and (writing|wrote)-(chat|im)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36100
diff
changeset
|
790 | if (purple_message_get_author(msg) && purple_chat_conversation_is_ignored_user( |
|
36098
4951752ad038
Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36090
diff
changeset
|
791 | PURPLE_CHAT_CONVERSATION(conv), purple_message_get_author(msg))) |
|
36088
4c386387f6f3
Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36086
diff
changeset
|
792 | { |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
793 | return; |
|
35265
77664079d0f0
Merge with a fair number of conflicts. Nothing too crazy.
Mark Doliner <mark@kingant.net>
parents:
35176
diff
changeset
|
794 | } |
|
77664079d0f0
Merge with a fair number of conflicts. Nothing too crazy.
Mark Doliner <mark@kingant.net>
parents:
35176
diff
changeset
|
795 | |
|
36088
4c386387f6f3
Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36086
diff
changeset
|
796 | flags = purple_message_get_flags(msg); |
|
4c386387f6f3
Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36086
diff
changeset
|
797 | if (flags & PURPLE_MESSAGE_RECV) { |
|
4c386387f6f3
Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36086
diff
changeset
|
798 | if (purple_utf8_has_word(purple_message_get_contents(msg), priv->nick)) { |
|
4c386387f6f3
Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36086
diff
changeset
|
799 | flags |= PURPLE_MESSAGE_NICK; |
|
4c386387f6f3
Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36086
diff
changeset
|
800 | purple_message_set_flags(msg, flags); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
801 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
802 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
803 | |
|
36113
4c9faa80e58b
Use _purple_conversation_write_common for all types of clients
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36109
diff
changeset
|
804 | _purple_conversation_write_common(conv, msg); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
805 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
806 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
807 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
808 | purple_chat_conversation_add_user(PurpleChatConversation *chat, const char *user, |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
809 | const char *extra_msg, PurpleChatUserFlags flags, |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
810 | gboolean new_arrival) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
811 | { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
812 | GList *users = g_list_append(NULL, (char *)user); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
813 | GList *extra_msgs = g_list_append(NULL, (char *)extra_msg); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
814 | GList *flags2 = g_list_append(NULL, GINT_TO_POINTER(flags)); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
815 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
816 | purple_chat_conversation_add_users(chat, users, extra_msgs, flags2, new_arrival); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
817 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
818 | g_list_free(users); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
819 | g_list_free(extra_msgs); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
820 | g_list_free(flags2); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
821 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
822 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
823 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
824 | purple_chat_conversation_add_users(PurpleChatConversation *chat, GList *users, GList *extra_msgs, |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
825 | GList *flags, gboolean new_arrivals) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
826 | { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
827 | PurpleConversation *conv; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
828 | PurpleConversationUiOps *ops; |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
829 | PurpleChatUser *chatuser; |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
830 | PurpleChatConversationPrivate *priv; |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
831 | PurpleAccount *account; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
832 | PurpleConnection *gc; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36366
diff
changeset
|
833 | PurpleProtocol *protocol; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
834 | GList *ul, *fl; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
835 | GList *cbuddies = NULL; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
836 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
837 | priv = purple_chat_conversation_get_instance_private(chat); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
838 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
839 | g_return_if_fail(priv != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
840 | g_return_if_fail(users != NULL); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
841 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
842 | conv = PURPLE_CONVERSATION(chat); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
843 | ops = purple_conversation_get_ui_ops(conv); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
844 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
845 | account = purple_conversation_get_account(conv); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
846 | gc = purple_conversation_get_connection(conv); |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
847 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36610
diff
changeset
|
848 | protocol = purple_connection_get_protocol(gc); |
|
36844
b62140058cd3
Check for valid PurpleProtocols
Ankit Vani <a@nevitus.org>
parents:
36843
diff
changeset
|
849 | g_return_if_fail(PURPLE_IS_PROTOCOL(protocol)); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
850 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
851 | ul = users; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
852 | fl = flags; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
853 | while ((ul != NULL) && (fl != NULL)) { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
854 | const char *user = (const char *)ul->data; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
855 | const char *alias = user; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
856 | gboolean quiet; |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
857 | PurpleChatUserFlags flag = GPOINTER_TO_INT(fl->data); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
858 | const char *extra_msg = (extra_msgs ? extra_msgs->data : NULL); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
859 | |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
860 | if(!(purple_protocol_get_options(protocol) & OPT_PROTO_UNIQUE_CHATNAME)) { |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
861 | if (purple_strequal(priv->nick, purple_normalize(account, user))) { |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
862 | const char *alias2 = purple_account_get_private_alias(account); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
863 | if (alias2 != NULL) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
864 | alias = alias2; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
865 | else |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
866 | { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
867 | const char *display_name = purple_connection_get_display_name(gc); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
868 | if (display_name != NULL) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
869 | alias = display_name; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
870 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
871 | } else { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
872 | PurpleBuddy *buddy; |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34715
diff
changeset
|
873 | if ((buddy = purple_blist_find_buddy(purple_connection_get_account(gc), user)) != NULL) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
874 | alias = purple_buddy_get_contact_alias(buddy); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
875 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
876 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
877 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
878 | quiet = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_conversations_get_handle(), |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
879 | "chat-user-joining", chat, user, flag)) || |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
880 | purple_chat_conversation_is_ignored_user(chat, user); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
881 | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
882 | chatuser = purple_chat_user_new(chat, user, alias, flag); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
883 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
884 | g_hash_table_replace(priv->users, |
|
35639
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
885 | g_strdup(purple_chat_user_get_name(chatuser)), |
|
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
886 | chatuser); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
887 | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
888 | cbuddies = g_list_prepend(cbuddies, chatuser); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
889 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
890 | if (!quiet && new_arrivals) { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
891 | char *alias_esc = g_markup_escape_text(alias, -1); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
892 | char *tmp; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
893 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
894 | if (extra_msg == NULL) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
895 | tmp = g_strdup_printf(_("%s entered the room."), alias_esc); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
896 | else { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
897 | char *extra_msg_esc = g_markup_escape_text(extra_msg, -1); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
898 | tmp = g_strdup_printf(_("%s [<I>%s</I>] entered the room."), |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
899 | alias_esc, extra_msg_esc); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
900 | g_free(extra_msg_esc); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
901 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
902 | g_free(alias_esc); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
903 | |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36088
diff
changeset
|
904 | purple_conversation_write_system_message( |
|
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36088
diff
changeset
|
905 | conv, tmp, PURPLE_MESSAGE_NO_LINKIFY); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
906 | g_free(tmp); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
907 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
908 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
909 | purple_signal_emit(purple_conversations_get_handle(), |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
910 | "chat-user-joined", chat, user, flag, new_arrivals); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
911 | ul = ul->next; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
912 | fl = fl->next; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
913 | if (extra_msgs != NULL) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
914 | extra_msgs = extra_msgs->next; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
915 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
916 | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
917 | cbuddies = g_list_sort(cbuddies, (GCompareFunc)purple_chat_user_compare); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
918 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
919 | if (ops != NULL && ops->chat_add_users != NULL) |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
920 | ops->chat_add_users(chat, cbuddies, new_arrivals); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
921 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
922 | g_list_free(cbuddies); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
923 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
924 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
925 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
926 | purple_chat_conversation_rename_user(PurpleChatConversation *chat, const char *old_user, |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
927 | const char *new_user) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
928 | { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
929 | PurpleConversation *conv; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
930 | PurpleConversationUiOps *ops; |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
931 | PurpleAccount *account; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
932 | PurpleConnection *gc; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36366
diff
changeset
|
933 | PurpleProtocol *protocol; |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
934 | PurpleChatUser *cb; |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
935 | PurpleChatUserFlags flags; |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
936 | PurpleChatConversationPrivate *priv; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
937 | const char *new_alias = new_user; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
938 | char tmp[BUF_LONG]; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
939 | gboolean is_me = FALSE; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
940 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
941 | priv = purple_chat_conversation_get_instance_private(chat); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
942 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
943 | g_return_if_fail(priv != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
944 | g_return_if_fail(old_user != NULL); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
945 | g_return_if_fail(new_user != NULL); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
946 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
947 | conv = PURPLE_CONVERSATION(chat); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
948 | ops = purple_conversation_get_ui_ops(conv); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
949 | account = purple_conversation_get_account(conv); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
950 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
951 | gc = purple_conversation_get_connection(conv); |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
952 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36610
diff
changeset
|
953 | protocol = purple_connection_get_protocol(gc); |
|
36844
b62140058cd3
Check for valid PurpleProtocols
Ankit Vani <a@nevitus.org>
parents:
36843
diff
changeset
|
954 | g_return_if_fail(PURPLE_IS_PROTOCOL(protocol)); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
955 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
956 | if (purple_strequal(priv->nick, purple_normalize(account, old_user))) { |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
957 | const char *alias; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
958 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
959 | /* Note this for later. */ |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
960 | is_me = TRUE; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
961 | |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
962 | if(!(purple_protocol_get_options(protocol) & OPT_PROTO_UNIQUE_CHATNAME)) { |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
963 | alias = purple_account_get_private_alias(account); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
964 | if (alias != NULL) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
965 | new_alias = alias; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
966 | else |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
967 | { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
968 | const char *display_name = purple_connection_get_display_name(gc); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
969 | if (display_name != NULL) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
970 | new_alias = display_name; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
971 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
972 | } |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
973 | } else if (!(purple_protocol_get_options(protocol) & OPT_PROTO_UNIQUE_CHATNAME)) { |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
974 | PurpleBuddy *buddy; |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34715
diff
changeset
|
975 | if ((buddy = purple_blist_find_buddy(purple_connection_get_account(gc), new_user)) != NULL) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
976 | new_alias = purple_buddy_get_contact_alias(buddy); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
977 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
978 | |
|
34671
ca9b45be7a63
Renamed chat buddy to chat user in a few more places
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
979 | flags = purple_chat_user_get_flags(purple_chat_conversation_find_user(chat, old_user)); |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
980 | cb = purple_chat_user_new(chat, new_user, new_alias, flags); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
981 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
982 | g_hash_table_replace(priv->users, |
|
35639
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
983 | g_strdup(purple_chat_user_get_name(cb)), cb); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
984 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
985 | if (ops != NULL && ops->chat_rename_user != NULL) |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
986 | ops->chat_rename_user(chat, old_user, new_user, new_alias); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
987 | |
|
34671
ca9b45be7a63
Renamed chat buddy to chat user in a few more places
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
988 | cb = purple_chat_conversation_find_user(chat, old_user); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
989 | |
|
35639
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
990 | if (cb) |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
991 | g_hash_table_remove(priv->users, purple_chat_user_get_name(cb)); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
992 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
993 | if (purple_chat_conversation_is_ignored_user(chat, old_user)) { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
994 | purple_chat_conversation_unignore(chat, old_user); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
995 | purple_chat_conversation_ignore(chat, new_user); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
996 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
997 | else if (purple_chat_conversation_is_ignored_user(chat, new_user)) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
998 | purple_chat_conversation_unignore(chat, new_user); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
999 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1000 | if (is_me) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1001 | purple_chat_conversation_set_nick(chat, new_user); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1002 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1003 | if (purple_prefs_get_bool("/purple/conversations/chat/show_nick_change") && |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1004 | !purple_chat_conversation_is_ignored_user(chat, new_user)) { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1005 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1006 | if (is_me) { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1007 | char *escaped = g_markup_escape_text(new_user, -1); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1008 | g_snprintf(tmp, sizeof(tmp), |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1009 | _("You are now known as %s"), escaped); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1010 | g_free(escaped); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1011 | } else { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1012 | const char *old_alias = old_user; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1013 | const char *new_alias = new_user; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1014 | char *escaped; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1015 | char *escaped2; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1016 | |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
1017 | if (!(purple_protocol_get_options(protocol) & OPT_PROTO_UNIQUE_CHATNAME)) { |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1018 | PurpleBuddy *buddy; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1019 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34715
diff
changeset
|
1020 | if ((buddy = purple_blist_find_buddy(purple_connection_get_account(gc), old_user)) != NULL) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1021 | old_alias = purple_buddy_get_contact_alias(buddy); |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34715
diff
changeset
|
1022 | if ((buddy = purple_blist_find_buddy(purple_connection_get_account(gc), new_user)) != NULL) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1023 | new_alias = purple_buddy_get_contact_alias(buddy); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1024 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1025 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1026 | escaped = g_markup_escape_text(old_alias, -1); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1027 | escaped2 = g_markup_escape_text(new_alias, -1); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1028 | g_snprintf(tmp, sizeof(tmp), |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1029 | _("%s is now known as %s"), escaped, escaped2); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1030 | g_free(escaped); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1031 | g_free(escaped2); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1032 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1033 | |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36088
diff
changeset
|
1034 | purple_conversation_write_system_message(conv, |
|
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36088
diff
changeset
|
1035 | tmp, PURPLE_MESSAGE_NO_LINKIFY); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1036 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1037 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1038 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1039 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1040 | purple_chat_conversation_remove_user(PurpleChatConversation *chat, const char *user, const char *reason) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1041 | { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1042 | GList *users = g_list_append(NULL, (char *)user); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1043 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1044 | purple_chat_conversation_remove_users(chat, users, reason); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1045 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1046 | g_list_free(users); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1047 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1048 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1049 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1050 | purple_chat_conversation_remove_users(PurpleChatConversation *chat, GList *users, const char *reason) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1051 | { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1052 | PurpleConversation *conv; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1053 | PurpleConnection *gc; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36366
diff
changeset
|
1054 | PurpleProtocol *protocol; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1055 | PurpleConversationUiOps *ops; |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1056 | PurpleChatUser *cb; |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1057 | PurpleChatConversationPrivate *priv; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1058 | GList *l; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1059 | gboolean quiet; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1060 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1061 | priv = purple_chat_conversation_get_instance_private(chat); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1062 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1063 | g_return_if_fail(priv != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1064 | g_return_if_fail(users != NULL); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1065 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1066 | conv = PURPLE_CONVERSATION(chat); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1067 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1068 | gc = purple_conversation_get_connection(conv); |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
1069 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36610
diff
changeset
|
1070 | protocol = purple_connection_get_protocol(gc); |
|
36844
b62140058cd3
Check for valid PurpleProtocols
Ankit Vani <a@nevitus.org>
parents:
36843
diff
changeset
|
1071 | g_return_if_fail(PURPLE_IS_PROTOCOL(protocol)); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1072 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1073 | ops = purple_conversation_get_ui_ops(conv); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1074 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1075 | for (l = users; l != NULL; l = l->next) { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1076 | const char *user = (const char *)l->data; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1077 | quiet = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_conversations_get_handle(), |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1078 | "chat-user-leaving", chat, user, reason)) | |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1079 | purple_chat_conversation_is_ignored_user(chat, user); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1080 | |
|
34671
ca9b45be7a63
Renamed chat buddy to chat user in a few more places
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
1081 | cb = purple_chat_conversation_find_user(chat, user); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1082 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1083 | if (cb) { |
|
35639
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
1084 | g_hash_table_remove(priv->users, |
|
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
1085 | purple_chat_user_get_name(cb)); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1086 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1087 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1088 | /* NOTE: Don't remove them from ignored in case they re-enter. */ |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1089 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1090 | if (!quiet) { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1091 | const char *alias = user; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1092 | char *alias_esc; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1093 | char *tmp; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1094 | |
|
36607
7ad7681dcfd8
Use purple_protocol_get_* API instead of protocol->member
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
1095 | if (!(purple_protocol_get_options(protocol) & OPT_PROTO_UNIQUE_CHATNAME)) { |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1096 | PurpleBuddy *buddy; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1097 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34715
diff
changeset
|
1098 | if ((buddy = purple_blist_find_buddy(purple_connection_get_account(gc), user)) != NULL) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1099 | alias = purple_buddy_get_contact_alias(buddy); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1100 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1101 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1102 | alias_esc = g_markup_escape_text(alias, -1); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1103 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1104 | if (reason == NULL || !*reason) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1105 | tmp = g_strdup_printf(_("%s left the room."), alias_esc); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1106 | else { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1107 | char *reason_esc = g_markup_escape_text(reason, -1); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1108 | tmp = g_strdup_printf(_("%s left the room (%s)."), |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1109 | alias_esc, reason_esc); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1110 | g_free(reason_esc); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1111 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1112 | g_free(alias_esc); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1113 | |
|
36089
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36088
diff
changeset
|
1114 | purple_conversation_write_system_message(conv, |
|
c035b9a63457
Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36088
diff
changeset
|
1115 | tmp, PURPLE_MESSAGE_NO_LINKIFY); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1116 | g_free(tmp); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1117 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1118 | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1119 | purple_signal_emit(purple_conversations_get_handle(), "chat-user-left", |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1120 | conv, user, reason); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1121 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1122 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1123 | if (ops != NULL && ops->chat_remove_users != NULL) |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1124 | ops->chat_remove_users(chat, users); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1125 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1126 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1127 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1128 | purple_chat_conversation_clear_users(PurpleChatConversation *chat) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1129 | { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1130 | PurpleConversationUiOps *ops; |
|
35639
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
1131 | GHashTableIter it; |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1132 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1133 | purple_chat_conversation_get_instance_private(chat); |
|
35639
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
1134 | gchar *name; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1135 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1136 | g_return_if_fail(priv != NULL); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1137 | |
|
35639
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
1138 | ops = purple_conversation_get_ui_ops(PURPLE_CONVERSATION(chat)); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1139 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1140 | if (ops != NULL && ops->chat_remove_users != NULL) { |
|
35639
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
1141 | GList *names = NULL; |
|
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
1142 | |
|
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
1143 | g_hash_table_iter_init(&it, priv->users); |
|
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
1144 | while (g_hash_table_iter_next(&it, (gpointer*)&name, NULL)) |
|
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
1145 | names = g_list_prepend(names, name); |
|
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
1146 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1147 | ops->chat_remove_users(chat, names); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1148 | g_list_free(names); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1149 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1150 | |
|
35639
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
1151 | g_hash_table_iter_init(&it, priv->users); |
|
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
1152 | while (g_hash_table_iter_next(&it, (gpointer*)&name, NULL)) { |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1153 | purple_signal_emit(purple_conversations_get_handle(), |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1154 | "chat-user-leaving", chat, name, NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1155 | purple_signal_emit(purple_conversations_get_handle(), |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1156 | "chat-user-left", chat, name, NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1157 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1158 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1159 | g_hash_table_remove_all(priv->users); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1160 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1161 | |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1162 | void purple_chat_conversation_set_nick(PurpleChatConversation *chat, const char *nick) { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1163 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1164 | purple_chat_conversation_get_instance_private(chat); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1165 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1166 | g_return_if_fail(priv != NULL); |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1167 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1168 | g_free(priv->nick); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1169 | priv->nick = g_strdup(purple_normalize( |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1170 | purple_conversation_get_account(PURPLE_CONVERSATION(chat)), nick)); |
|
35012
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1171 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1172 | g_object_notify_by_pspec(G_OBJECT(chat), chat_properties[CHAT_PROP_NICK]); |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1173 | } |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1174 | |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1175 | const char *purple_chat_conversation_get_nick(PurpleChatConversation *chat) { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1176 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1177 | purple_chat_conversation_get_instance_private(chat); |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1178 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1179 | g_return_val_if_fail(priv != NULL, NULL); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1180 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1181 | return priv->nick; |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1182 | } |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1183 | |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1184 | static void |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1185 | invite_user_to_chat(gpointer data, PurpleRequestFields *fields) |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1186 | { |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1187 | PurpleConversation *conv; |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1188 | PurpleChatConversationPrivate *priv; |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1189 | const char *user, *message; |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1190 | |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1191 | conv = data; |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1192 | priv = purple_chat_conversation_get_instance_private( |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1193 | PURPLE_CHAT_CONVERSATION(conv)); |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1194 | user = purple_request_fields_get_string(fields, "screenname"); |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1195 | message = purple_request_fields_get_string(fields, "message"); |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1196 | |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35460
diff
changeset
|
1197 | purple_serv_chat_invite(purple_conversation_get_connection(conv), priv->id, message, user); |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1198 | } |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1199 | |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1200 | void purple_chat_conversation_invite_user(PurpleChatConversation *chat, const char *user, |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1201 | const char *message, gboolean confirm) |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1202 | { |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1203 | PurpleAccount *account; |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1204 | PurpleRequestFields *fields; |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1205 | PurpleRequestFieldGroup *group; |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1206 | PurpleRequestField *field; |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1207 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
1208 | g_return_if_fail(PURPLE_IS_CHAT_CONVERSATION(chat)); |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1209 | |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1210 | if (!user || !*user || !message || !*message) |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1211 | confirm = TRUE; |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1212 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1213 | account = purple_conversation_get_account(PURPLE_CONVERSATION(chat)); |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1214 | |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1215 | if (!confirm) { |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35460
diff
changeset
|
1216 | purple_serv_chat_invite(purple_account_get_connection(account), |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1217 | purple_chat_conversation_get_id(chat), message, user); |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1218 | return; |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1219 | } |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1220 | |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1221 | fields = purple_request_fields_new(); |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1222 | group = purple_request_field_group_new(_("Invite to chat")); |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1223 | purple_request_fields_add_group(fields, group); |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1224 | |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1225 | field = purple_request_field_string_new("screenname", _("Buddy"), user, FALSE); |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1226 | purple_request_field_group_add_field(group, field); |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1227 | purple_request_field_set_required(field, TRUE); |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1228 | purple_request_field_set_type_hint(field, "screenname"); |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1229 | |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1230 | field = purple_request_field_string_new("message", _("Message"), message, FALSE); |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1231 | purple_request_field_group_add_field(group, field); |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1232 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1233 | purple_request_fields(chat, _("Invite to chat"), NULL, |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1234 | _("Please enter the name of the user you wish to invite, " |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1235 | "along with an optional invite message."), |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1236 | fields, |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1237 | _("Invite"), G_CALLBACK(invite_user_to_chat), |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1238 | _("Cancel"), NULL, |
| 34945 | 1239 | purple_request_cpar_from_conversation(PURPLE_CONVERSATION(chat)), |
| 1240 | chat); | |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1241 | } |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1242 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1243 | gboolean |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1244 | purple_chat_conversation_has_user(PurpleChatConversation *chat, const char *user) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1245 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
1246 | g_return_val_if_fail(PURPLE_IS_CHAT_CONVERSATION(chat), FALSE); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1247 | g_return_val_if_fail(user != NULL, FALSE); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1248 | |
|
34671
ca9b45be7a63
Renamed chat buddy to chat user in a few more places
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
1249 | return (purple_chat_conversation_find_user(chat, user) != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1250 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1251 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1252 | void |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1253 | purple_chat_conversation_leave(PurpleChatConversation *chat) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1254 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1255 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1256 | purple_chat_conversation_get_instance_private(chat); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1257 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1258 | g_return_if_fail(priv != NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1259 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1260 | priv->left = TRUE; |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1261 | |
|
36109
2e4dd08b0131
Conversations: fix glib warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36108
diff
changeset
|
1262 | if (!g_object_get_data(G_OBJECT(chat), "is-finalizing")) |
|
36108
69b4fce85ffa
Switch _purple_conversation_write_common and (writing|wrote)-(chat|im)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36100
diff
changeset
|
1263 | g_object_notify_by_pspec(G_OBJECT(chat), chat_properties[CHAT_PROP_LEFT]); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1264 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1265 | purple_conversation_update(PURPLE_CONVERSATION(chat), PURPLE_CONVERSATION_UPDATE_CHATLEFT); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1266 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1267 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1268 | gboolean |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1269 | purple_chat_conversation_has_left(PurpleChatConversation *chat) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1270 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1271 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1272 | purple_chat_conversation_get_instance_private(chat); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1273 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1274 | g_return_val_if_fail(priv != NULL, TRUE); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1275 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1276 | return priv->left; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1277 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1278 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1279 | static void |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1280 | chat_conversation_cleanup_for_rejoin(PurpleChatConversation *chat) |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1281 | { |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1282 | const char *disp; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1283 | PurpleAccount *account; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1284 | PurpleConnection *gc; |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1285 | PurpleConversation *conv = PURPLE_CONVERSATION(chat); |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1286 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1287 | purple_chat_conversation_get_instance_private(chat); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1288 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1289 | account = purple_conversation_get_account(conv); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1290 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1291 | purple_conversation_close_logs(conv); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1292 | purple_conversation_set_logging(conv, TRUE); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1293 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1294 | gc = purple_account_get_connection(account); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1295 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1296 | if ((disp = purple_connection_get_display_name(gc)) != NULL) |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1297 | purple_chat_conversation_set_nick(chat, disp); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1298 | else |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1299 | { |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1300 | purple_chat_conversation_set_nick(chat, |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1301 | purple_account_get_username(account)); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1302 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1303 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1304 | purple_chat_conversation_clear_users(chat); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1305 | purple_chat_conversation_set_topic(chat, NULL, NULL); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1306 | priv->left = FALSE; |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1307 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1308 | g_object_notify_by_pspec(G_OBJECT(chat), chat_properties[CHAT_PROP_LEFT]); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1309 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1310 | purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_CHATLEFT); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1311 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1312 | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1313 | PurpleChatUser * |
|
34671
ca9b45be7a63
Renamed chat buddy to chat user in a few more places
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
1314 | purple_chat_conversation_find_user(PurpleChatConversation *chat, const char *name) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1315 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1316 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1317 | purple_chat_conversation_get_instance_private(chat); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1318 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1319 | g_return_val_if_fail(priv != NULL, NULL); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1320 | g_return_val_if_fail(name != NULL, NULL); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1321 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1322 | return g_hash_table_lookup(priv->users, name); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1323 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1324 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1325 | /************************************************************************** |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1326 | * GObject code for chats |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1327 | **************************************************************************/ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1328 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1329 | /* Set method for GObject properties */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1330 | static void |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1331 | purple_chat_conversation_set_property(GObject *obj, guint param_id, const GValue *value, |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1332 | GParamSpec *pspec) |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1333 | { |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1334 | PurpleChatConversation *chat = PURPLE_CHAT_CONVERSATION(obj); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1335 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1336 | switch (param_id) { |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1337 | case CHAT_PROP_ID: |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1338 | purple_chat_conversation_set_id(chat, g_value_get_int(value)); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1339 | break; |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1340 | case CHAT_PROP_NICK: |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1341 | purple_chat_conversation_set_nick(chat, g_value_get_string(value)); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1342 | break; |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1343 | case CHAT_PROP_LEFT: |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1344 | { |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1345 | gboolean left = g_value_get_boolean(value); |
|
35098
905d15638e6c
No need to explicitly compare against TRUE (or FALSE).
Mark Doliner <mark@kingant.net>
parents:
35085
diff
changeset
|
1346 | if (left) |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1347 | purple_chat_conversation_leave(chat); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1348 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1349 | break; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1350 | default: |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1351 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1352 | break; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1353 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1354 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1355 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1356 | /* Get method for GObject properties */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1357 | static void |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1358 | purple_chat_conversation_get_property(GObject *obj, guint param_id, GValue *value, |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1359 | GParamSpec *pspec) |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1360 | { |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1361 | PurpleChatConversation *chat = PURPLE_CHAT_CONVERSATION(obj); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1362 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1363 | switch (param_id) { |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1364 | case CHAT_PROP_TOPIC_WHO: |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1365 | g_value_set_string(value, purple_chat_conversation_get_topic_who(chat)); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1366 | break; |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1367 | case CHAT_PROP_TOPIC: |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1368 | g_value_set_string(value, purple_chat_conversation_get_topic(chat)); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1369 | break; |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1370 | case CHAT_PROP_ID: |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1371 | g_value_set_int(value, purple_chat_conversation_get_id(chat)); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1372 | break; |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1373 | case CHAT_PROP_NICK: |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1374 | g_value_set_string(value, purple_chat_conversation_get_nick(chat)); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1375 | break; |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1376 | case CHAT_PROP_LEFT: |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1377 | g_value_set_boolean(value, purple_chat_conversation_has_left(chat)); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1378 | break; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1379 | default: |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1380 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1381 | break; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1382 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1383 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1384 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1385 | /* GObject initialization function */ |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1386 | static void purple_chat_conversation_init(PurpleChatConversation *chat) |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1387 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1388 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1389 | purple_chat_conversation_get_instance_private(chat); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1390 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1391 | priv->users = g_hash_table_new_full(_purple_conversation_user_hash, |
|
35639
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
1392 | _purple_conversation_user_equal, g_free, g_object_unref); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1393 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1394 | |
|
34687
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1395 | /* Called when done constructing */ |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1396 | static void |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1397 | purple_chat_conversation_constructed(GObject *object) |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1398 | { |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1399 | PurpleChatConversation *chat = PURPLE_CHAT_CONVERSATION(object); |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1400 | PurpleAccount *account; |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1401 | const char *disp; |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1402 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1403 | G_OBJECT_CLASS(purple_chat_conversation_parent_class)-> |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1404 | constructed(object); |
|
34687
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1405 | |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1406 | g_object_get(object, "account", &account, NULL); |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1407 | |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1408 | if ((disp = purple_connection_get_display_name(purple_account_get_connection(account)))) |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1409 | purple_chat_conversation_set_nick(chat, disp); |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1410 | else |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1411 | purple_chat_conversation_set_nick(chat, |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1412 | purple_account_get_username(account)); |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1413 | |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1414 | if (purple_prefs_get_bool("/purple/logging/log_chats")) |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1415 | purple_conversation_set_logging(PURPLE_CONVERSATION(chat), TRUE); |
|
34923
416a7736a401
Unref and free everything recieved from g_object_get
Ankit Vani <a@nevitus.org>
parents:
34833
diff
changeset
|
1416 | |
|
416a7736a401
Unref and free everything recieved from g_object_get
Ankit Vani <a@nevitus.org>
parents:
34833
diff
changeset
|
1417 | g_object_unref(account); |
|
34687
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1418 | } |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1419 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1420 | /* GObject dispose function */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1421 | static void |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1422 | purple_chat_conversation_dispose(GObject *object) |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1423 | { |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
1424 | PurpleChatConversationPrivate *priv = |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1425 | purple_chat_conversation_get_instance_private |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1426 | (PURPLE_CHAT_CONVERSATION(object)); |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
1427 | |
|
35639
7391a9c98a1d
Remove _PurpleChatConversationPrivate->in_room
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35638
diff
changeset
|
1428 | g_hash_table_remove_all(priv->users); |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
1429 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1430 | G_OBJECT_CLASS(purple_chat_conversation_parent_class)->dispose(object); |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
1431 | } |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
1432 | |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
1433 | /* GObject finalize function */ |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
1434 | static void |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
1435 | purple_chat_conversation_finalize(GObject *object) |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
1436 | { |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1437 | PurpleChatConversation *chat = PURPLE_CHAT_CONVERSATION(object); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1438 | PurpleConnection *gc = purple_conversation_get_connection(PURPLE_CONVERSATION(chat)); |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1439 | PurpleChatConversationPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1440 | purple_chat_conversation_get_instance_private(chat); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1441 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1442 | if (gc != NULL) |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1443 | { |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1444 | /* Still connected */ |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1445 | int chat_id = purple_chat_conversation_get_id(chat); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1446 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1447 | /* |
|
38814
e06f252d2edf
Clean up a comment that read weird after removing some #if 0'd code
Gary Kramlich <grim@reaperworld.com>
parents:
38813
diff
changeset
|
1448 | * Close the window when the user tells us to, and let the protocol |
|
e06f252d2edf
Clean up a comment that read weird after removing some #if 0'd code
Gary Kramlich <grim@reaperworld.com>
parents:
38813
diff
changeset
|
1449 | * deal with the internals on it's own time. Don't do this if the |
|
e06f252d2edf
Clean up a comment that read weird after removing some #if 0'd code
Gary Kramlich <grim@reaperworld.com>
parents:
38813
diff
changeset
|
1450 | * protocol already knows it left the chat. |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1451 | */ |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1452 | if (!purple_chat_conversation_has_left(chat)) |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35460
diff
changeset
|
1453 | purple_serv_chat_leave(gc, chat_id); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1454 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1455 | /* |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35460
diff
changeset
|
1456 | * If they didn't call purple_serv_got_chat_left by now, it's too late. |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1457 | * So we better do it for them before we destroy the thing. |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1458 | */ |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1459 | if (!purple_chat_conversation_has_left(chat)) |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35460
diff
changeset
|
1460 | purple_serv_got_chat_left(gc, chat_id); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1461 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1462 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1463 | g_hash_table_destroy(priv->users); |
|
34711
a4e0f46652d5
Set IM and Chat data to NULL on finalize as PurpleConversation will pass conversation to UiOps in the end
Ankit Vani <a@nevitus.org>
parents:
34687
diff
changeset
|
1464 | priv->users = NULL; |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1465 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1466 | g_list_foreach(priv->ignored, (GFunc)g_free, NULL); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1467 | g_list_free(priv->ignored); |
|
34711
a4e0f46652d5
Set IM and Chat data to NULL on finalize as PurpleConversation will pass conversation to UiOps in the end
Ankit Vani <a@nevitus.org>
parents:
34687
diff
changeset
|
1468 | priv->ignored = NULL; |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1469 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1470 | g_free(priv->who); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1471 | g_free(priv->topic); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1472 | g_free(priv->nick); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1473 | |
|
34711
a4e0f46652d5
Set IM and Chat data to NULL on finalize as PurpleConversation will pass conversation to UiOps in the end
Ankit Vani <a@nevitus.org>
parents:
34687
diff
changeset
|
1474 | priv->who = NULL; |
|
a4e0f46652d5
Set IM and Chat data to NULL on finalize as PurpleConversation will pass conversation to UiOps in the end
Ankit Vani <a@nevitus.org>
parents:
34687
diff
changeset
|
1475 | priv->topic = NULL; |
|
a4e0f46652d5
Set IM and Chat data to NULL on finalize as PurpleConversation will pass conversation to UiOps in the end
Ankit Vani <a@nevitus.org>
parents:
34687
diff
changeset
|
1476 | priv->nick = NULL; |
|
a4e0f46652d5
Set IM and Chat data to NULL on finalize as PurpleConversation will pass conversation to UiOps in the end
Ankit Vani <a@nevitus.org>
parents:
34687
diff
changeset
|
1477 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1478 | G_OBJECT_CLASS(purple_chat_conversation_parent_class)->finalize(object); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1479 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1480 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1481 | /* Class initializer function */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1482 | static void purple_chat_conversation_class_init(PurpleChatConversationClass *klass) |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1483 | { |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1484 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
34664
45ba05a4bb3b
Used the correct class to override write_message conversation method
Ankit Vani <a@nevitus.org>
parents:
34663
diff
changeset
|
1485 | PurpleConversationClass *conv_class = PURPLE_CONVERSATION_CLASS(klass); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1486 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1487 | obj_class->dispose = purple_chat_conversation_dispose; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1488 | obj_class->finalize = purple_chat_conversation_finalize; |
|
34687
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1489 | obj_class->constructed = purple_chat_conversation_constructed; |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1490 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1491 | /* Setup properties */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1492 | obj_class->get_property = purple_chat_conversation_get_property; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1493 | obj_class->set_property = purple_chat_conversation_set_property; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1494 | |
|
34664
45ba05a4bb3b
Used the correct class to override write_message conversation method
Ankit Vani <a@nevitus.org>
parents:
34663
diff
changeset
|
1495 | conv_class->write_message = chat_conversation_write_message; |
|
34648
a6587d8cf907
Added missing API implementations to PurpleConversation and subclasses
Ankit Vani <a@nevitus.org>
parents:
34646
diff
changeset
|
1496 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1497 | chat_properties[CHAT_PROP_TOPIC_WHO] = g_param_spec_string("topic-who", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1498 | "Who set topic", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
1499 | "Who set the chat topic.", NULL, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1500 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1501 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1502 | chat_properties[CHAT_PROP_TOPIC] = g_param_spec_string("topic", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1503 | "Topic", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1504 | "Topic of the chat.", NULL, |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1505 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1506 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1507 | chat_properties[CHAT_PROP_ID] = g_param_spec_int("chat-id", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1508 | "Chat ID", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
1509 | "The ID of the chat.", G_MININT, G_MAXINT, 0, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1510 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1511 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1512 | chat_properties[CHAT_PROP_NICK] = g_param_spec_string("nick", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1513 | "Nickname", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
1514 | "The nickname of the user in a chat.", NULL, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1515 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1516 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1517 | chat_properties[CHAT_PROP_LEFT] = g_param_spec_boolean("left", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1518 | "Left the chat", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1519 | "Whether the user has left the chat.", FALSE, |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1520 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1521 | |
|
35085
abab0adfa0ec
libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents:
35080
diff
changeset
|
1522 | g_object_class_install_properties(obj_class, CHAT_PROP_LAST, |
|
abab0adfa0ec
libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents:
35080
diff
changeset
|
1523 | chat_properties); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1524 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1525 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1526 | PurpleChatConversation * |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1527 | purple_chat_conversation_new(PurpleAccount *account, const char *name) |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1528 | { |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1529 | PurpleChatConversation *chat; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1530 | PurpleConnection *gc; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1531 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
1532 | g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL); |
|
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
1533 | g_return_val_if_fail(name != NULL, NULL); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1534 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1535 | /* Check if this conversation already exists. */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1536 | if ((chat = purple_conversations_find_chat_with_account(name, account)) != NULL) |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1537 | { |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1538 | if (!purple_chat_conversation_has_left(chat)) { |
|
35176
b0659f31989d
Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents:
35098
diff
changeset
|
1539 | purple_debug_warning("conversationtypes", "Trying to create " |
|
b0659f31989d
Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents:
35098
diff
changeset
|
1540 | "multiple chats (%s) with the same name is deprecated and " |
|
b0659f31989d
Update debug categories for new filenames
Ankit Vani <a@nevitus.org>
parents:
35098
diff
changeset
|
1541 | "will be removed in libpurple 3.0.0", name); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1542 | } else { |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1543 | /* |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
1544 | * This hack is necessary because some protocols (MSN) have unnamed chats |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1545 | * that all use the same name. A PurpleConversation for one of those |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1546 | * is only ever re-used if the user has left, so calls to |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1547 | * purple_conversation_new need to fall-through to creating a new |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1548 | * chat. |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1549 | * TODO 3.0.0: Remove this workaround and mandate unique names. |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1550 | */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1551 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1552 | chat_conversation_cleanup_for_rejoin(chat); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1553 | return chat; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1554 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1555 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1556 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1557 | gc = purple_account_get_connection(account); |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
1558 | g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), NULL); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1559 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1560 | chat = g_object_new(PURPLE_TYPE_CHAT_CONVERSATION, |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1561 | "account", account, |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1562 | "name", name, |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1563 | "title", name, |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1564 | NULL); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1565 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1566 | return chat; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1567 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1568 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1569 | /************************************************************************** |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1570 | * Chat Conversation User API |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1571 | **************************************************************************/ |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1572 | static int |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1573 | purple_chat_user_compare(PurpleChatUser *a, PurpleChatUser *b) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1574 | { |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1575 | PurpleChatUserFlags f1 = 0, f2 = 0; |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1576 | PurpleChatUserPrivate *priva, *privb; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1577 | char *user1 = NULL, *user2 = NULL; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1578 | gint ret = 0; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1579 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1580 | priva = purple_chat_user_get_instance_private(a); |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1581 | privb = purple_chat_user_get_instance_private(b); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1582 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1583 | if (priva) { |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1584 | f1 = priva->flags; |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1585 | if (priva->alias_key) |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1586 | user1 = priva->alias_key; |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1587 | else if (priva->name) |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1588 | user1 = priva->name; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1589 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1590 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1591 | if (privb) { |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1592 | f2 = privb->flags; |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1593 | if (privb->alias_key) |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1594 | user2 = privb->alias_key; |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1595 | else if (privb->name) |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1596 | user2 = privb->name; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1597 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1598 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1599 | if (user1 == NULL || user2 == NULL) { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1600 | if (!(user1 == NULL && user2 == NULL)) |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1601 | ret = (user1 == NULL) ? -1: 1; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1602 | } else if (f1 != f2) { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1603 | /* sort more important users first */ |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1604 | ret = (f1 > f2) ? -1 : 1; |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1605 | } else if (priva->buddy != privb->buddy) { |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1606 | ret = priva->buddy ? -1 : 1; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1607 | } else { |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1608 | ret = purple_utf8_strcasecmp(user1, user2); |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1609 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1610 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1611 | return ret; |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1612 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1613 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1614 | const char * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1615 | purple_chat_user_get_alias(PurpleChatUser *cb) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1616 | { |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1617 | PurpleChatUserPrivate *priv; |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1618 | priv = purple_chat_user_get_instance_private(cb); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1619 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1620 | g_return_val_if_fail(priv != NULL, NULL); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1621 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1622 | return priv->alias; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1623 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1624 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1625 | const char * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1626 | purple_chat_user_get_name(PurpleChatUser *cb) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1627 | { |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1628 | PurpleChatUserPrivate *priv; |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1629 | priv = purple_chat_user_get_instance_private(cb); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1630 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1631 | g_return_val_if_fail(priv != NULL, NULL); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1632 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1633 | return priv->name; |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1634 | } |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1635 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1636 | void |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1637 | purple_chat_user_set_flags(PurpleChatUser *cb, |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1638 | PurpleChatUserFlags flags) |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1639 | { |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1640 | PurpleConversationUiOps *ops; |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1641 | PurpleChatUserFlags oldflags; |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1642 | PurpleChatUserPrivate *priv; |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1643 | priv = purple_chat_user_get_instance_private(cb); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1644 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1645 | g_return_if_fail(priv != NULL); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1646 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1647 | if (flags == priv->flags) |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1648 | return; |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1649 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1650 | oldflags = priv->flags; |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1651 | priv->flags = flags; |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1652 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1653 | g_object_notify_by_pspec(G_OBJECT(cb), cu_properties[CU_PROP_FLAGS]); |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1654 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1655 | ops = purple_conversation_get_ui_ops(PURPLE_CONVERSATION(priv->chat)); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1656 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1657 | if (ops != NULL && ops->chat_update_user != NULL) |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1658 | ops->chat_update_user(cb); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1659 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1660 | purple_signal_emit(purple_conversations_get_handle(), |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1661 | "chat-user-flags", cb, oldflags, flags); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1662 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1663 | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1664 | PurpleChatUserFlags |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1665 | purple_chat_user_get_flags(PurpleChatUser *cb) |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1666 | { |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1667 | PurpleChatUserPrivate *priv; |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1668 | priv = purple_chat_user_get_instance_private(cb); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1669 | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1670 | g_return_val_if_fail(priv != NULL, PURPLE_CHAT_USER_NONE); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1671 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1672 | return priv->flags; |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1673 | } |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1674 | |
|
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1675 | void |
|
34681
1b2233f987cb
Backed out changeset f39c64847a3d
Ankit Vani <a@nevitus.org>
parents:
34680
diff
changeset
|
1676 | purple_chat_user_set_ui_data(PurpleChatUser *cb, gpointer ui_data) |
|
1b2233f987cb
Backed out changeset f39c64847a3d
Ankit Vani <a@nevitus.org>
parents:
34680
diff
changeset
|
1677 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
1678 | g_return_if_fail(PURPLE_IS_CHAT_USER(cb)); |
|
34681
1b2233f987cb
Backed out changeset f39c64847a3d
Ankit Vani <a@nevitus.org>
parents:
34680
diff
changeset
|
1679 | |
|
34682
5eed877cb061
Moved ui_data to the object structure, and added back [gs]et_ui_data() methods
Ankit Vani <a@nevitus.org>
parents:
34681
diff
changeset
|
1680 | cb->ui_data = ui_data; |
|
34681
1b2233f987cb
Backed out changeset f39c64847a3d
Ankit Vani <a@nevitus.org>
parents:
34680
diff
changeset
|
1681 | } |
|
1b2233f987cb
Backed out changeset f39c64847a3d
Ankit Vani <a@nevitus.org>
parents:
34680
diff
changeset
|
1682 | |
|
1b2233f987cb
Backed out changeset f39c64847a3d
Ankit Vani <a@nevitus.org>
parents:
34680
diff
changeset
|
1683 | gpointer |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1684 | purple_chat_user_get_ui_data(PurpleChatUser *cb) |
|
34681
1b2233f987cb
Backed out changeset f39c64847a3d
Ankit Vani <a@nevitus.org>
parents:
34680
diff
changeset
|
1685 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
1686 | g_return_val_if_fail(PURPLE_IS_CHAT_USER(cb), NULL); |
|
34681
1b2233f987cb
Backed out changeset f39c64847a3d
Ankit Vani <a@nevitus.org>
parents:
34680
diff
changeset
|
1687 | |
|
34682
5eed877cb061
Moved ui_data to the object structure, and added back [gs]et_ui_data() methods
Ankit Vani <a@nevitus.org>
parents:
34681
diff
changeset
|
1688 | return cb->ui_data; |
|
34681
1b2233f987cb
Backed out changeset f39c64847a3d
Ankit Vani <a@nevitus.org>
parents:
34680
diff
changeset
|
1689 | } |
|
1b2233f987cb
Backed out changeset f39c64847a3d
Ankit Vani <a@nevitus.org>
parents:
34680
diff
changeset
|
1690 | |
|
1b2233f987cb
Backed out changeset f39c64847a3d
Ankit Vani <a@nevitus.org>
parents:
34680
diff
changeset
|
1691 | void |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1692 | purple_chat_user_set_chat(PurpleChatUser *cb, |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1693 | PurpleChatConversation *chat) |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1694 | { |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1695 | PurpleChatUserPrivate *priv; |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1696 | priv = purple_chat_user_get_instance_private(cb); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1697 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1698 | g_return_if_fail(priv != NULL); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1699 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1700 | priv->chat = chat; |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1701 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1702 | g_object_notify_by_pspec(G_OBJECT(cb), cu_properties[CU_PROP_CHAT]); |
|
34602
dbe6ee43aaa7
Created conversationtypes.[ch] for PurpleChatConversation and PurpleIMConversation
Ankit Vani <a@nevitus.org>
parents:
diff
changeset
|
1703 | } |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1704 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1705 | PurpleChatConversation * |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1706 | purple_chat_user_get_chat(PurpleChatUser *cb) |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1707 | { |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1708 | PurpleChatUserPrivate *priv; |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1709 | priv = purple_chat_user_get_instance_private(cb); |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1710 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1711 | g_return_val_if_fail(priv != NULL, NULL); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1712 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1713 | return priv->chat; |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1714 | } |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1715 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1716 | gboolean |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1717 | purple_chat_user_is_buddy(PurpleChatUser *cb) |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1718 | { |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1719 | PurpleChatUserPrivate *priv; |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1720 | priv = purple_chat_user_get_instance_private(cb); |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1721 | |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1722 | g_return_val_if_fail(priv != NULL, FALSE); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1723 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1724 | return priv->buddy; |
|
34649
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1725 | } |
|
4a0ec0fff2e1
Refactored PurpleConversation base object to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34648
diff
changeset
|
1726 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1727 | /************************************************************************** |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1728 | * GObject code for chat user |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1729 | **************************************************************************/ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1730 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1731 | /* Set method for GObject properties */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1732 | static void |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1733 | purple_chat_user_set_property(GObject *obj, guint param_id, const GValue *value, |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1734 | GParamSpec *pspec) |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1735 | { |
|
34671
ca9b45be7a63
Renamed chat buddy to chat user in a few more places
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
1736 | PurpleChatUser *cb = PURPLE_CHAT_USER(obj); |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1737 | PurpleChatUserPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1738 | purple_chat_user_get_instance_private(cb); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1739 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1740 | switch (param_id) { |
|
34672
7293ef617eb9
Replaced CB_PROP_* enums with CU_PROP_*
Ankit Vani <a@nevitus.org>
parents:
34671
diff
changeset
|
1741 | case CU_PROP_CHAT: |
|
34665
854204c05f70
Assign PurpleChatConversationBuddy initialization properties directly
Ankit Vani <a@nevitus.org>
parents:
34664
diff
changeset
|
1742 | priv->chat = g_value_get_object(value); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1743 | break; |
|
34672
7293ef617eb9
Replaced CB_PROP_* enums with CU_PROP_*
Ankit Vani <a@nevitus.org>
parents:
34671
diff
changeset
|
1744 | case CU_PROP_NAME: |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1745 | g_free(priv->name); |
|
39423
6b457e717666
Use g_value_dup_string where needed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39380
diff
changeset
|
1746 | priv->name = g_value_dup_string(value); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1747 | break; |
|
34672
7293ef617eb9
Replaced CB_PROP_* enums with CU_PROP_*
Ankit Vani <a@nevitus.org>
parents:
34671
diff
changeset
|
1748 | case CU_PROP_ALIAS: |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1749 | g_free(priv->alias); |
|
39423
6b457e717666
Use g_value_dup_string where needed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39380
diff
changeset
|
1750 | priv->alias = g_value_dup_string(value); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1751 | break; |
|
34672
7293ef617eb9
Replaced CB_PROP_* enums with CU_PROP_*
Ankit Vani <a@nevitus.org>
parents:
34671
diff
changeset
|
1752 | case CU_PROP_FLAGS: |
|
34665
854204c05f70
Assign PurpleChatConversationBuddy initialization properties directly
Ankit Vani <a@nevitus.org>
parents:
34664
diff
changeset
|
1753 | priv->flags = g_value_get_flags(value); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1754 | break; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1755 | default: |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1756 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1757 | break; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1758 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1759 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1760 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1761 | /* Get method for GObject properties */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1762 | static void |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1763 | purple_chat_user_get_property(GObject *obj, guint param_id, GValue *value, |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1764 | GParamSpec *pspec) |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1765 | { |
|
34671
ca9b45be7a63
Renamed chat buddy to chat user in a few more places
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
1766 | PurpleChatUser *cb = PURPLE_CHAT_USER(obj); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1767 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1768 | switch (param_id) { |
|
34672
7293ef617eb9
Replaced CB_PROP_* enums with CU_PROP_*
Ankit Vani <a@nevitus.org>
parents:
34671
diff
changeset
|
1769 | case CU_PROP_CHAT: |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1770 | g_value_set_object(value, purple_chat_user_get_chat(cb)); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1771 | break; |
|
34672
7293ef617eb9
Replaced CB_PROP_* enums with CU_PROP_*
Ankit Vani <a@nevitus.org>
parents:
34671
diff
changeset
|
1772 | case CU_PROP_NAME: |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1773 | g_value_set_string(value, purple_chat_user_get_name(cb)); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1774 | break; |
|
34672
7293ef617eb9
Replaced CB_PROP_* enums with CU_PROP_*
Ankit Vani <a@nevitus.org>
parents:
34671
diff
changeset
|
1775 | case CU_PROP_ALIAS: |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1776 | g_value_set_string(value, purple_chat_user_get_alias(cb)); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1777 | break; |
|
34672
7293ef617eb9
Replaced CB_PROP_* enums with CU_PROP_*
Ankit Vani <a@nevitus.org>
parents:
34671
diff
changeset
|
1778 | case CU_PROP_FLAGS: |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1779 | g_value_set_flags(value, purple_chat_user_get_flags(cb)); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1780 | break; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1781 | default: |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1782 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1783 | break; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1784 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1785 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1786 | |
|
34687
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1787 | /* GObject initialization function */ |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1788 | static void |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1789 | purple_chat_user_init(PurpleChatUser *user) |
|
34687
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1790 | { |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1791 | } |
|
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1792 | |
|
35012
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1793 | /* Called when done constructing */ |
|
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1794 | static void |
|
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1795 | purple_chat_user_constructed(GObject *object) |
|
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1796 | { |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1797 | PurpleChatUserPrivate *priv = purple_chat_user_get_instance_private( |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1798 | PURPLE_CHAT_USER(object)); |
|
35012
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1799 | PurpleAccount *account; |
|
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1800 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1801 | G_OBJECT_CLASS(purple_chat_user_parent_class)->constructed(object); |
|
35012
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1802 | |
|
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1803 | account = purple_conversation_get_account(PURPLE_CONVERSATION(priv->chat)); |
|
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1804 | |
|
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1805 | if (purple_blist_find_buddy(account, priv->name) != NULL) |
|
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1806 | priv->buddy = TRUE; |
|
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1807 | } |
|
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1808 | |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1809 | /* GObject finalize function */ |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1810 | static void |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1811 | purple_chat_user_finalize(GObject *object) |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1812 | { |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
1813 | PurpleChatUser *cb = PURPLE_CHAT_USER(object); |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1814 | PurpleChatUserPrivate *priv = |
|
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1815 | purple_chat_user_get_instance_private(cb); |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
1816 | |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
1817 | purple_signal_emit(purple_conversations_get_handle(), |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
1818 | "deleting-chat-user", cb); |
|
34651
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1819 | |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1820 | g_free(priv->alias); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1821 | g_free(priv->alias_key); |
|
88c104a20f4b
Refactored the PurpleConversation subclasses and subsystem to use the GObject conversation API.
Ankit Vani <a@nevitus.org>
parents:
34649
diff
changeset
|
1822 | g_free(priv->name); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1823 | |
|
39380
3088866c22f4
libpurple: Port almost self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
39352
diff
changeset
|
1824 | G_OBJECT_CLASS(purple_chat_user_parent_class)->finalize(object); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1825 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1826 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1827 | /* Class initializer function */ |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1828 | static void purple_chat_user_class_init(PurpleChatUserClass *klass) |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1829 | { |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1830 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1831 | |
|
35012
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1832 | obj_class->constructed = purple_chat_user_constructed; |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1833 | obj_class->finalize = purple_chat_user_finalize; |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1834 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1835 | /* Setup properties */ |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1836 | obj_class->get_property = purple_chat_user_get_property; |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1837 | obj_class->set_property = purple_chat_user_set_property; |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1838 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1839 | cu_properties[CU_PROP_CHAT] = g_param_spec_object("chat", "Chat", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
1840 | "The chat the buddy belongs to.", PURPLE_TYPE_CHAT_CONVERSATION, |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
1841 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1842 | G_PARAM_STATIC_STRINGS); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1843 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1844 | cu_properties[CU_PROP_NAME] = g_param_spec_string("name", "Name", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1845 | "Name of the chat user.", NULL, |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1846 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1847 | |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1848 | cu_properties[CU_PROP_ALIAS] = g_param_spec_string("alias", "Alias", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
1849 | "Alias of the chat user.", NULL, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1850 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1851 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1852 | cu_properties[CU_PROP_FLAGS] = g_param_spec_flags("flags", "Buddy flags", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35012
diff
changeset
|
1853 | "The flags for the chat user.", |
|
34687
aebc4dd321bf
Use GObject constructed for PurpleConversation, PurpleIMConversation and PurpleChatConversation
Ankit Vani <a@nevitus.org>
parents:
34682
diff
changeset
|
1854 | PURPLE_TYPE_CHAT_USER_FLAGS, PURPLE_CHAT_USER_NONE, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
1855 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1856 | |
|
35085
abab0adfa0ec
libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents:
35080
diff
changeset
|
1857 | g_object_class_install_properties(obj_class, CU_PROP_LAST, cu_properties); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1858 | } |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1859 | |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1860 | PurpleChatUser * |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1861 | purple_chat_user_new(PurpleChatConversation *chat, const char *name, |
|
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1862 | const char *alias, PurpleChatUserFlags flags) |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1863 | { |
|
34670
9bd5bd903dc7
Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents:
34669
diff
changeset
|
1864 | PurpleChatUser *cb; |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1865 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34945
diff
changeset
|
1866 | g_return_val_if_fail(PURPLE_IS_CHAT_CONVERSATION(chat), NULL); |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1867 | g_return_val_if_fail(name != NULL, NULL); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1868 | |
|
34671
ca9b45be7a63
Renamed chat buddy to chat user in a few more places
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
1869 | cb = g_object_new(PURPLE_TYPE_CHAT_USER, |
|
35012
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1870 | "chat", chat, |
|
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1871 | "name", name, |
|
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1872 | "alias", alias, |
|
e07a9b9c6bda
Cleaned up properties and added g_object_notify calls for PurpleConnection and PurpleConversation's
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
1873 | "flags", flags, |
|
34646
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1874 | NULL); |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1875 | |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1876 | return cb; |
|
e7f4631e93f7
Begun adding GObject code to conversation sources
Ankit Vani <a@nevitus.org>
parents:
34620
diff
changeset
|
1877 | } |