annotate src/dbus-useful.c @ 11261:b53606580f68

[gaim-migrate @ 13439] Patch #1226486 from Levi Bard Fixes bug #1224178 If you change the topic in a chat room and that topic change is rejected, the topic field is wrong -- it shows the new topic even thought it didn't get set. This patch resets the GUI's topic immediately when you hit enter. Then, if the topic change is successful, the server will echo the topic change back to us and we'll update the GUI to the new topic. The only question is, does the server always echo the topic back to us? From the core's point of view, I'm ready to assume yes. It's the case for both IRC and Jabber*. If someone could test changing a topic in SILC or Zephyr, that'd be great. If servers using those protocols do not echo the topic back, the prpl will have to fake it as appropriate. * I didn't actually test on Jabber, but Nathan said the server will echo the topic change back. If it's broken, let me know. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sun, 14 Aug 2005 06:55:57 +0000
parents 744c0708d11f
children 64fadbf3810f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
1 #include <string.h>
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
2 #include <glib.h>
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
3
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
4 #include "conversation.h"
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
5 #include "util.h"
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
6
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
7
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
8
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
9 GaimAccount *
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
10 gaim_accounts_find_ext(const char *name, const char *protocol_id,
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
11 gboolean (*account_test)(const GaimAccount *account))
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
12 {
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
13 GaimAccount *result = NULL;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
14 GList *l;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
15 char *who;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
16
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
17 if (name)
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
18 who = g_strdup(gaim_normalize(NULL, name));
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
19 else
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
20 who = NULL;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
21
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
22 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) {
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
23 GaimAccount *account = (GaimAccount *)l->data;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
24
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
25 if (who && strcmp(gaim_normalize(NULL, gaim_account_get_username(account)), who))
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
26 continue;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
27
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
28 if (protocol_id && strcmp(account->protocol_id, protocol_id))
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
29 continue;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
30
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
31 if (account_test && !account_test(account))
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
32 continue;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
33
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
34 result = account;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
35 break;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
36 }
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
37
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
38 g_free(who);
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
39
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
40 return result;
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
41 }
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
42
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
43 GaimAccount *gaim_accounts_find_any(const char *name, const char *protocol)
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
44 {
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
45 return gaim_accounts_find_ext(name, protocol, NULL);
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
46 }
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
47
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
48 GaimAccount *gaim_accounts_find_connected(const char *name, const char *protocol)
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
49 {
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
50 return gaim_accounts_find_ext(name, protocol, gaim_account_is_connected);
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
51 }
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
52
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents:
diff changeset
53
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
54 /* DBusMessage *gaim_account_set_status_DBUS(DBusMessage *message_DBUS, DBusError *error_DBUS) */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
55 /* { */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
56 /* DBusMessage *reply; */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
57 /* DBusMessageIter iter; */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
58
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
59 /* dbus_int32_t account, active; */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
60 /* char *status_id; */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
61
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
62 /* dbus_message_iter_init(message, &iter); */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
63 /* const char *name; */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
64 /* const char *protocol; */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
65
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
66 /* dbus_message_get_args(message_DBUS, error_DBUS, DBUS_TYPE_STRING, &name, DBUS_TYPE_STRING, &protocol, DBUS_TYPE_INVALID); */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
67 /* CHECK_ERROR(error_DBUS); */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
68 /* NULLIFY(name); */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
69 /* NULLIFY(protocol); */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
70 /* GAIM_DBUS_POINTER_TO_ID(RESULT, gaim_accounts_find_any(name, protocol), error_DBUS); */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
71 /* reply_DBUS = dbus_message_new_method_return (message_DBUS); */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
72 /* dbus_message_append_args(reply_DBUS, DBUS_TYPE_INT32, &RESULT, DBUS_TYPE_INVALID); */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
73 /* return reply_DBUS; */
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
74
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
75 /* } */