annotate libpurple/protocols/gg/gg-utils.c @ 32827:4a34689eeb33 default tip

merged from im.pidgin.pidgin
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sat, 19 Nov 2011 14:42:54 +0900
parents 03a55a2997d1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file gg-utils.c
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
4 * purple
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * Copyright (C) 2005 Bartosz Oler <bartosz@bzimage.us>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 15823
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 #include "gg-utils.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 /* uin_t ggp_str_to_uin(const char *str) {{{ */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 uin_t ggp_str_to_uin(const char *str)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 long num;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 if (!str)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 errno = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 num = strtol(str, &tmp, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 if (*str == '\0' || *tmp != '\0')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 if ((errno == ERANGE || (num == LONG_MAX || num == LONG_MIN))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 #if (LONG_MAX > UINT_MAX)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 || num > (long)UINT_MAX
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 || num < 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 return (uin_t) num;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 /* }}} */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 /* unsigned int ggp_array_size(char **array) {{{ */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 unsigned int ggp_array_size(char **array)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 unsigned int i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 for (i = 0; array[i] != NULL && i < UINT_MAX; i++)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 {}
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 return i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 /* }}} */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 /* char *charset_convert(const gchar *locstr, const char *encsrc, const char *encdst) {{{ */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 char *charset_convert(const gchar *locstr, const char *encsrc, const char *encdst)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 gchar *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69 GError *err = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 if (locstr == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 msg = g_convert_with_fallback(locstr, strlen(locstr), encdst, encsrc,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 "?", NULL, NULL, &err);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 if (err != NULL) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
77 purple_debug_error("gg", "Error converting from %s to %s: %s\n",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 encsrc, encdst, err->message);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 g_error_free(err);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 /* Just in case? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 if (msg == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 msg = g_strdup(locstr);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 return msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 /* }}} */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
90 /* ggp_get_uin(PurpleAccount *account) {{{ */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
91 uin_t ggp_get_uin(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
93 return ggp_str_to_uin(purple_account_get_username(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 /* }}} */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
97 /* char *ggp_buddy_get_name(PurpleConnection *gc, const uin_t uin) {{{ */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
98 char *ggp_buddy_get_name(PurpleConnection *gc, const uin_t uin)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
100 PurpleBuddy *buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 gchar *str_uin;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 str_uin = g_strdup_printf("%lu", (unsigned long int)uin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
105 buddy = purple_find_buddy(purple_connection_get_account(gc), str_uin);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 if (buddy != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 g_free(str_uin);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
108 return g_strdup(purple_buddy_get_alias(buddy));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 return str_uin;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 /* }}} */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114
21061
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
115 void ggp_status_fake_to_self(PurpleAccount *account)
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
116 {
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
117 PurplePresence *presence;
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
118 PurpleStatus *status;
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
119 const char *status_id;
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
120 const char *msg;
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
121
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
122 if (! purple_find_buddy(account, purple_account_get_username(account)))
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
123 return;
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
124
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
125 presence = purple_account_get_presence(account);
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
126 status = purple_presence_get_active_status(presence);
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
127 msg = purple_status_get_attr_string(status, "message");
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
128 if (msg && !*msg)
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
129 msg = NULL;
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
130
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
131 status_id = purple_status_get_id(status);
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
132 if (strcmp(status_id, "invisible") == 0) {
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
133 status_id = "offline";
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
134 }
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
135
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
136 if (msg) {
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
137 if (strlen(msg) > GG_STATUS_DESCR_MAXSIZE) {
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
138 msg = purple_markup_slice(msg, 0, GG_STATUS_DESCR_MAXSIZE);
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
139 }
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
140 }
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
141 purple_prpl_got_user_status(account, purple_account_get_username(account),
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
142 status_id,
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
143 msg ? "message" : NULL, msg, NULL);
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
144 }
1d92b85ef5d9 gg: Properly display your status in the buddylist.
Bartoz Oler <bartosz@pidgin.im>
parents: 19680
diff changeset
145
32737
03a55a2997d1 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
tomkiewicz@cpw.pidgin.im
parents: 21061
diff changeset
146 guint ggp_http_input_add(struct gg_http *http_req, PurpleInputFunction func,
03a55a2997d1 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
tomkiewicz@cpw.pidgin.im
parents: 21061
diff changeset
147 gpointer user_data)
03a55a2997d1 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
tomkiewicz@cpw.pidgin.im
parents: 21061
diff changeset
148 {
03a55a2997d1 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
tomkiewicz@cpw.pidgin.im
parents: 21061
diff changeset
149 PurpleInputCondition cond = 0;
03a55a2997d1 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
tomkiewicz@cpw.pidgin.im
parents: 21061
diff changeset
150 int check = http_req->check;
03a55a2997d1 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
tomkiewicz@cpw.pidgin.im
parents: 21061
diff changeset
151
03a55a2997d1 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
tomkiewicz@cpw.pidgin.im
parents: 21061
diff changeset
152 if (check & GG_CHECK_READ)
03a55a2997d1 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
tomkiewicz@cpw.pidgin.im
parents: 21061
diff changeset
153 cond |= PURPLE_INPUT_READ;
03a55a2997d1 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
tomkiewicz@cpw.pidgin.im
parents: 21061
diff changeset
154 if (check & GG_CHECK_WRITE)
03a55a2997d1 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
tomkiewicz@cpw.pidgin.im
parents: 21061
diff changeset
155 cond |= PURPLE_INPUT_WRITE;
03a55a2997d1 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
tomkiewicz@cpw.pidgin.im
parents: 21061
diff changeset
156
03a55a2997d1 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
tomkiewicz@cpw.pidgin.im
parents: 21061
diff changeset
157 return purple_input_add(http_req->fd, cond, func, user_data);
03a55a2997d1 Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652
tomkiewicz@cpw.pidgin.im
parents: 21061
diff changeset
158 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 /* vim: set ts=8 sts=0 sw=8 noet: */