Changes in / [c32f492:1c2eaa3]
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
account.c
rc32f492 r1c2eaa3 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-20 10Wilmer van der Gaast and others *4 * Copyright 2002-2004 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 69 69 prpl->init( a ); 70 70 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; 71 return( a ); 81 72 } 82 73 … … 130 121 131 122 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 already140 (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 147 123 return value; 148 124 } … … 291 267 p->max = 86400; 292 268 293 /* Format: /[0-9]+([*+][0-9]+(<[0-9+]) ?)?/ */269 /* Format: /[0-9]+([*+][0-9]+(<[0-9+]))/ */ 294 270 while( *value && isdigit( *value ) ) 295 271 p->start = p->start * 10 + *value++ - '0'; -
account.h
rc32f492 r1c2eaa3 37 37 int auto_reconnect_delay; 38 38 int reconnect; 39 int flags;40 39 41 40 set_t *set; … … 57 56 int account_reconnect_delay( account_t *a ); 58 57 59 typedef enum 60 { 61 ACC_SET_NOSAVE = 0x01, /* Don't save this setting (i.e. stored elsewhere). */ 62 ACC_SET_OFFLINE_ONLY = 0x02, /* Allow changes only if the acct is offline. */ 63 ACC_SET_ONLINE_ONLY = 0x04, /* Allow changes only if the acct is online. */ 64 } account_set_flag_t; 65 66 typedef enum 67 { 68 ACC_FLAG_AWAY_MESSAGE = 0x01, /* Supports away messages instead of just states. */ 69 ACC_FLAG_STATUS_MESSAGE = 0x02, /* Supports status messages (without being away). */ 70 } account_flag_t; 58 #define ACC_SET_NOSAVE 0x01 59 #define ACC_SET_OFFLINE_ONLY 0x02 60 #define ACC_SET_ONLINE_ONLY 0x04 71 61 72 62 #endif -
doc/user-guide/commands.xml
rc32f492 r1c2eaa3 436 436 </bitlbee-setting> 437 437 438 <bitlbee-setting name="away" type="string" scope="both">439 <description>440 <para>441 To mark yourself as away, it is recommended to just use <emphasis>/away</emphasis>, like on normal IRC networks. If you want to mark yourself as away on only one IM network, you can use this per-account setting.442 </para>443 444 <para>445 You can set it to any value and BitlBee will try to map it to the most appropriate away state for every open IM connection, or set it as a free-form away message where possible.446 </para>447 448 <para>449 Any per-account away setting will override globally set away states. To un-set the setting, use <emphasis>set -del away</emphasis>.450 </para>451 </description>452 </bitlbee-setting>453 454 438 <bitlbee-setting name="away_devoice" type="boolean" scope="global"> 455 439 <default>true</default> … … 763 747 </bitlbee-setting> 764 748 765 <bitlbee-setting name="status" type="string" scope="both">766 <description>767 <para>768 Certain protocols (like Jabber/XMPP) support status messages, similar to away messages. They can be used to indicate things like your location or activity, without showing up as away/busy.769 </para>770 771 <para>772 This setting can be used to set such a message. It will be available as a per-account setting for protocols that support it, and also as a global setting (which will then automatically be used for all protocols that support it).773 </para>774 775 <para>776 Away states set using <emphasis>/away</emphasis> or the <emphasis>away</emphasis> setting will override this setting. To un-set the setting, use <emphasis>set -del status</emphasis>.777 </para>778 </description>779 </bitlbee-setting>780 781 749 <bitlbee-setting name="strip_html" type="boolean" scope="global"> 782 750 <default>true</default> -
doc/user-guide/misc.xml
rc32f492 r1c2eaa3 86 86 87 87 <para> 88 To mark yourself as away, you can just use the <emphasis>/away</emphasis> command in your IRC client. BitlBee supports most away-states supported by the protocols.88 As you might've expected, you can just use the <emphasis>/away</emphasis> command in your IRC client to set an away-state. BitlBee supports most away-states supported by the protocols. 89 89 </para> 90 90 91 91 <para> 92 Away states have different names accross different protocols. BitlBee will try to pick the best available optionfor every connection:92 Not all away states are supported by all protocols, and some protocols have different names for them. BitlBee will try to pick the best available alias from this list for every connection: 93 93 </para> 94 94 95 95 <simplelist> 96 <member>Away </member>97 <member>NA </member>98 <member>Busy, D ND</member>99 <member>B RB</member>100 <member> Phone</member>101 <member> Lunch, Food</member>96 <member>Away from computer, Away, Extended away</member> 97 <member>NA, N/A, Not available</member> 98 <member>Busy, Do not disturb, DND, Occupied</member> 99 <member>Be right back, BRB</member> 100 <member>On the phone, Phone, On phone</member> 101 <member>Out to lunch, Lunch, Food</member> 102 102 <member>Invisible, Hidden</member> 103 103 </simplelist> 104 104 105 105 <para> 106 So <emphasis>/away Food</emphasis> will set your state to "Out to lunch" on your MSN connection, and for most other connections the default, "Away" will be chosen.106 So <emphasis>/away Food</emphasis> will set your state to "Out to lunch" on your MSN connection, and for most other connections the default, "Away" or "Away from computer" will be chosen. 107 107 </para> 108 108 … … 111 111 </para> 112 112 113 <para>114 If you want to set an away state for only one of your connections, you can use the per-account <emphasis>away</emphasis> setting. See <emphasis>help set away</emphasis>.115 </para>116 117 113 </sect1> 118 114 -
irc.c
rc32f492 r1c2eaa3 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 99 80 irc_t *irc_new( int fd ) 100 81 { … … 162 143 irc_connection_list = g_slist_append( irc_connection_list, irc ); 163 144 164 s = set_add( &irc->set, "away", NULL, set_eval_away_status, irc );165 s->flags |= SET_NULL_OK;166 145 s = set_add( &irc->set, "away_devoice", "true", set_eval_away_devoice, irc ); 167 146 s = set_add( &irc->set, "auto_connect", "true", set_eval_bool, irc ); … … 184 163 s = set_add( &irc->set, "save_on_quit", "true", set_eval_bool, irc ); 185 164 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;188 165 s = set_add( &irc->set, "strip_html", "true", NULL, irc ); 189 166 s = set_add( &irc->set, "to_char", ": ", set_eval_to_char, irc ); -
irc_commands.c
rc32f492 r1c2eaa3 448 448 user_t *u = user_find( irc, irc->nick ); 449 449 char *away = cmd[1]; 450 account_t *a; 450 451 451 452 if( !u ) return; … … 474 475 } 475 476 476 set_setstr( &irc->set, "away", u->away ); 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 484 } 478 485 -
protocols/jabber/jabber.c
rc32f492 r1c2eaa3 80 80 s = set_add( &acc->set, "xmlconsole", "false", set_eval_bool, acc ); 81 81 s->flags |= ACC_SET_OFFLINE_ONLY; 82 83 acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE;84 82 } 85 83 … … 366 364 while( bud ) 367 365 { 368 imcb_log( ic, "Buddy %s (%d) information:", bud->full_jid, bud->priority ); 369 if( bud->away_state ) 370 imcb_log( ic, "Away state: %s", bud->away_state->full_name ); 371 imcb_log( ic, "Status message: %s", bud->away_message ? : "(none)" ); 372 366 imcb_log( ic, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s", 367 bud->full_jid, bud->priority, 368 bud->away_state ? bud->away_state->full_name : "(none)", 369 bud->away_message ? : "(none)" ); 373 370 bud = bud->next; 374 371 } … … 380 377 { 381 378 struct jabber_data *jd = ic->proto_data; 382 383 /* state_txt == NULL -> Not away. 384 Unknown state -> fall back to the first defined away state. */ 385 jd->away_state = state_txt ? jabber_away_state_by_name( state_txt ) 386 ? : jabber_away_state_list : NULL; 387 379 struct jabber_away_state *state; 380 381 /* Save all this info. We need it, for example, when changing the priority setting. */ 382 state = (void *) jabber_away_state_by_name( state_txt ); 383 jd->away_state = state ? state : (void *) jabber_away_state_list; /* Fall back to "Away" if necessary. */ 388 384 g_free( jd->away_message ); 389 385 jd->away_message = ( message && *message ) ? g_strdup( message ) : NULL; -
protocols/jabber/jabber.h
rc32f492 r1c2eaa3 84 84 /* After changing one of these two (or the priority setting), call 85 85 presence_send_update() to inform the server about the changes. */ 86 conststruct jabber_away_state *away_state;86 struct jabber_away_state *away_state; 87 87 char *away_message; 88 88 -
protocols/jabber/jabber_util.c
rc32f492 r1c2eaa3 228 228 { 229 229 { "away", "Away" }, 230 { "chat", "Free for Chat" }, /* WTF actually uses this? */230 { "chat", "Free for Chat" }, 231 231 { "dnd", "Do not Disturb" }, 232 232 { "xa", "Extended Away" }, 233 { "", "Online" }, 233 234 { "", NULL } 234 235 }; … … 237 238 { 238 239 int i; 239 240 if( code == NULL )241 return NULL;242 240 243 241 for( i = 0; jabber_away_state_list[i].full_name; i ++ ) … … 251 249 { 252 250 int i; 253 254 if( name == NULL )255 return NULL;256 251 257 252 for( i = 0; jabber_away_state_list[i].full_name; i ++ ) -
protocols/jabber/presence.c
rc32f492 r1c2eaa3 190 190 int is_away = 0; 191 191 192 if( send_presence->away_state && 193 strcmp( send_presence->away_state->code, "chat" ) != 0)192 if( send_presence->away_state && !( *send_presence->away_state->code == 0 || 193 strcmp( send_presence->away_state->code, "chat" ) == 0 ) ) 194 194 is_away = OPT_AWAY; 195 195 196 196 imcb_buddy_status( ic, send_presence->bare_jid, OPT_LOGGED_IN | is_away, 197 is_away ? send_presence->away_state->full_name : NULL, 197 ( is_away && send_presence->away_state ) ? 198 send_presence->away_state->full_name : NULL, 198 199 send_presence->away_message ); 199 200 } … … 208 209 struct jabber_data *jd = ic->proto_data; 209 210 struct xt_node *node, *cap; 211 char *show = jd->away_state->code; 212 char *status = jd->away_message; 210 213 struct groupchat *c; 211 214 int st; … … 213 216 node = jabber_make_packet( "presence", NULL, NULL, NULL ); 214 217 xt_add_child( node, xt_new_node( "priority", set_getstr( &ic->acc->set, "priority" ), NULL ) ); 215 if( jd->away_state)216 xt_add_child( node, xt_new_node( "show", jd->away_state->code, NULL ) );217 if( jd->away_message)218 xt_add_child( node, xt_new_node( "status", jd->away_message, NULL ) );218 if( show && *show ) 219 xt_add_child( node, xt_new_node( "show", show, NULL ) ); 220 if( status ) 221 xt_add_child( node, xt_new_node( "status", status, NULL ) ); 219 222 220 223 /* This makes the packet slightly bigger, but clients interested in -
protocols/msn/msn.c
rc32f492 r1c2eaa3 139 139 140 140 if( l == NULL ) 141 for( i = 0; *msn_away_state_list[i].code; i ++ ) 142 if( *msn_away_state_list[i].name ) 143 l = g_list_append( l, (void*) msn_away_state_list[i].name ); 141 for( i = 0; msn_away_state_list[i].number > -1; i ++ ) 142 l = g_list_append( l, (void*) msn_away_state_list[i].name ); 144 143 145 144 return l; … … 150 149 char buf[1024]; 151 150 struct msn_data *md = ic->proto_data; 152 153 if( state )154 md->away_state = msn_away_state_by_name( state ) ? :155 msn_away_state_list + 1;151 const struct msn_away_state *st; 152 153 if( strcmp( state, GAIM_AWAY_CUSTOM ) == 0 ) 154 st = msn_away_state_by_name( "Away" ); 156 155 else 157 md->away_state = msn_away_state_list; 158 159 g_snprintf( buf, sizeof( buf ), "CHG %d %s\r\n", ++md->trId, md->away_state->code ); 156 st = msn_away_state_by_name( state ); 157 158 if( !st ) st = msn_away_state_list; 159 md->away_state = st; 160 161 g_snprintf( buf, sizeof( buf ), "CHG %d %s\r\n", ++md->trId, st->code ); 160 162 msn_write( ic, buf, strlen( buf ) ); 161 163 } -
protocols/msn/msn.h
rc32f492 r1c2eaa3 97 97 struct msn_away_state 98 98 { 99 int number; 99 100 char code[4]; 100 101 char name[16]; -
protocols/msn/ns.c
rc32f492 r1c2eaa3 420 420 { 421 421 /* FIXME: Warn/Bomb about unknown away state? */ 422 st = msn_away_state_list + 1; 423 } 424 425 imcb_buddy_status( ic, cmd[3], OPT_LOGGED_IN | 426 ( st != msn_away_state_list ? OPT_AWAY : 0 ), 427 st->name, NULL ); 422 st = msn_away_state_list; 423 } 424 425 imcb_buddy_status( ic, cmd[3], OPT_LOGGED_IN | 426 ( st->number ? OPT_AWAY : 0 ), st->name, NULL ); 428 427 } 429 428 else if( strcmp( cmd[0], "FLN" ) == 0 ) … … 450 449 { 451 450 /* FIXME: Warn/Bomb about unknown away state? */ 452 st = msn_away_state_list + 1; 453 } 454 455 imcb_buddy_status( ic, cmd[2], OPT_LOGGED_IN | 456 ( st != msn_away_state_list ? OPT_AWAY : 0 ), 457 st->name, NULL ); 451 st = msn_away_state_list; 452 } 453 454 imcb_buddy_status( ic, cmd[2], OPT_LOGGED_IN | 455 ( st->number ? OPT_AWAY : 0 ), st->name, NULL ); 458 456 } 459 457 else if( strcmp( cmd[0], "RNG" ) == 0 ) -
protocols/msn/tables.c
rc32f492 r1c2eaa3 29 29 const struct msn_away_state msn_away_state_list[] = 30 30 { 31 { "NLN", "" },32 { "AWY", "Away" },33 { "BSY", "Busy" },34 { "IDL", "Idle" },35 { "BRB", "Be Right Back" },36 { "PHN", "On the Phone" },37 { "LUN", "Out to Lunch" },38 { "HDN", "Hidden" },39 { "", "" }31 { 0, "NLN", "Available" }, 32 { 1, "BSY", "Busy" }, 33 { 3, "IDL", "Idle" }, 34 { 5, "BRB", "Be Right Back" }, 35 { 7, "AWY", "Away" }, 36 { 9, "PHN", "On the Phone" }, 37 { 11, "LUN", "Out to Lunch" }, 38 { 13, "HDN", "Hidden" }, 39 { -1, "", "" } 40 40 }; 41 42 const struct msn_away_state *msn_away_state_by_number( int number ) 43 { 44 int i; 45 46 for( i = 0; msn_away_state_list[i].number > -1; i ++ ) 47 if( msn_away_state_list[i].number == number ) 48 return( msn_away_state_list + i ); 49 50 return( NULL ); 51 } 41 52 42 53 const struct msn_away_state *msn_away_state_by_code( char *code ) … … 44 55 int i; 45 56 46 for( i = 0; *msn_away_state_list[i].code; i ++ )57 for( i = 0; msn_away_state_list[i].number > -1; i ++ ) 47 58 if( g_strcasecmp( msn_away_state_list[i].code, code ) == 0 ) 48 59 return( msn_away_state_list + i ); 49 60 50 return NULL;61 return( NULL ); 51 62 } 52 63 … … 55 66 int i; 56 67 57 for( i = 0; *msn_away_state_list[i].code; i ++ )68 for( i = 0; msn_away_state_list[i].number > -1; i ++ ) 58 69 if( g_strcasecmp( msn_away_state_list[i].name, name ) == 0 ) 59 70 return( msn_away_state_list + i ); 60 71 61 return NULL;72 return( NULL ); 62 73 } 63 74 -
protocols/nogaim.c
rc32f492 r1c2eaa3 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-20 10Wilmer van der Gaast and others *4 * Copyright 2002-2006 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 268 268 ic->flags |= OPT_LOGGED_IN; 269 269 270 /* Necessary to send initial presence status, even if we're not away. */ 271 imc_away_send_update( ic ); 270 /* Also necessary when we're not away, at least for some of the 271 protocols. */ 272 imc_set_away( ic, u->away ); 272 273 273 274 /* Apparently we're connected successfully, so reset the … … 1069 1070 } 1070 1071 1071 static char *imc_away_state_find( GList *gcm, char *away, char **message ); 1072 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" ); 1079 if( away && *away ) 1080 { 1081 GList *m = ic->acc->prpl->away_states( ic ); 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 ); 1093 1094 return 1; 1072 static char *imc_away_alias_find( GList *gcm, char *away ); 1073 1074 int imc_set_away( struct im_connection *ic, char *away ) 1075 { 1076 GList *m, *ms; 1077 char *s; 1078 1079 if( !away ) away = ""; 1080 ms = m = ic->acc->prpl->away_states( ic ); 1081 1082 while( m ) 1083 { 1084 if( *away ) 1085 { 1086 if( g_strncasecmp( m->data, away, strlen( m->data ) ) == 0 ) 1087 break; 1088 } 1089 else 1090 { 1091 if( g_strcasecmp( m->data, "Available" ) == 0 ) 1092 break; 1093 if( g_strcasecmp( m->data, "Online" ) == 0 ) 1094 break; 1095 } 1096 m = m->next; 1097 } 1098 1099 if( m ) 1100 { 1101 ic->acc->prpl->set_away( ic, m->data, *away ? away : NULL ); 1102 } 1103 else 1104 { 1105 s = imc_away_alias_find( ms, away ); 1106 if( s ) 1107 { 1108 ic->acc->prpl->set_away( ic, s, away ); 1109 if( set_getbool( &ic->irc->set, "debug" ) ) 1110 imcb_log( ic, "Setting away state to %s", s ); 1111 } 1112 else 1113 ic->acc->prpl->set_away( ic, GAIM_AWAY_CUSTOM, away ); 1114 } 1115 1116 return( 1 ); 1095 1117 } 1096 1118 … … 1107 1129 }; 1108 1130 1109 static char *imc_away_ state_find( GList *gcm, char *away, char **message)1131 static char *imc_away_alias_find( GList *gcm, char *away ) 1110 1132 { 1111 1133 GList *m; 1112 1134 int i, j; 1113 1135 1114 for( m = gcm; m; m = m->next )1115 if( g_strncasecmp( m->data, away, strlen( m->data ) ) == 0 )1116 {1117 /* At least the Yahoo! module works better if message1118 contains no data unless it adds something to what1119 we have in state already. */1120 if( strlen( m->data ) == strlen( away ) )1121 *message = NULL;1122 1123 return m->data;1124 }1125 1126 1136 for( i = 0; *imc_away_alias_list[i]; i ++ ) 1127 1137 { 1128 int keep_message;1129 1130 1138 for( j = 0; imc_away_alias_list[i][j]; j ++ ) 1131 1139 if( g_strncasecmp( away, imc_away_alias_list[i][j], strlen( imc_away_alias_list[i][j] ) ) == 0 ) 1132 {1133 keep_message = strlen( away ) != strlen( imc_away_alias_list[i][j] );1134 1140 break; 1135 }1136 1141 1137 1142 if( !imc_away_alias_list[i][j] ) /* If we reach the end, this row */ … … 1141 1146 for( j = 0; imc_away_alias_list[i][j]; j ++ ) 1142 1147 { 1143 for( m = gcm; m; m = m->next ) 1148 m = gcm; 1149 while( m ) 1150 { 1144 1151 if( g_strcasecmp( imc_away_alias_list[i][j], m->data ) == 0 ) 1145 { 1146 if( !keep_message ) 1147 *message = NULL; 1148 1149 return imc_away_alias_list[i][j]; 1150 } 1151 } 1152 1153 /* No need to look further, apparently this state doesn't 1154 have any good alias for this protocol. */ 1155 break; 1156 } 1157 1158 return NULL; 1152 return( imc_away_alias_list[i][j] ); 1153 m = m->next; 1154 } 1155 } 1156 } 1157 1158 return( NULL ); 1159 1159 } 1160 1160 -
protocols/nogaim.h
rc32f492 r1c2eaa3 49 49 50 50 #define WEBSITE "http://www.bitlbee.org/" 51 #define GAIM_AWAY_CUSTOM "Custom" 51 52 52 53 /* Sharing flags between all kinds of things. I just hope I won't hit any … … 217 218 218 219 /* You can tell what away states your protocol supports, so that 219 * BitlBee will try to map the IRC away reasons to them . If your220 * protocol doesn't have any, just return one generic "Away". */220 * BitlBee will try to map the IRC away reasons to them, or use 221 * GAIM_AWAY_CUSTOM when calling skype_set_away(). */ 221 222 GList *(* away_states)(struct im_connection *ic); 222 223 … … 314 315 315 316 /* Actions, or whatever. */ 316 int imc_ away_send_update( struct im_connection *ic);317 int imc_set_away( struct im_connection *ic, char *away ); 317 318 int imc_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags ); 318 319 int imc_chat_msg( struct groupchat *c, char *msg, int flags ); -
protocols/oscar/oscar.c
rc32f492 r1c2eaa3 380 380 s->flags |= ACC_SET_OFFLINE_ONLY; 381 381 } 382 383 acc->flags |= ACC_FLAG_AWAY_MESSAGE;384 382 } 385 383 … … 1954 1952 static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message) 1955 1953 { 1956 if (state == NULL)1957 state = "";1958 1954 1959 1955 if (!g_strcasecmp(state, _("Visible"))) { … … 1963 1959 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE); 1964 1960 return; 1965 } else if (message == NULL) { 1966 message = state; 1967 } 1961 } /* else... */ 1968 1962 1969 1963 if (od->rights.maxawaymsglen == 0) … … 2008 2002 } 2009 2003 2010 if ( state == NULL) {2004 if (!g_strcasecmp(state, "Online")) { 2011 2005 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); 2012 2006 } else if (!g_strcasecmp(state, "Away")) { … … 2033 2027 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE); 2034 2028 ic->away = g_strdup(msg); 2035 } else {2029 } else if (!g_strcasecmp(state, GAIM_AWAY_CUSTOM)) { 2036 2030 if (no_message) { 2037 2031 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); … … 2282 2276 { 2283 2277 struct oscar_data *od = ic->proto_data; 2284 2285 if (od->icq) { 2286 static GList *m = NULL; 2287 m = g_list_append(m, "Away"); 2288 m = g_list_append(m, "Do Not Disturb"); 2289 m = g_list_append(m, "Not Available"); 2290 m = g_list_append(m, "Occupied"); 2291 m = g_list_append(m, "Free For Chat"); 2292 m = g_list_append(m, "Invisible"); 2293 return m; 2294 } else { 2295 static GList *m = NULL; 2296 m = g_list_append(m, "Away"); 2297 return m; 2298 } 2278 GList *m = NULL; 2279 2280 if (!od->icq) 2281 return g_list_append(m, GAIM_AWAY_CUSTOM); 2282 2283 m = g_list_append(m, "Online"); 2284 m = g_list_append(m, "Away"); 2285 m = g_list_append(m, "Do Not Disturb"); 2286 m = g_list_append(m, "Not Available"); 2287 m = g_list_append(m, "Occupied"); 2288 m = g_list_append(m, "Free For Chat"); 2289 m = g_list_append(m, "Invisible"); 2290 2291 return m; 2299 2292 } 2300 2293 -
protocols/yahoo/libyahoo2.c
rc32f492 r1c2eaa3 4099 4099 4100 4100 yd = yid->yd; 4101 4101 4102 old_status = yd->current_status; 4102 yd->current_status = state; 4103 4104 if (msg && strncmp(msg,"Invisible",9)) { 4105 yd->current_status = YAHOO_STATUS_CUSTOM; 4106 } else { 4107 yd->current_status = state; 4108 } 4103 4109 4104 4110 /* Thank you libpurple :) */ … … 4115 4121 snprintf(s, sizeof(s), "%d", yd->current_status); 4116 4122 yahoo_packet_hash(pkt, 10, s); 4117 yahoo_packet_hash(pkt, 19, msg && state == YAHOO_STATUS_CUSTOM ? msg : ""); 4123 4124 if (yd->current_status == YAHOO_STATUS_CUSTOM) { 4125 yahoo_packet_hash(pkt, 19, msg); 4126 } else { 4127 yahoo_packet_hash(pkt, 19, ""); 4128 } 4129 4118 4130 yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0"); 4131 4119 4132 yahoo_send_packet(yid, pkt, 0); 4120 4133 yahoo_packet_free(pkt); -
protocols/yahoo/yahoo.c
rc32f492 r1c2eaa3 130 130 { 131 131 set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc ); 132 133 acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE;134 132 } 135 133 … … 199 197 { 200 198 struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data; 201 202 if( state && msg == NULL ) 203 { 204 /* Use these states only if msg doesn't contain additional 205 info since away messages are only supported with CUSTOM. */ 206 if( g_strcasecmp( state, "Be Right Back" ) == 0 ) 199 char *away; 200 201 away = NULL; 202 203 if( state && msg && g_strcasecmp( state, msg ) != 0 ) 204 { 205 yd->current_status = YAHOO_STATUS_CUSTOM; 206 away = ""; 207 } 208 else if( state ) 209 { 210 /* Set msg to NULL since (if it isn't NULL already) it's equal 211 to state. msg must be empty if we want to use an existing 212 away state. */ 213 msg = NULL; 214 215 away = ""; 216 if( g_strcasecmp( state, "Available" ) == 0 ) 217 { 218 yd->current_status = YAHOO_STATUS_AVAILABLE; 219 away = NULL; 220 } 221 else if( g_strcasecmp( state, "Be Right Back" ) == 0 ) 207 222 yd->current_status = YAHOO_STATUS_BRB; 208 223 else if( g_strcasecmp( state, "Busy" ) == 0 ) … … 224 239 else if( g_strcasecmp( state, "Invisible" ) == 0 ) 225 240 yd->current_status = YAHOO_STATUS_INVISIBLE; 226 else 227 yd->current_status = YAHOO_STATUS_CUSTOM; 228 } 229 else if( state ) 230 yd->current_status = YAHOO_STATUS_CUSTOM; 241 else if( g_strcasecmp( state, GAIM_AWAY_CUSTOM ) == 0 ) 242 { 243 yd->current_status = YAHOO_STATUS_AVAILABLE; 244 245 away = NULL; 246 } 247 } 231 248 else 232 249 yd->current_status = YAHOO_STATUS_AVAILABLE; 233 250 234 yahoo_set_away( yd->y2_id, yd->current_status, msg, state? 2 : 0 );251 yahoo_set_away( yd->y2_id, yd->current_status, msg, away != NULL ? 2 : 0 ); 235 252 } 236 253 … … 241 258 if( m == NULL ) 242 259 { 260 m = g_list_append( m, "Available" ); 243 261 m = g_list_append( m, "Be Right Back" ); 244 262 m = g_list_append( m, "Busy" ); … … 251 269 m = g_list_append( m, "Stepped Out" ); 252 270 m = g_list_append( m, "Invisible" ); 271 m = g_list_append( m, GAIM_AWAY_CUSTOM ); 253 272 } 254 273
Note: See TracChangeset
for help on using the changeset viewer.