Changeset 81186cab
- Timestamp:
- 2010-04-13T11:38:41Z (15 years ago)
- Branches:
- master
- Children:
- 21c87a7
- Parents:
- 573dab0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
irc_commands.c
r573dab0 r81186cab 352 352 353 353 #if 0 354 //#if 0355 354 static void irc_cmd_oper( irc_t *irc, char **cmd ) 356 355 { … … 524 523 } 525 524 } 525 #endif 526 526 527 527 static void irc_cmd_away( irc_t *irc, char **cmd ) 528 528 { 529 user_t *u = user_find( irc, irc->nick ); 530 char *away = cmd[1]; 531 532 if( !u ) return; 533 534 if( away && *away ) 535 { 529 char *set; 530 531 if( cmd[1] && *cmd[1] ) 532 { 533 char away[strlen(cmd[1])+1]; 536 534 int i, j; 537 535 538 536 /* Copy away string, but skip control chars. Mainly because 539 537 Jabber really doesn't like them. */ 540 u->away = g_malloc( strlen( away ) + 1 ); 541 for( i = j = 0; away[i]; i ++ ) 542 if( ( u->away[j] = away[i] ) >= ' ' ) 538 for( i = j = 0; cmd[1][i]; i ++ ) 539 if( ( away[j] = cmd[1][i] ) >= ' ' ) 543 540 j ++; 544 u->away[j] = 0; 545 546 irc_send_num( irc, 306, ":You're now away: %s", u->away ); 547 /* irc_umode_set( irc, irc->myhost, "+a" ); */ 548 } 549 else 550 { 551 if( u->away ) g_free( u->away ); 552 u->away = NULL; 553 /* irc_umode_set( irc, irc->myhost, "-a" ); */ 541 away[j] = '\0'; 542 543 irc_send_num( irc, 306, ":You're now away: %s", away ); 544 set = away; 545 } 546 else 547 { 554 548 irc_send_num( irc, 305, ":Welcome back" ); 555 } 556 557 set_setstr( &irc->set, "away", u->away ); 558 } 559 549 set = NULL; 550 } 551 552 set_setstr( &irc->b->set, "away", set ); 553 } 554 555 #if 0 560 556 static void irc_cmd_version( irc_t *irc, char **cmd ) 561 557 { … … 613 609 { "nickserv", 1, irc_cmd_nickserv, IRC_CMD_LOGGED_IN }, 614 610 { "ns", 1, irc_cmd_nickserv, IRC_CMD_LOGGED_IN }, 611 { "away", 0, irc_cmd_away, IRC_CMD_LOGGED_IN }, 615 612 #if 0 616 613 { "oper", 2, irc_cmd_oper, IRC_CMD_LOGGED_IN }, … … 621 618 { "watch", 1, irc_cmd_watch, IRC_CMD_LOGGED_IN }, 622 619 { "topic", 1, irc_cmd_topic, IRC_CMD_LOGGED_IN }, 623 { "away", 0, irc_cmd_away, IRC_CMD_LOGGED_IN },624 620 { "version", 0, irc_cmd_version, IRC_CMD_LOGGED_IN }, 625 621 { "completions", 0, irc_cmd_completions, IRC_CMD_LOGGED_IN }, -
protocols/bee.c
r573dab0 r81186cab 1 /********************************************************************\ 2 * BitlBee -- An IRC to other IM-networks gateway * 3 * * 4 * Copyright 2002-2010 Wilmer van der Gaast and others * 5 \********************************************************************/ 6 7 /* Some IM-core stuff */ 8 9 /* 10 This program is free software; you can redistribute it and/or modify 11 it under the terms of the GNU General Public License as published by 12 the Free Software Foundation; either version 2 of the License, or 13 (at your option) any later version. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 GNU General Public License for more details. 19 20 You should have received a copy of the GNU General Public License with 21 the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL; 22 if not, write to the Free Software Foundation, Inc., 59 Temple Place, 23 Suite 330, Boston, MA 02111-1307 USA 24 */ 25 26 #define BITLBEE_CORE 1 27 #include "bitlbee.h" 28 29 static char *set_eval_away_status( set_t *set, char *value ); 2 30 3 31 bee_t *bee_new() … … 6 34 set_t *s; 7 35 8 s = set_add( &b->set, "away", NULL, NULL/*set_eval_away_status*/, b );36 s = set_add( &b->set, "away", NULL, set_eval_away_status, b ); 9 37 s->flags |= SET_NULL_OK; 10 38 s = set_add( &b->set, "auto_connect", "true", set_eval_bool, b ); … … 15 43 s->flags |= SET_NULL_OK; 16 44 s = set_add( &b->set, "save_on_quit", "true", set_eval_bool, b ); 17 s = set_add( &b->set, "status", NULL, NULL/*set_eval_away_status*/, b );45 s = set_add( &b->set, "status", NULL, set_eval_away_status, b ); 18 46 s->flags |= SET_NULL_OK; 19 47 s = set_add( &b->set, "strip_html", "true", NULL, b ); … … 46 74 g_free( b ); 47 75 } 76 77 static char *set_eval_away_status( set_t *set, char *value ) 78 { 79 bee_t *bee = set->data; 80 account_t *a; 81 82 g_free( set->value ); 83 set->value = g_strdup( value ); 84 85 for( a = bee->accounts; a; a = a->next ) 86 { 87 struct im_connection *ic = a->ic; 88 89 if( ic && ic->flags & OPT_LOGGED_IN ) 90 imc_away_send_update( ic ); 91 } 92 93 return value; 94 }
Note: See TracChangeset
for help on using the changeset viewer.