Wed, 16 Nov 2005 06:07:42 +0000
[gaim-migrate @ 14411]
sf patch #1357831, from Sadrul Habib Chowdhury
Looks like this was my bug (me being KingAnt). Sorry!
The description from Sadrul:
This is a simple fix for the following "ShowStopperBug"
(from the kwiki):
==========
buddy shows as online when offline
* I(luke) played with this some today. when my
lschiere SILC account signs on, lschiere(aim) appears
on my LSchiere2 buddy list as though signing on. As far
as the gaim UI is concerned, there is no SILC buddy in
that contact. as LSchiere (aim) is my account, I am
quite sure that it is not online, plus attempting to IM
it yeilds the same result.
==========
committer: Mark Doliner <markdoliner@pidgin.im>
| 8713 | 1 | /** |
| 2 | * 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 modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (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 | #ifdef HAVE_CONFIG_H | |
| 23 | # include <config.h> | |
| 24 | #endif | |
| 25 | ||
| 26 | #include <glib.h> | |
| 27 | ||
| 28 | #include "debug.h" | |
| 29 | #include "internal.h" | |
| 30 | #include "pluginpref.h" | |
| 31 | #include "prefs.h" | |
| 32 | ||
| 33 | struct _GaimPluginPrefFrame { | |
| 34 | GList *prefs; | |
| 35 | }; | |
| 36 | ||
| 37 | struct _GaimPluginPref { | |
| 38 | char *name; | |
| 39 | char *label; | |
| 40 | ||
| 41 | GaimPluginPrefType type; | |
| 42 | ||
| 43 | int min; | |
| 44 | int max; | |
| 45 | GList *choices; | |
| 46 | unsigned int max_length; | |
| 9841 | 47 | gboolean masked; |
| 8713 | 48 | }; |
| 49 | ||
| 50 | GaimPluginPrefFrame * | |
| 51 | gaim_plugin_pref_frame_new() { | |
| 52 | GaimPluginPrefFrame *frame; | |
| 53 | ||
| 54 | frame = g_new0(GaimPluginPrefFrame, 1); | |
| 55 | ||
| 56 | return frame; | |
| 57 | } | |
| 58 | ||
| 59 | void | |
| 60 | gaim_plugin_pref_frame_destroy(GaimPluginPrefFrame *frame) { | |
| 61 | GaimPluginPref *pref; | |
| 8745 | 62 | GList *l; |
| 8713 | 63 | |
| 64 | g_return_if_fail(frame); | |
| 65 | ||
| 8745 | 66 | for(l = frame->prefs; l != NULL; l = l->next) { |
| 8713 | 67 | pref = (GaimPluginPref *)l->data; |
| 68 | gaim_plugin_pref_destroy(pref); | |
| 69 | } | |
| 70 | ||
| 8745 | 71 | g_list_free(frame->prefs); |
| 72 | frame->prefs = NULL; | |
| 73 | ||
| 74 | g_free(frame); | |
| 8713 | 75 | frame = NULL; |
| 76 | } | |
| 77 | ||
| 78 | void | |
| 79 | gaim_plugin_pref_frame_add(GaimPluginPrefFrame *frame, GaimPluginPref *pref) { | |
| 80 | g_return_if_fail(frame); | |
| 81 | g_return_if_fail(pref); | |
| 82 | ||
| 8745 | 83 | frame->prefs = g_list_append(frame->prefs, pref); |
| 8713 | 84 | } |
| 85 | ||
| 86 | GList * | |
| 87 | gaim_plugin_pref_frame_get_prefs(GaimPluginPrefFrame *frame) { | |
| 8745 | 88 | g_return_val_if_fail(frame, NULL); |
| 89 | g_return_val_if_fail(frame->prefs, NULL); | |
| 90 | ||
| 8713 | 91 | return frame->prefs; |
| 92 | } | |
| 93 | ||
| 94 | GaimPluginPref * | |
| 95 | gaim_plugin_pref_new() { | |
| 96 | GaimPluginPref *pref; | |
| 97 | ||
| 98 | pref = g_new0(GaimPluginPref, 1); | |
| 99 | ||
| 100 | return pref; | |
| 101 | } | |
| 102 | ||
| 103 | GaimPluginPref * | |
| 104 | gaim_plugin_pref_new_with_name(char *name) { | |
| 105 | GaimPluginPref *pref; | |
| 106 | ||
| 107 | g_return_val_if_fail(name, NULL); | |
| 108 | ||
| 109 | pref = g_new0(GaimPluginPref, 1); | |
| 110 | pref->name = g_strdup(name); | |
| 111 | ||
| 112 | return pref; | |
| 113 | } | |
| 114 | ||
| 115 | GaimPluginPref * | |
| 116 | gaim_plugin_pref_new_with_label(char *label) { | |
| 117 | GaimPluginPref *pref; | |
| 118 | ||
| 119 | g_return_val_if_fail(label, NULL); | |
| 120 | ||
| 121 | pref = g_new0(GaimPluginPref, 1); | |
| 122 | pref->label = g_strdup(label); | |
| 123 | ||
| 124 | return pref; | |
| 125 | } | |
| 126 | ||
| 127 | GaimPluginPref * | |
| 128 | gaim_plugin_pref_new_with_name_and_label(char *name, char *label) { | |
| 129 | GaimPluginPref *pref; | |
| 130 | ||
| 131 | g_return_val_if_fail(name, NULL); | |
| 132 | g_return_val_if_fail(label, NULL); | |
| 133 | ||
| 134 | pref = g_new0(GaimPluginPref, 1); | |
| 135 | pref->name = g_strdup(name); | |
| 136 | pref->label = g_strdup(label); | |
| 137 | ||
| 138 | return pref; | |
| 139 | } | |
| 140 | ||
| 141 | void | |
| 142 | gaim_plugin_pref_destroy(GaimPluginPref *pref) { | |
| 143 | g_return_if_fail(pref); | |
| 144 | ||
| 8745 | 145 | if(pref->name) { |
| 8713 | 146 | g_free(pref->name); |
| 8745 | 147 | pref->name = NULL; |
| 148 | } | |
| 8713 | 149 | |
| 8745 | 150 | if(pref->label) { |
| 151 | g_free(pref->label); | |
| 152 | pref->label = NULL; | |
| 153 | } | |
| 8713 | 154 | |
| 8745 | 155 | if(pref->choices) { |
| 156 | g_list_free(pref->choices); | |
| 157 | pref->choices = NULL; | |
| 8713 | 158 | } |
| 159 | ||
| 160 | g_free(pref); | |
| 161 | } | |
| 162 | ||
| 163 | void | |
| 164 | gaim_plugin_pref_set_name(GaimPluginPref *pref, char *name) { | |
| 165 | g_return_if_fail(pref); | |
| 166 | g_return_if_fail(name); | |
| 167 | ||
| 168 | if(pref->name) | |
| 169 | g_free(pref->name); | |
| 170 | ||
| 171 | pref->name = g_strdup(name); | |
| 172 | } | |
| 173 | ||
| 174 | char * | |
| 175 | gaim_plugin_pref_get_name(GaimPluginPref *pref) { | |
| 176 | g_return_val_if_fail(pref, NULL); | |
| 177 | ||
| 178 | return pref->name; | |
| 179 | } | |
| 180 | ||
| 181 | void | |
| 182 | gaim_plugin_pref_set_label(GaimPluginPref *pref, char *label) { | |
| 183 | g_return_if_fail(pref); | |
| 184 | g_return_if_fail(label); | |
| 185 | ||
| 186 | if(pref->label) | |
| 187 | g_free(pref->label); | |
| 188 | ||
| 189 | pref->label = g_strdup(label); | |
| 190 | } | |
| 191 | ||
| 192 | char * | |
| 193 | gaim_plugin_pref_get_label(GaimPluginPref *pref) { | |
| 194 | g_return_val_if_fail(pref, NULL); | |
| 195 | ||
| 196 | return pref->label; | |
| 197 | } | |
| 198 | ||
| 199 | void | |
| 200 | gaim_plugin_pref_set_bounds(GaimPluginPref *pref, int min, int max) { | |
| 201 | int tmp; | |
| 202 | ||
| 203 | g_return_if_fail(pref); | |
| 204 | g_return_if_fail(pref->name); | |
| 205 | ||
| 206 | if(gaim_prefs_get_type(pref->name) != GAIM_PREF_INT) { | |
| 207 | gaim_debug(GAIM_DEBUG_INFO, "pluginpref", | |
| 208 | "gaim_plugin_pref_set_bounds: %s is not an integer pref\n", | |
| 209 | pref->name); | |
| 210 | return; | |
| 211 | } | |
|
10414
6b10b76933e1
[gaim-migrate @ 11664]
Mark Doliner <markdoliner@pidgin.im>
parents:
9841
diff
changeset
|
212 | |
| 8713 | 213 | if(min > max) { |
| 214 | tmp = min; | |
| 215 | min = max; | |
| 216 | max = tmp; | |
| 217 | } | |
| 218 | ||
| 219 | pref->min = min; | |
| 220 | pref->max = max; | |
| 221 | } | |
| 222 | ||
| 223 | void gaim_plugin_pref_get_bounds(GaimPluginPref *pref, int *min, int *max) { | |
| 224 | g_return_if_fail(pref); | |
| 225 | g_return_if_fail(pref->name); | |
| 226 | ||
| 227 | if(gaim_prefs_get_type(pref->name) != GAIM_PREF_INT) { | |
| 228 | gaim_debug(GAIM_DEBUG_INFO, "pluginpref", | |
| 229 | "gaim_plugin_pref_get_bounds: %s is not an integer pref\n", | |
| 230 | pref->name); | |
| 231 | return; | |
| 232 | } | |
| 233 | ||
| 234 | *min = pref->min; | |
| 235 | *max = pref->max; | |
| 236 | } | |
| 237 | ||
| 238 | void | |
| 239 | gaim_plugin_pref_set_type(GaimPluginPref *pref, GaimPluginPrefType type) { | |
| 240 | g_return_if_fail(pref); | |
| 241 | ||
| 242 | pref->type = type; | |
| 243 | } | |
| 244 | ||
| 245 | GaimPluginPrefType | |
| 246 | gaim_plugin_pref_get_type(GaimPluginPref *pref) { | |
| 247 | g_return_val_if_fail(pref, GAIM_PLUGIN_PREF_NONE); | |
| 248 | ||
| 249 | return pref->type; | |
| 250 | } | |
| 251 | ||
| 252 | void | |
| 253 | gaim_plugin_pref_add_choice(GaimPluginPref *pref, char *label, gpointer choice) { | |
| 254 | g_return_if_fail(pref); | |
| 255 | g_return_if_fail(label); | |
| 256 | g_return_if_fail(choice); | |
| 257 | ||
| 258 | pref->choices = g_list_append(pref->choices, label); | |
| 259 | pref->choices = g_list_append(pref->choices, choice); | |
| 260 | } | |
| 261 | ||
| 262 | GList * | |
| 263 | gaim_plugin_pref_get_choices(GaimPluginPref *pref) { | |
| 264 | g_return_val_if_fail(pref, NULL); | |
| 265 | ||
| 266 | return pref->choices; | |
| 267 | } | |
| 268 | ||
| 269 | void | |
| 270 | gaim_plugin_pref_set_max_length(GaimPluginPref *pref, unsigned int max_length) { | |
| 271 | g_return_if_fail(pref); | |
| 272 | ||
| 273 | pref->max_length = max_length; | |
| 274 | } | |
| 275 | ||
| 276 | unsigned int | |
| 277 | gaim_plugin_pref_get_max_length(GaimPluginPref *pref) { | |
| 278 | g_return_val_if_fail(pref, 0); | |
| 279 | ||
| 280 | return pref->max_length; | |
| 281 | } | |
| 9841 | 282 | |
| 283 | void | |
| 284 | gaim_plugin_pref_set_masked(GaimPluginPref *pref, gboolean masked) { | |
| 285 | g_return_if_fail(pref); | |
| 286 | ||
| 287 | pref->masked = masked; | |
| 288 | } | |
| 289 | ||
| 290 | gboolean | |
| 291 | gaim_plugin_pref_get_masked(GaimPluginPref *pref) { | |
| 292 | g_return_val_if_fail(pref, FALSE); | |
| 293 | ||
| 294 | return pref->masked; | |
| 295 | } |