Mercurial > pidgin
annotate src/protocols/irc/cmds.c @ 11249:b4b1be482b4e
[gaim-migrate @ 13418]
sf patch #1235519, from Sadrul Habib Chowdhury
This is a pretty big patch that makes Gaim correctly save and restore
the current status (away/available, away message, available message,
invisible, etc).
The GaimGtkStatusBoxWidget thing I think defaults to "Available"
every time its created, which overrides the setting that was saved
to the XML file. So that still needs to be fixed before this will
really work.
Anyway, mad props to Sadrul for putting up with my requests on this patch
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Sat, 13 Aug 2005 05:22:09 +0000 |
| parents | 634fec5ed0f2 |
| children | 17142948653e |
| rev | line source |
|---|---|
| 6333 | 1 /** |
| 2 * @file cmds.c | |
| 3 * | |
| 4 * gaim | |
| 5 * | |
| 6 * Copyright (C) 2003, Ethan Blanton <eblanton@cs.purdue.edu> | |
| 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 | |
| 23 #include "internal.h" | |
| 24 | |
| 25 #include "conversation.h" | |
| 8504 | 26 #include "debug.h" |
| 6333 | 27 #include "notify.h" |
| 8624 | 28 #include "util.h" |
| 8504 | 29 |
| 6333 | 30 #include "irc.h" |
| 31 | |
| 32 | |
| 33 static void irc_do_mode(struct irc_conn *irc, const char *target, const char *sign, char **ops); | |
| 34 | |
| 35 int irc_cmd_default(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 36 { | |
| 10246 | 37 GaimConversation *convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, target, irc->account); |
| 6333 | 38 char *buf; |
| 39 | |
| 40 if (!convo) | |
| 6350 | 41 return 1; |
| 6333 | 42 |
| 43 buf = g_strdup_printf(_("Unknown command: %s"), cmd); | |
| 44 if (gaim_conversation_get_type(convo) == GAIM_CONV_IM) | |
|
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
45 gaim_conv_im_write(GAIM_CONV_IM(convo), "", buf, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
| 6333 | 46 else |
|
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
47 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", buf, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
| 6333 | 48 g_free(buf); |
| 49 | |
| 50 return 1; | |
| 51 } | |
| 52 | |
| 53 int irc_cmd_away(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 54 { | |
| 55 char *buf, *message, *cur; | |
| 56 | |
| 57 if (args[0] && strcmp(cmd, "back")) { | |
| 58 message = strdup(args[0]); | |
| 59 for (cur = message; *cur; cur++) { | |
| 60 if (*cur == '\n') | |
| 61 *cur = ' '; | |
| 62 } | |
| 63 buf = irc_format(irc, "v:", "AWAY", message); | |
| 64 g_free(message); | |
| 65 } else { | |
| 66 buf = irc_format(irc, "v", "AWAY"); | |
| 67 } | |
| 68 irc_send(irc, buf); | |
| 69 g_free(buf); | |
| 70 | |
| 71 return 0; | |
| 72 } | |
| 73 | |
| 74 int irc_cmd_ctcp_action(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 75 { | |
| 76 GaimConnection *gc = gaim_account_get_connection(irc->account); | |
| 10933 | 77 char *action, *escaped, *dst, **newargs; |
| 6333 | 78 const char *src; |
| 79 GaimConversation *convo; | |
| 80 | |
| 81 if (!args || !args[0] || !gc) | |
| 82 return 0; | |
| 83 | |
| 6376 | 84 action = g_malloc(strlen(args[0]) + 10); |
| 6333 | 85 |
| 86 sprintf(action, "\001ACTION "); | |
| 87 | |
| 88 src = args[0]; | |
| 89 dst = action + 8; | |
| 90 while (*src) { | |
| 91 if (*src == '\n') { | |
| 92 if (*(src + 1) == '\0') { | |
| 93 break; | |
| 94 } else { | |
| 95 *dst++ = ' '; | |
| 96 src++; | |
| 97 continue; | |
| 98 } | |
| 99 } | |
| 100 *dst++ = *src++; | |
| 101 } | |
| 102 *dst++ = '\001'; | |
| 103 *dst = '\0'; | |
| 104 | |
| 105 newargs = g_new0(char *, 2); | |
| 106 newargs[0] = g_strdup(target); | |
| 107 newargs[1] = action; | |
| 108 irc_cmd_privmsg(irc, cmd, target, (const char **)newargs); | |
| 109 g_free(newargs[0]); | |
| 110 g_free(newargs[1]); | |
| 111 g_free(newargs); | |
| 112 | |
| 10246 | 113 convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, target, irc->account); |
| 9130 | 114 if (convo) { |
| 10933 | 115 escaped = g_markup_escape_text(args[0], -1); |
| 116 action = g_strdup_printf("/me %s", escaped); | |
| 117 g_free(escaped); | |
| 6333 | 118 if (action[strlen(action) - 1] == '\n') |
| 119 action[strlen(action) - 1] = '\0'; | |
| 9130 | 120 if (gaim_conversation_get_type(convo) == GAIM_CONV_CHAT) |
| 121 serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)), | |
| 122 gaim_connection_get_display_name(gc), | |
| 123 0, action, time(NULL)); | |
| 124 else | |
| 125 gaim_conv_im_write(GAIM_CONV_IM(convo), gaim_connection_get_display_name(gc), | |
| 126 action, 0, time(NULL)); | |
| 6333 | 127 g_free(action); |
| 128 } | |
| 129 | |
| 130 return 1; | |
| 131 } | |
| 132 | |
| 133 int irc_cmd_invite(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 134 { | |
| 135 char *buf; | |
| 136 | |
| 137 if (!args || !args[0] || !(args[1] || target)) | |
| 138 return 0; | |
| 139 | |
| 140 buf = irc_format(irc, "vnc", "INVITE", args[0], args[1] ? args[1] : target); | |
| 141 irc_send(irc, buf); | |
| 142 g_free(buf); | |
| 143 | |
| 144 return 0; | |
| 145 } | |
| 146 | |
| 147 int irc_cmd_join(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 148 { | |
| 149 char *buf; | |
| 150 | |
| 151 if (!args || !args[0]) | |
| 152 return 0; | |
| 153 | |
| 154 if (args[1]) | |
| 155 buf = irc_format(irc, "vcv", "JOIN", args[0], args[1]); | |
| 156 else | |
| 157 buf = irc_format(irc, "vc", "JOIN", args[0]); | |
| 158 irc_send(irc, buf); | |
| 159 g_free(buf); | |
| 160 | |
| 161 return 0; | |
| 162 } | |
| 163 | |
| 164 int irc_cmd_kick(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 165 { | |
| 166 char *buf; | |
| 167 GaimConversation *convo; | |
| 168 | |
| 169 if (!args || !args[0]) | |
| 170 return 0; | |
| 171 | |
| 10246 | 172 convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, target, irc->account); |
| 173 if (!convo) | |
| 6350 | 174 return 0; |
| 6333 | 175 |
| 176 if (args[1]) | |
| 177 buf = irc_format(irc, "vcn:", "KICK", target, args[0], args[1]); | |
| 178 else | |
| 179 buf = irc_format(irc, "vcn", "KICK", target, args[0]); | |
| 180 irc_send(irc, buf); | |
| 181 g_free(buf); | |
| 182 | |
| 183 return 0; | |
| 184 } | |
| 185 | |
| 8114 | 186 int irc_cmd_list(struct irc_conn *irc, const char *cmd, const char *target, const char **args) |
| 187 { | |
| 8352 | 188 gaim_roomlist_show_with_account(irc->account); |
| 8114 | 189 |
| 190 return 0; | |
| 191 } | |
| 192 | |
| 6333 | 193 int irc_cmd_mode(struct irc_conn *irc, const char *cmd, const char *target, const char **args) |
| 194 { | |
| 195 GaimConnection *gc; | |
| 196 char *buf; | |
| 197 | |
| 198 if (!args) | |
| 199 return 0; | |
| 200 | |
| 201 if (!strcmp(cmd, "mode")) { | |
| 10208 | 202 if (!args[0] && irc_ischannel(target)) |
| 6333 | 203 buf = irc_format(irc, "vc", "MODE", target); |
| 204 else if (args[0] && (*args[0] == '+' || *args[0] == '-')) | |
| 205 buf = irc_format(irc, "vcv", "MODE", target, args[0]); | |
| 206 else if (args[0]) | |
| 207 buf = irc_format(irc, "vv", "MODE", args[0]); | |
| 208 else | |
| 6350 | 209 return 0; |
| 6333 | 210 } else if (!strcmp(cmd, "umode")) { |
| 211 if (!args[0]) | |
| 6350 | 212 return 0; |
| 6333 | 213 gc = gaim_account_get_connection(irc->account); |
| 214 buf = irc_format(irc, "vnv", "MODE", gaim_connection_get_display_name(gc), args[0]); | |
| 6365 | 215 } else { |
| 216 return 0; | |
| 6333 | 217 } |
| 6365 | 218 |
| 6333 | 219 irc_send(irc, buf); |
| 220 g_free(buf); | |
| 221 | |
| 222 return 0; | |
| 223 } | |
| 224 | |
| 225 int irc_cmd_names(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 226 { | |
| 227 char *buf; | |
| 228 | |
| 10208 | 229 if (!args || (!args[0] && !irc_ischannel(target))) |
| 6333 | 230 return 0; |
| 231 | |
| 232 buf = irc_format(irc, "vc", "NAMES", args[0] ? args[0] : target); | |
| 233 irc_send(irc, buf); | |
| 234 g_free(buf); | |
| 235 | |
| 236 irc->nameconv = g_strdup(target); | |
| 237 | |
| 238 return 0; | |
| 239 } | |
| 240 | |
| 241 int irc_cmd_nick(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 242 { | |
| 243 char *buf; | |
| 244 | |
| 245 if (!args || !args[0]) | |
| 246 return 0; | |
| 247 | |
| 248 buf = irc_format(irc, "v:", "NICK", args[0]); | |
| 249 irc_send(irc, buf); | |
| 250 g_free(buf); | |
| 251 | |
| 252 return 0; | |
| 253 } | |
| 254 | |
| 255 int irc_cmd_op(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 256 { | |
| 257 char **nicks, **ops, *sign, *mode; | |
| 258 int i = 0, used = 0; | |
| 259 | |
| 260 if (!args || !args[0] || !*args[0]) | |
| 261 return 0; | |
| 262 | |
| 263 if (!strcmp(cmd, "op")) { | |
| 264 sign = "+"; | |
| 265 mode = "o"; | |
| 266 } else if (!strcmp(cmd, "deop")) { | |
| 267 sign = "-"; | |
| 268 mode = "o"; | |
| 269 } else if (!strcmp(cmd, "voice")) { | |
| 270 sign = "+"; | |
| 271 mode = "v"; | |
| 272 } else if (!strcmp(cmd, "devoice")) { | |
| 273 sign = "-"; | |
| 274 mode = "v"; | |
| 275 } else { | |
| 276 gaim_debug(GAIM_DEBUG_ERROR, "irc", "invalid 'op' command '%s'\n", cmd); | |
| 277 return 0; | |
| 278 } | |
| 279 | |
| 280 nicks = g_strsplit(args[0], " ", -1); | |
| 281 | |
| 282 for (i = 0; nicks[i]; i++) | |
| 283 /* nothing */; | |
| 284 ops = g_new0(char *, i * 2 + 1); | |
| 285 | |
| 286 for (i = 0; nicks[i]; i++) { | |
| 287 if (!*nicks[i]) | |
| 288 continue; | |
| 289 ops[used++] = mode; | |
| 290 ops[used++] = nicks[i]; | |
| 291 } | |
| 292 | |
| 293 irc_do_mode(irc, target, sign, ops); | |
| 294 g_free(ops); | |
| 295 | |
| 6350 | 296 return 0; |
| 6333 | 297 } |
| 298 | |
| 299 int irc_cmd_part(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 300 { | |
| 301 char *buf; | |
| 302 | |
| 303 if (!args) | |
| 304 return 0; | |
| 305 | |
| 306 if (args[1]) | |
| 307 buf = irc_format(irc, "vc:", "PART", args[0] ? args[0] : target, args[1]); | |
| 308 else | |
| 309 buf = irc_format(irc, "vc", "PART", args[0] ? args[0] : target); | |
| 310 irc_send(irc, buf); | |
| 311 g_free(buf); | |
| 312 | |
| 313 return 0; | |
| 314 } | |
| 315 | |
| 316 int irc_cmd_ping(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 317 { | |
| 318 char *stamp; | |
| 319 char *buf; | |
| 320 | |
| 321 if (args && args[0]) { | |
| 10208 | 322 if (irc_ischannel(args[0])) |
| 6333 | 323 return 0; |
| 324 stamp = g_strdup_printf("\001PING %lu\001", time(NULL)); | |
| 325 buf = irc_format(irc, "vn:", "PRIVMSG", args[0], stamp); | |
| 326 g_free(stamp); | |
| 327 } else { | |
| 6350 | 328 stamp = g_strdup_printf("%s %lu", target, time(NULL)); |
| 6333 | 329 buf = irc_format(irc, "v:", "PING", stamp); |
| 330 g_free(stamp); | |
| 331 } | |
| 332 irc_send(irc, buf); | |
| 333 g_free(buf); | |
| 334 | |
| 335 return 0; | |
| 336 } | |
| 337 | |
| 338 int irc_cmd_privmsg(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 339 { | |
| 340 const char *cur, *end; | |
| 341 char *msg, *buf; | |
| 342 | |
| 343 if (!args || !args[0] || !args[1]) | |
| 344 return 0; | |
| 345 | |
| 346 cur = args[1]; | |
| 347 end = args[1]; | |
| 348 while (*end && *cur) { | |
| 349 end = strchr(cur, '\n'); | |
| 350 if (!end) | |
| 351 end = cur + strlen(cur); | |
| 352 msg = g_strndup(cur, end - cur); | |
| 353 buf = irc_format(irc, "vt:", "PRIVMSG", args[0], msg); | |
| 354 irc_send(irc, buf); | |
| 355 g_free(msg); | |
| 356 g_free(buf); | |
| 357 cur = end + 1; | |
| 358 } | |
| 359 | |
| 360 return 0; | |
| 361 } | |
| 362 | |
| 363 int irc_cmd_quit(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 364 { | |
| 365 char *buf; | |
| 366 | |
| 9440 | 367 if (!irc->quitting) { |
| 11073 | 368 buf = irc_format(irc, "v:", "QUIT", (args && args[0]) ? args[0] : gaim_prefs_get_string("/plugins/prpl/irc/quitmsg")); |
| 9440 | 369 irc_send(irc, buf); |
| 370 g_free(buf); | |
| 371 | |
| 372 irc->quitting = TRUE; | |
| 373 } | |
| 6333 | 374 |
| 375 return 0; | |
| 376 } | |
| 377 | |
| 378 int irc_cmd_quote(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 379 { | |
| 380 char *buf; | |
| 381 | |
| 382 if (!args || !args[0]) | |
| 383 return 0; | |
| 384 | |
| 385 buf = irc_format(irc, "v", args[0]); | |
| 386 irc_send(irc, buf); | |
| 387 g_free(buf); | |
| 388 | |
| 389 return 0; | |
| 390 } | |
| 391 | |
| 392 int irc_cmd_query(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 393 { | |
| 394 GaimConversation *convo; | |
| 395 GaimConnection *gc; | |
| 396 | |
| 397 if (!args || !args[0]) | |
| 398 return 0; | |
| 399 | |
| 400 convo = gaim_conversation_new(GAIM_CONV_IM, irc->account, args[0]); | |
| 401 | |
| 402 if (args[1]) { | |
| 403 gc = gaim_account_get_connection(irc->account); | |
| 404 irc_cmd_privmsg(irc, cmd, target, args); | |
|
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
405 gaim_conv_im_write(GAIM_CONV_IM(convo), gaim_connection_get_display_name(gc), |
| 6982 | 406 args[1], GAIM_MESSAGE_SEND, time(NULL)); |
| 6333 | 407 } |
| 408 | |
| 409 return 0; | |
| 410 } | |
| 411 | |
| 412 int irc_cmd_remove(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 413 { | |
| 414 char *buf; | |
| 415 | |
| 416 if (!args || !args[0]) | |
| 417 return 0; | |
| 418 | |
| 10208 | 419 if (!irc_ischannel(target)) /* not a channel, punt */ |
| 6333 | 420 return 0; |
| 421 | |
| 422 if (args[1]) | |
| 423 buf = irc_format(irc, "vcn:", "REMOVE", target, args[0], args[1]); | |
| 424 else | |
| 425 buf = irc_format(irc, "vcn", "REMOVE", target, args[0]); | |
| 426 irc_send(irc, buf); | |
| 427 g_free(buf); | |
| 428 | |
| 429 return 0; | |
| 430 } | |
| 431 | |
| 10564 | 432 int irc_cmd_time(struct irc_conn *irc, const char *cmd, const char *target, const char **args) |
| 433 { | |
| 434 char *buf; | |
| 435 | |
| 436 buf = irc_format(irc, "v", "TIME"); | |
| 437 irc_send(irc, buf); | |
| 438 g_free(buf); | |
| 439 | |
| 440 return 0; | |
| 441 } | |
| 442 | |
| 6333 | 443 int irc_cmd_topic(struct irc_conn *irc, const char *cmd, const char *target, const char **args) |
| 444 { | |
| 445 char *buf; | |
| 446 const char *topic; | |
| 447 GaimConversation *convo; | |
| 448 | |
| 449 if (!args) | |
| 450 return 0; | |
| 451 | |
| 10246 | 452 convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, target, irc->account); |
| 453 if (!convo) | |
| 6350 | 454 return 0; |
| 6333 | 455 |
| 456 if (!args[0]) { | |
|
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
457 topic = gaim_conv_chat_get_topic (GAIM_CONV_CHAT(convo)); |
| 6333 | 458 |
| 8504 | 459 if (topic) { |
| 9762 | 460 char *tmp, *tmp2; |
|
10732
c4cb90065e1d
[gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents:
10609
diff
changeset
|
461 tmp = g_markup_escape_text(topic, -1); |
| 9762 | 462 tmp2 = gaim_markup_linkify(tmp); |
| 463 buf = g_strdup_printf(_("current topic is: %s"), tmp2); | |
| 8504 | 464 g_free(tmp); |
| 9762 | 465 g_free(tmp2); |
| 8504 | 466 } else |
| 6333 | 467 buf = g_strdup(_("No topic is set")); |
|
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
468 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), target, buf, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
| 6333 | 469 g_free(buf); |
| 470 | |
| 471 return 0; | |
| 472 } | |
| 473 | |
| 474 buf = irc_format(irc, "vt:", "TOPIC", target, args[0]); | |
| 475 irc_send(irc, buf); | |
| 476 g_free(buf); | |
| 477 | |
| 478 return 0; | |
| 479 } | |
| 480 | |
| 481 int irc_cmd_wallops(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 482 { | |
| 483 char *buf; | |
| 484 | |
| 485 if (!args || !args[0]) | |
| 6350 | 486 return 0; |
| 6333 | 487 |
| 488 if (!strcmp(cmd, "wallops")) | |
| 489 buf = irc_format(irc, "v:", "WALLOPS", args[0]); | |
| 490 else if (!strcmp(cmd, "operwall")) | |
| 491 buf = irc_format(irc, "v:", "OPERWALL", args[0]); | |
| 6365 | 492 else |
| 493 return 0; | |
| 6333 | 494 |
| 495 irc_send(irc, buf); | |
| 496 g_free(buf); | |
| 497 | |
| 498 return 0; | |
| 499 } | |
| 500 | |
| 501 int irc_cmd_whois(struct irc_conn *irc, const char *cmd, const char *target, const char **args) | |
| 502 { | |
| 503 char *buf; | |
| 504 | |
| 505 if (!args || !args[0]) | |
| 506 return 0; | |
| 507 | |
| 10609 | 508 if (args[1]) { |
| 509 buf = irc_format(irc, "vvn", "WHOIS", args[0], args[1]); | |
| 510 irc->whois.nick = g_strdup(args[1]); | |
| 511 } else { | |
| 512 buf = irc_format(irc, "vn", "WHOIS", args[0]); | |
| 513 irc->whois.nick = g_strdup(args[0]); | |
| 514 } | |
| 515 | |
| 6333 | 516 irc_send(irc, buf); |
| 517 g_free(buf); | |
| 518 | |
| 519 return 0; | |
| 520 } | |
| 521 | |
| 522 static void irc_do_mode(struct irc_conn *irc, const char *target, const char *sign, char **ops) | |
| 523 { | |
| 524 char *buf, mode[5]; | |
| 525 int i = 0; | |
| 526 | |
| 527 if (!sign) | |
| 528 return; | |
| 529 | |
| 530 while (ops[i]) { | |
| 531 if (ops[i + 2] && ops[i + 4]) { | |
| 532 g_snprintf(mode, sizeof(mode), "%s%s%s%s", sign, | |
| 533 ops[i], ops[i + 2], ops[i + 4]); | |
| 534 buf = irc_format(irc, "vcvnnn", "MODE", target, mode, | |
| 535 ops[i + 1], ops[i + 3], ops[i + 5]); | |
| 536 i += 6; | |
| 537 } else if (ops[i + 2]) { | |
| 538 g_snprintf(mode, sizeof(mode), "%s%s%s", | |
| 539 sign, ops[i], ops[i + 2]); | |
| 540 buf = irc_format(irc, "vcvnn", "MODE", target, mode, | |
| 541 ops[i + 1], ops[i + 3]); | |
| 542 i += 4; | |
| 543 } else { | |
| 544 g_snprintf(mode, sizeof(mode), "%s%s", sign, ops[i]); | |
| 545 buf = irc_format(irc, "vcvn", "MODE", target, mode, ops[i + 1]); | |
| 546 i += 2; | |
| 547 } | |
| 548 irc_send(irc, buf); | |
| 549 g_free(buf); | |
| 550 } | |
| 6350 | 551 |
| 552 return; | |
| 6333 | 553 } |
