From 76484665fd0df4e559f7a6732819130dc98b68a7 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 5 Jan 2014 23:24:48 +0000 Subject: Removed prof_handle group functions --- src/command/commands.c | 18 ++++++++++++++---- src/profanity.c | 16 ---------------- src/profanity.h | 2 -- src/roster_list.c | 30 ------------------------------ src/roster_list.h | 2 -- 5 files changed, 14 insertions(+), 54 deletions(-) (limited to 'src') diff --git a/src/command/commands.c b/src/command/commands.c index 57a6b151..e6588c11 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -1009,8 +1009,13 @@ cmd_group(gchar **args, struct cmd_help_t help) return TRUE; } - roster_add_to_group(group, pcontact); - roster_send_add_to_group(group, pcontact); + if (p_contact_in_group(pcontact, group)) { + const char *display_name = p_contact_name_or_jid(pcontact); + ui_contact_already_in_group(display_name, group); + ui_current_page_off(); + } else { + roster_send_add_to_group(group, pcontact); + } return TRUE; } @@ -1036,8 +1041,13 @@ cmd_group(gchar **args, struct cmd_help_t help) return TRUE; } - roster_remove_from_group(group, pcontact); - roster_send_remove_from_group(group, pcontact); + if (!p_contact_in_group(pcontact, group)) { + const char *display_name = p_contact_name_or_jid(pcontact); + ui_contact_not_in_group(display_name, group); + ui_current_page_off(); + } else { + roster_send_remove_from_group(group, pcontact); + } return TRUE; } diff --git a/src/profanity.c b/src/profanity.c index 3ee032fd..9178d056 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -117,22 +117,6 @@ prof_run(const int disable_tls, char *log_level, char *account_name) g_timer_destroy(timer); } -void -prof_handle_already_in_group(const char * const contact, - const char * const group) -{ - ui_contact_already_in_group(contact, group); - ui_current_page_off(); -} - -void -prof_handle_not_in_group(const char * const contact, - const char * const group) -{ - ui_contact_not_in_group(contact, group); - ui_current_page_off(); -} - void prof_handle_roster_add(const char * const barejid, const char * const name) { diff --git a/src/profanity.h b/src/profanity.h index a448c436..5e826fc4 100644 --- a/src/profanity.h +++ b/src/profanity.h @@ -31,7 +31,5 @@ void prof_run(const int disable_tls, char *log_level, char *account_name); void prof_handle_idle(void); void prof_handle_activity(void); void prof_handle_roster_add(const char * const barejid, const char * const name); -void prof_handle_already_in_group(const char * const contact, const char * const group); -void prof_handle_not_in_group(const char * const contact, const char * const group); #endif diff --git a/src/roster_list.c b/src/roster_list.c index 62d99323..7945101a 100644 --- a/src/roster_list.c +++ b/src/roster_list.c @@ -334,36 +334,6 @@ roster_get_group(const char * const group) return result; } -void -roster_add_to_group(const char * const group, PContact contact) -{ - assert(contact != NULL); - - if (p_contact_in_group(contact, group)) { - if (p_contact_name(contact) != NULL) { - prof_handle_already_in_group(p_contact_name(contact), group); - } else { - prof_handle_already_in_group(p_contact_barejid(contact), group); - } - return; - } -} - -void -roster_remove_from_group(const char * const group, PContact contact) -{ - assert(contact != NULL); - - if (!p_contact_in_group(contact, group)) { - if (p_contact_name(contact) != NULL) { - prof_handle_not_in_group(p_contact_name(contact), group); - } else { - prof_handle_not_in_group(p_contact_barejid(contact), group); - } - return; - } -} - GSList * roster_get_groups(void) { diff --git a/src/roster_list.h b/src/roster_list.h index 8fe2b5bd..a7198e5c 100644 --- a/src/roster_list.h +++ b/src/roster_list.h @@ -50,8 +50,6 @@ char * roster_find_contact(char *search_str); char * roster_find_resource(char *search_str); GSList * roster_get_group(const char * const group); GSList * roster_get_groups(void); -void roster_add_to_group(const char * const group, PContact contact); -void roster_remove_from_group(const char * const group, PContact contact); char * roster_find_group(char *search_str); char * roster_find_jid(char *search_str); -- cgit 1.4.1-2-gfad0 id='n50' href='#n50'>50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402