Changeset 58adb7e
- Timestamp:
- 2010-03-07T00:22:33Z (15 years ago)
- Branches:
- master
- Children:
- 68198e9
- Parents:
- 34fbbf9
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
account.c
r34fbbf9 r58adb7e 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-20 04Wilmer van der Gaast and others *4 * Copyright 2002-2010 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 69 69 prpl->init( a ); 70 70 71 return( a ); 71 s = set_add( &a->set, "away", NULL, set_eval_account, a ); 72 s->flags |= SET_NULL_OK; 73 74 if( a->flags & ACC_FLAG_STATUS_MESSAGE ) 75 { 76 s = set_add( &a->set, "status", NULL, set_eval_account, a ); 77 s->flags |= SET_NULL_OK; 78 } 79 80 return a; 72 81 } 73 82 … … 121 130 122 131 acc->auto_connect = bool2int( value ); 132 return value; 133 } 134 else if( strcmp( set->key, "away" ) == 0 || 135 strcmp( set->key, "status" ) == 0 ) 136 { 137 if( acc->ic && acc->ic->flags & OPT_LOGGED_IN ) 138 { 139 /* If we're currently on-line, set the var now already 140 (bit of a hack) and send an update. */ 141 g_free( set->value ); 142 set->value = g_strdup( value ); 143 144 imc_away_send_update( acc->ic ); 145 } 146 123 147 return value; 124 148 } … … 267 291 p->max = 86400; 268 292 269 /* Format: /[0-9]+([*+][0-9]+(<[0-9+]) )/ */293 /* Format: /[0-9]+([*+][0-9]+(<[0-9+])?)?/ */ 270 294 while( *value && isdigit( *value ) ) 271 295 p->start = p->start * 10 + *value++ - '0'; -
irc.c
r34fbbf9 r58adb7e 78 78 } 79 79 80 static char *set_eval_away_status( set_t *set, char *value ) 81 { 82 irc_t *irc = set->data; 83 account_t *a; 84 85 g_free( set->value ); 86 set->value = g_strdup( value ); 87 88 for( a = irc->accounts; a; a = a->next ) 89 { 90 struct im_connection *ic = a->ic; 91 92 if( ic && ic->flags & OPT_LOGGED_IN ) 93 imc_away_send_update( ic ); 94 } 95 96 return value; 97 } 98 80 99 irc_t *irc_new( int fd ) 81 100 { … … 143 162 irc_connection_list = g_slist_append( irc_connection_list, irc ); 144 163 164 s = set_add( &irc->set, "away", NULL, set_eval_away_status, irc ); 165 s->flags |= SET_NULL_OK; 145 166 s = set_add( &irc->set, "away_devoice", "true", set_eval_away_devoice, irc ); 146 167 s = set_add( &irc->set, "auto_connect", "true", set_eval_bool, irc ); … … 163 184 s = set_add( &irc->set, "save_on_quit", "true", set_eval_bool, irc ); 164 185 s = set_add( &irc->set, "simulate_netsplit", "true", set_eval_bool, irc ); 186 s = set_add( &irc->set, "status", NULL, set_eval_away_status, irc ); 187 s->flags |= SET_NULL_OK; 165 188 s = set_add( &irc->set, "strip_html", "true", NULL, irc ); 166 189 s = set_add( &irc->set, "to_char", ": ", set_eval_to_char, irc ); -
irc_commands.c
r34fbbf9 r58adb7e 475 475 } 476 476 477 for( a = irc->accounts; a; a = a->next ) 478 { 479 struct im_connection *ic = a->ic; 480 481 if( ic && ic->flags & OPT_LOGGED_IN ) 482 imc_set_away( ic, u->away ); 483 } 477 set_setstr( &irc->set, "away", u->away ); 484 478 } 485 479 -
protocols/nogaim.c
r34fbbf9 r58adb7e 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-20 06Wilmer van der Gaast and others *4 * Copyright 2002-2010 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 268 268 ic->flags |= OPT_LOGGED_IN; 269 269 270 /* Also necessary when we're not away, at least for some of the 271 protocols. */ 272 imc_set_away( ic, u->away ); 270 /* Necessary to send initial presence status, even if we're not away. */ 271 imc_away_send_update( ic ); 273 272 274 273 /* Apparently we're connected successfully, so reset the … … 1072 1071 static char *imc_away_state_find( GList *gcm, char *away, char **message ); 1073 1072 1074 int imc_set_away( struct im_connection *ic, char *away ) 1075 { 1076 char *s = NULL, *msg = away; 1077 1073 int imc_away_send_update( struct im_connection *ic ) 1074 { 1075 char *away, *msg; 1076 1077 away = set_getstr( &ic->acc->set, "away" ) ? 1078 : set_getstr( &ic->irc->set, "away" ); 1078 1079 if( away && *away ) 1079 1080 { 1080 1081 GList *m = ic->acc->prpl->away_states( ic ); 1081 s = imc_away_state_find( m, away, &msg ) ? : m->data; 1082 } 1083 1084 if( set_getbool( &ic->irc->set, "debug" ) ) 1085 imcb_log( ic, "Setting away state to %s", s ); 1086 1087 ic->acc->prpl->set_away( ic, s, ic->acc->flags & ACC_FLAG_AWAY_MESSAGE ? msg : NULL ); 1082 msg = ic->acc->flags & ACC_FLAG_AWAY_MESSAGE ? away : NULL; 1083 away = imc_away_state_find( m, away, &msg ) ? : m->data; 1084 } 1085 else if( ic->acc->flags & ACC_FLAG_STATUS_MESSAGE ) 1086 { 1087 away = NULL; 1088 msg = set_getstr( &ic->acc->set, "status" ) ? 1089 : set_getstr( &ic->irc->set, "status" ); 1090 } 1091 1092 ic->acc->prpl->set_away( ic, away, msg ); 1088 1093 1089 1094 return 1; -
protocols/nogaim.h
r34fbbf9 r58adb7e 314 314 315 315 /* Actions, or whatever. */ 316 int imc_ set_away( struct im_connection *ic, char *away);316 int imc_away_send_update( struct im_connection *ic ); 317 317 int imc_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags ); 318 318 int imc_chat_msg( struct groupchat *c, char *msg, int flags );
Note: See TracChangeset
for help on using the changeset viewer.