Thu, 01 Dec 2005 20:09:27 +0000
[gaim-migrate @ 14589]
Ok, so I'm changing the semantics of gaim_account_notify_added, having it
check for the existance of a buddy was breaking some jabber scenarios. So
buddy checks should now be done in the prpls. I also added a
gaim_account_request_add. _notify_added only notifies the user of the add,
request_add notifies the user AND asks them if they want to add the buddy to
their buddy list.
I only updated jabber for these changes because it's the only protocol I
really know at all well. So everyone PLEASE make sure that the other protocols
get updated for this. That is make sure that when you expect to prompt the
user to add the buddy you use _request_add instead of just using _notify_added
and expecting the core to determine if it needs to prompt the user.
Oh, there are also some other jabber changes which should hopefully fix some
issues that people were seeing, like buddies not signing off when you
unsubscribed with them, etc. Let me know if anyone notices any jabber oddities
after this.
| 9179 | 1 | /* |
| 2 | * Extra conversation placement options for Gaim | |
| 3 | * | |
| 4 | * Gaim is the legal property of its developers, whose names are too numerous | |
| 5 | * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 6 | * source distribution. | |
| 7 | * | |
| 8 | * This program is free software; you can redistribute it and/or | |
| 9 | * modify it under the terms of the GNU General Public License | |
| 10 | * as published by the Free Software Foundation; either version 2 | |
| 11 | * of the License, or (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
| 20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 21 | */ | |
| 22 | ||
| 9157 | 23 | #include "internal.h" |
| 9791 | 24 | #include "gtkgaim.h" |
| 9157 | 25 | #include "conversation.h" |
| 9943 | 26 | #include "version.h" |
| 9215 | 27 | #include "gtkplugin.h" |
| 11581 | 28 | #include "gtkconv.h" |
| 29 | #include "gtkconvwin.h" | |
| 9157 | 30 | |
| 31 | static void | |
| 11581 | 32 | conv_placement_by_number(GaimGtkConversation *conv) |
| 9157 | 33 | { |
| 11581 | 34 | GaimGtkWindow *win = NULL; |
|
12168
f1cb35825de9
[gaim-migrate @ 14469]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11581
diff
changeset
|
35 | GList *wins = NULL; |
| 9157 | 36 | |
| 9425 | 37 | if (gaim_prefs_get_bool("/plugins/gtk/extplacement/placement_number_separate")) |
| 11581 | 38 | win = gaim_gtk_conv_window_last_with_type(gaim_conversation_get_type(conv->active_conv)); |
|
12168
f1cb35825de9
[gaim-migrate @ 14469]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11581
diff
changeset
|
39 | else if ((wins = gaim_gtk_conv_windows_get_list()) != NULL) |
|
f1cb35825de9
[gaim-migrate @ 14469]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11581
diff
changeset
|
40 | win = g_list_last(wins)->data; |
| 9157 | 41 | |
| 42 | if (win == NULL) { | |
| 11581 | 43 | win = gaim_gtk_conv_window_new(); |
| 9157 | 44 | |
| 11581 | 45 | gaim_gtk_conv_window_add_gtkconv(win, conv); |
| 46 | gaim_gtk_conv_window_show(win); | |
| 9157 | 47 | } else { |
| 9179 | 48 | int max_count = gaim_prefs_get_int("/plugins/gtk/extplacement/placement_number"); |
| 11581 | 49 | int count = gaim_gtk_conv_window_get_gtkconv_count(win); |
| 9157 | 50 | |
| 51 | if (count < max_count) | |
| 11581 | 52 | gaim_gtk_conv_window_add_gtkconv(win, conv); |
| 9157 | 53 | else { |
| 54 | GList *l = NULL; | |
| 55 | ||
| 11581 | 56 | for (l = gaim_gtk_conv_windows_get_list(); l != NULL; l = l->next) { |
| 57 | win = l->data; | |
| 9157 | 58 | |
| 9425 | 59 | if (gaim_prefs_get_bool("/plugins/gtk/extplacement/placement_number_separate") && |
| 11581 | 60 | gaim_conversation_get_type(gaim_gtk_conv_window_get_active_conversation(win)) != gaim_conversation_get_type(conv->active_conv)) |
| 9425 | 61 | continue; |
| 62 | ||
| 11581 | 63 | count = gaim_gtk_conv_window_get_gtkconv_count(win); |
| 9157 | 64 | if (count < max_count) { |
| 11581 | 65 | gaim_gtk_conv_window_add_gtkconv(win, conv); |
| 9157 | 66 | return; |
| 67 | } | |
| 68 | } | |
| 11581 | 69 | win = gaim_gtk_conv_window_new(); |
| 9157 | 70 | |
| 11581 | 71 | gaim_gtk_conv_window_add_gtkconv(win, conv); |
| 72 | gaim_gtk_conv_window_show(win); | |
| 9157 | 73 | } |
| 74 | } | |
| 75 | } | |
| 76 | ||
| 77 | static gboolean | |
| 78 | plugin_load(GaimPlugin *plugin) | |
| 79 | { | |
| 11581 | 80 | gaim_gtkconv_placement_add_fnc("number", _("By conversation count"), |
| 9157 | 81 | &conv_placement_by_number); |
| 9179 | 82 | gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
| 9157 | 83 | return TRUE; |
| 84 | } | |
| 85 | ||
| 86 | static gboolean | |
| 87 | plugin_unload(GaimPlugin *plugin) | |
| 88 | { | |
| 11581 | 89 | gaim_gtkconv_placement_remove_fnc("number"); |
| 9179 | 90 | gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); |
| 9157 | 91 | return TRUE; |
| 92 | } | |
| 93 | ||
| 94 | static GaimPluginPrefFrame * | |
| 95 | get_plugin_pref_frame(GaimPlugin *plugin) { | |
| 96 | GaimPluginPrefFrame *frame; | |
| 97 | GaimPluginPref *ppref; | |
| 98 | ||
| 99 | frame = gaim_plugin_pref_frame_new(); | |
| 100 | ||
|
9217
e24b8de727d7
[gaim-migrate @ 10013]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9215
diff
changeset
|
101 | ppref = gaim_plugin_pref_new_with_label(_("Conversation Placement")); |
| 9157 | 102 | gaim_plugin_pref_frame_add(frame, ppref); |
| 103 | ||
| 104 | ppref = gaim_plugin_pref_new_with_name_and_label( | |
| 9425 | 105 | "/plugins/gtk/extplacement/placement_number", |
| 106 | _("Number of conversations per window")); | |
| 9157 | 107 | gaim_plugin_pref_set_bounds(ppref, 1, 50); |
| 108 | gaim_plugin_pref_frame_add(frame, ppref); | |
| 109 | ||
| 9425 | 110 | ppref = gaim_plugin_pref_new_with_name_and_label( |
| 111 | "/plugins/gtk/extplacement/placement_number_separate", | |
| 112 | _("Separate IM and Chat windows when placing by number")); | |
| 113 | gaim_plugin_pref_frame_add(frame, ppref); | |
| 114 | ||
| 9157 | 115 | return frame; |
| 116 | } | |
| 117 | ||
| 118 | static GaimPluginUiInfo prefs_info = { | |
| 119 | get_plugin_pref_frame | |
| 120 | }; | |
| 121 | ||
| 122 | static GaimPluginInfo info = | |
| 123 | { | |
| 9943 | 124 | GAIM_PLUGIN_MAGIC, |
| 125 | GAIM_MAJOR_VERSION, | |
| 126 | GAIM_MINOR_VERSION, | |
| 9157 | 127 | GAIM_PLUGIN_STANDARD, /**< type */ |
| 9179 | 128 | GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ |
| 9157 | 129 | 0, /**< flags */ |
| 130 | NULL, /**< dependencies */ | |
| 131 | GAIM_PRIORITY_DEFAULT, /**< priority */ | |
| 9179 | 132 | "gtk-extplacement", /**< id */ |
| 9157 | 133 | N_("ExtPlacement"), /**< name */ |
| 134 | VERSION, /**< version */ | |
| 9179 | 135 | N_("Extra conversation placement options."), /**< summary */ |
| 9157 | 136 | /** description */ |
| 9425 | 137 | N_("Restrict the number of conversations per windows," |
| 138 | " optionally separating IMs and Chats"), | |
| 9157 | 139 | "Stu Tomlinson <stu@nosnilmot.com>", /**< author */ |
| 9179 | 140 | GAIM_WEBSITE, /**< homepage */ |
| 9157 | 141 | plugin_load, /**< load */ |
| 142 | plugin_unload, /**< unload */ | |
| 143 | NULL, /**< destroy */ | |
| 144 | NULL, /**< ui_info */ | |
| 145 | NULL, /**< extra_info */ | |
| 146 | &prefs_info, /**< prefs_info */ | |
| 147 | NULL /**< actions */ | |
| 148 | }; | |
| 149 | ||
| 150 | static void | |
| 151 | init_plugin(GaimPlugin *plugin) | |
| 152 | { | |
| 9179 | 153 | gaim_prefs_add_none("/plugins/gtk/extplacement"); |
| 154 | gaim_prefs_add_int("/plugins/gtk/extplacement/placement_number", 4); | |
| 9425 | 155 | gaim_prefs_add_bool("/plugins/gtk/extplacement/placement_number_separate", FALSE); |
| 9157 | 156 | } |
| 157 | ||
| 158 | GAIM_INIT_PLUGIN(extplacement, init_plugin, info) |