Mercurial > pidgin
comparison src/server.c @ 11064:e4459e8ccfb5
[gaim-migrate @ 13035]
Patch #1208082 from Levi Bard (tak_tak)
This patch modifies the chat-invited signal so plugins can programmatically accept or reject chat invitations.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Thu, 07 Jul 2005 02:47:49 +0000 |
parents | 2b772e7094ef |
children | 90be432e8385 |
comparison
equal
deleted
inserted
replaced
11063:7a11ff12eb4b | 11064:e4459e8ccfb5 |
---|---|
997 const char *who, const char *message, GHashTable *data) | 997 const char *who, const char *message, GHashTable *data) |
998 { | 998 { |
999 GaimAccount *account; | 999 GaimAccount *account; |
1000 char buf2[BUF_LONG]; | 1000 char buf2[BUF_LONG]; |
1001 struct chat_invite_data *cid = g_new0(struct chat_invite_data, 1); | 1001 struct chat_invite_data *cid = g_new0(struct chat_invite_data, 1); |
1002 int plugin_return; | |
1002 | 1003 |
1003 account = gaim_connection_get_account(gc); | 1004 account = gaim_connection_get_account(gc); |
1004 | 1005 |
1005 gaim_signal_emit(gaim_conversations_get_handle(), | 1006 plugin_return = GPOINTER_TO_INT(gaim_signal_emit_return_1( |
1006 "chat-invited", account, who, name, message, data); | 1007 gaim_conversations_get_handle(), |
1007 | 1008 "chat-invited", account, who, name, message, data)); |
1008 if (message != NULL) | 1009 |
1010 cid->gc = gc; | |
1011 cid->components = data; | |
1012 | |
1013 if (plugin_return == 0) | |
1009 { | 1014 { |
1010 g_snprintf(buf2, sizeof(buf2), | 1015 if (message != NULL) |
1016 { | |
1017 g_snprintf(buf2, sizeof(buf2), | |
1011 _("%s has invited %s to the chat room %s:\n%s"), | 1018 _("%s has invited %s to the chat room %s:\n%s"), |
1012 who, gaim_account_get_username(account), name, message); | 1019 who, gaim_account_get_username(account), name, message); |
1013 } | 1020 } |
1014 else | 1021 else |
1015 g_snprintf(buf2, sizeof(buf2), | 1022 g_snprintf(buf2, sizeof(buf2), |
1016 _("%s has invited %s to the chat room %s\n"), | 1023 _("%s has invited %s to the chat room %s\n"), |
1017 who, gaim_account_get_username(account), name); | 1024 who, gaim_account_get_username(account), name); |
1018 | 1025 |
1019 cid->gc = gc; | 1026 |
1020 cid->components = data; | 1027 gaim_request_accept_cancel(gc, NULL, _("Accept chat invitation?"), buf2, |
1021 | |
1022 gaim_request_accept_cancel(gc, NULL, _("Accept chat invitation?"), buf2, | |
1023 GAIM_DEFAULT_ACTION_NONE, cid, | 1028 GAIM_DEFAULT_ACTION_NONE, cid, |
1024 G_CALLBACK(chat_invite_accept), | 1029 G_CALLBACK(chat_invite_accept), |
1025 G_CALLBACK(chat_invite_reject)); | 1030 G_CALLBACK(chat_invite_reject)); |
1031 } | |
1032 else if (plugin_return > 0) | |
1033 chat_invite_accept(cid); | |
1034 else | |
1035 chat_invite_reject(cid); | |
1026 } | 1036 } |
1027 | 1037 |
1028 GaimConversation *serv_got_joined_chat(GaimConnection *gc, | 1038 GaimConversation *serv_got_joined_chat(GaimConnection *gc, |
1029 int id, const char *name) | 1039 int id, const char *name) |
1030 { | 1040 { |