- Timestamp:
- 2010-03-12T19:10:16Z (15 years ago)
- Branches:
- master
- Children:
- dde9d571
- Parents:
- 08e5bb2 (diff), 8b6b740 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- protocols
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber.c
r08e5bb2 rbe609ff 82 82 s = set_add( &acc->set, "xmlconsole", "false", set_eval_bool, acc ); 83 83 s->flags |= ACC_SET_OFFLINE_ONLY; 84 85 acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE; 84 86 } 85 87 … … 358 360 while( bud ) 359 361 { 360 imcb_log( ic, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s", 361 bud->full_jid, bud->priority, 362 bud->away_state ? bud->away_state->full_name : "(none)", 363 bud->away_message ? : "(none)" ); 362 imcb_log( ic, "Buddy %s (%d) information:", bud->full_jid, bud->priority ); 363 if( bud->away_state ) 364 imcb_log( ic, "Away state: %s", bud->away_state->full_name ); 365 imcb_log( ic, "Status message: %s", bud->away_message ? : "(none)" ); 366 364 367 bud = bud->next; 365 368 } … … 371 374 { 372 375 struct jabber_data *jd = ic->proto_data; 373 struct jabber_away_state *state; 374 375 /* Save all this info. We need it, for example, when changing the priority setting. */ 376 state = (void *) jabber_away_state_by_name( state_txt ); 377 jd->away_state = state ? state : (void *) jabber_away_state_list; /* Fall back to "Away" if necessary. */ 376 377 /* state_txt == NULL -> Not away. 378 Unknown state -> fall back to the first defined away state. */ 379 jd->away_state = state_txt ? jabber_away_state_by_name( state_txt ) 380 ? : jabber_away_state_list : NULL; 381 378 382 g_free( jd->away_message ); 379 383 jd->away_message = ( message && *message ) ? g_strdup( message ) : NULL; -
protocols/jabber/jabber.h
r08e5bb2 rbe609ff 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 struct jabber_away_state *away_state;86 const struct jabber_away_state *away_state; 87 87 char *away_message; 88 88 -
protocols/jabber/jabber_util.c
r08e5bb2 rbe609ff 228 228 { 229 229 { "away", "Away" }, 230 { "chat", "Free for Chat" }, 230 { "chat", "Free for Chat" }, /* WTF actually uses this? */ 231 231 { "dnd", "Do not Disturb" }, 232 232 { "xa", "Extended Away" }, 233 { "", "Online" },234 233 { "", NULL } 235 234 }; … … 238 237 { 239 238 int i; 239 240 if( code == NULL ) 241 return NULL; 240 242 241 243 for( i = 0; jabber_away_state_list[i].full_name; i ++ ) … … 249 251 { 250 252 int i; 253 254 if( name == NULL ) 255 return NULL; 251 256 252 257 for( i = 0; jabber_away_state_list[i].full_name; i ++ ) -
protocols/jabber/presence.c
r08e5bb2 rbe609ff 187 187 int is_away = 0; 188 188 189 if( send_presence->away_state && !( *send_presence->away_state->code == 0 ||190 strcmp( send_presence->away_state->code, "chat" ) == 0 ))189 if( send_presence->away_state && 190 strcmp( send_presence->away_state->code, "chat" ) != 0 ) 191 191 is_away = OPT_AWAY; 192 192 193 193 imcb_buddy_status( ic, send_presence->bare_jid, OPT_LOGGED_IN | is_away, 194 ( is_away && send_presence->away_state ) ? 195 send_presence->away_state->full_name : NULL, 194 is_away ? send_presence->away_state->full_name : NULL, 196 195 send_presence->away_message ); 197 196 } … … 206 205 struct jabber_data *jd = ic->proto_data; 207 206 struct xt_node *node, *cap; 208 char *show = jd->away_state->code;209 char *status = jd->away_message;210 207 struct groupchat *c; 211 208 int st; … … 213 210 node = jabber_make_packet( "presence", NULL, NULL, NULL ); 214 211 xt_add_child( node, xt_new_node( "priority", set_getstr( &ic->acc->set, "priority" ), NULL ) ); 215 if( show && *show)216 xt_add_child( node, xt_new_node( "show", show, NULL ) );217 if( status)218 xt_add_child( node, xt_new_node( "status", status, NULL ) );212 if( jd->away_state ) 213 xt_add_child( node, xt_new_node( "show", jd->away_state->code, NULL ) ); 214 if( jd->away_message ) 215 xt_add_child( node, xt_new_node( "status", jd->away_message, NULL ) ); 219 216 220 217 /* This makes the packet slightly bigger, but clients interested in -
protocols/msn/msn.c
r08e5bb2 rbe609ff 139 139 140 140 if( l == NULL ) 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 ); 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 ); 143 144 144 145 return l; … … 149 150 char buf[1024]; 150 151 struct msn_data *md = ic->proto_data; 151 const struct msn_away_state *st;152 153 if( strcmp( state, GAIM_AWAY_CUSTOM ) == 0 )154 st = msn_away_state_by_name( "Away" );152 153 if( state ) 154 md->away_state = msn_away_state_by_name( state ) ? : 155 msn_away_state_list + 1; 155 156 else 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 ); 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 ); 162 160 msn_write( ic, buf, strlen( buf ) ); 163 161 } -
protocols/msn/msn.h
r08e5bb2 rbe609ff 97 97 struct msn_away_state 98 98 { 99 int number;100 99 char code[4]; 101 100 char name[16]; -
protocols/msn/msn_util.c
r08e5bb2 rbe609ff 171 171 172 172 /* End of headers? */ 173 if( strncmp( text + i - 2, "\n\n", 2 ) == 0||174 strncmp( text + i - 4, "\r\n\r\n", 4 ) == 0 ||175 strncmp( text + i - 2, "\r\r", 2 ) == 0)173 if( ( i >= 4 && strncmp( text + i - 4, "\r\n\r\n", 4 ) == 0 ) || 174 ( i >= 2 && ( strncmp( text + i - 2, "\n\n", 2 ) == 0 || 175 strncmp( text + i - 2, "\r\r", 2 ) == 0 ) ) ) 176 176 { 177 177 break; … … 374 374 *list = NULL; 375 375 376 imcb_log( ic, ret->str );376 imcb_log( ic, "%s", ret->str ); 377 377 g_string_free( ret, TRUE ); 378 378 } -
protocols/msn/ns.c
r08e5bb2 rbe609ff 420 420 { 421 421 /* FIXME: Warn/Bomb about unknown away state? */ 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 ); 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 ); 427 428 } 428 429 else if( strcmp( cmd[0], "FLN" ) == 0 ) … … 449 450 { 450 451 /* FIXME: Warn/Bomb about unknown away state? */ 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 ); 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 ); 456 458 } 457 459 else if( strcmp( cmd[0], "RNG" ) == 0 ) … … 663 665 } 664 666 665 if( arg1 )g_free( arg1 );666 if( mtype )g_free( mtype );667 g_free( arg1 ); 668 g_free( mtype ); 667 669 } 668 670 else if( g_strncasecmp( ct, "text/x-msmsgsprofile", 20 ) == 0 ) … … 672 674 else if( g_strncasecmp( ct, "text/x-msmsgsinitialemailnotification", 37 ) == 0 ) 673 675 { 674 char *inbox = msn_findheader( body, "Inbox-Unread:", blen ); 675 char *folders = msn_findheader( body, "Folders-Unread:", blen ); 676 677 if( inbox && folders && set_getbool( &ic->acc->set, "mail_notifications" ) ) 676 if( set_getbool( &ic->acc->set, "mail_notifications" ) ) 678 677 { 679 imcb_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders ); 678 char *inbox = msn_findheader( body, "Inbox-Unread:", blen ); 679 char *folders = msn_findheader( body, "Folders-Unread:", blen ); 680 681 if( inbox && folders ) 682 imcb_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders ); 683 684 g_free( inbox ); 685 g_free( folders ); 680 686 } 681 682 g_free( inbox );683 g_free( folders );684 687 } 685 688 else if( g_strncasecmp( ct, "text/x-msmsgsemailnotification", 30 ) == 0 ) 686 689 { 687 char *from = msn_findheader( body, "From-Addr:", blen ); 688 char *fromname = msn_findheader( body, "From:", blen ); 689 690 if( from && fromname && set_getbool( &ic->acc->set, "mail_notifications" ) ) 690 if( set_getbool( &ic->acc->set, "mail_notifications" ) ) 691 691 { 692 imcb_log( ic, "Received an e-mail message from %s <%s>.", fromname, from ); 692 char *from = msn_findheader( body, "From-Addr:", blen ); 693 char *fromname = msn_findheader( body, "From:", blen ); 694 695 if( from && fromname ) 696 imcb_log( ic, "Received an e-mail message from %s <%s>.", fromname, from ); 697 698 g_free( from ); 699 g_free( fromname ); 693 700 } 694 701 } -
protocols/msn/tables.c
r08e5bb2 rbe609ff 29 29 const struct msn_away_state msn_away_state_list[] = 30 30 { 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,"", "" }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 { "", "" } 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 }52 41 53 42 const struct msn_away_state *msn_away_state_by_code( char *code ) … … 55 44 int i; 56 45 57 for( i = 0; msn_away_state_list[i].number > -1; i ++ )46 for( i = 0; *msn_away_state_list[i].code; i ++ ) 58 47 if( g_strcasecmp( msn_away_state_list[i].code, code ) == 0 ) 59 48 return( msn_away_state_list + i ); 60 49 61 return ( NULL );50 return NULL; 62 51 } 63 52 … … 66 55 int i; 67 56 68 for( i = 0; msn_away_state_list[i].number > -1; i ++ )57 for( i = 0; *msn_away_state_list[i].code; i ++ ) 69 58 if( g_strcasecmp( msn_away_state_list[i].name, name ) == 0 ) 70 59 return( msn_away_state_list + i ); 71 60 72 return ( NULL );61 return NULL; 73 62 } 74 63 -
protocols/nogaim.c
r08e5bb2 rbe609ff 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 … … 1070 1069 } 1071 1070 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 ); 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 = NULL; 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; 1117 1095 } 1118 1096 … … 1129 1107 }; 1130 1108 1131 static char *imc_away_ alias_find( GList *gcm, char *away)1109 static char *imc_away_state_find( GList *gcm, char *away, char **message ) 1132 1110 { 1133 1111 GList *m; 1134 1112 int i, j; 1135 1113 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 message 1118 contains no data unless it adds something to what 1119 we have in state already. */ 1120 if( strlen( m->data ) == strlen( away ) ) 1121 *message = NULL; 1122 1123 return m->data; 1124 } 1125 1136 1126 for( i = 0; *imc_away_alias_list[i]; i ++ ) 1137 1127 { 1128 int keep_message; 1129 1138 1130 for( j = 0; imc_away_alias_list[i][j]; j ++ ) 1139 1131 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] ); 1140 1134 break; 1135 } 1141 1136 1142 1137 if( !imc_away_alias_list[i][j] ) /* If we reach the end, this row */ … … 1146 1141 for( j = 0; imc_away_alias_list[i][j]; j ++ ) 1147 1142 { 1148 m = gcm; 1149 while( m ) 1150 { 1143 for( m = gcm; m; m = m->next ) 1151 1144 if( g_strcasecmp( imc_away_alias_list[i][j], m->data ) == 0 ) 1152 return( imc_away_alias_list[i][j] ); 1153 m = m->next; 1154 } 1155 } 1156 } 1157 1158 return( NULL ); 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; 1159 1159 } 1160 1160 -
protocols/nogaim.h
r08e5bb2 rbe609ff 49 49 50 50 #define WEBSITE "http://www.bitlbee.org/" 51 #define GAIM_AWAY_CUSTOM "Custom"52 51 53 52 /* Sharing flags between all kinds of things. I just hope I won't hit any … … 218 217 219 218 /* You can tell what away states your protocol supports, so that 220 * BitlBee will try to map the IRC away reasons to them , or use221 * GAIM_AWAY_CUSTOM when calling skype_set_away(). */219 * BitlBee will try to map the IRC away reasons to them. If your 220 * protocol doesn't have any, just return one generic "Away". */ 222 221 GList *(* away_states)(struct im_connection *ic); 223 222 … … 315 314 316 315 /* Actions, or whatever. */ 317 int imc_ set_away( struct im_connection *ic, char *away);316 int imc_away_send_update( struct im_connection *ic ); 318 317 int imc_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags ); 319 318 int imc_chat_msg( struct groupchat *c, char *msg, int flags ); -
protocols/oscar/oscar.c
r08e5bb2 rbe609ff 380 380 s->flags |= ACC_SET_OFFLINE_ONLY; 381 381 } 382 383 acc->flags |= ACC_FLAG_AWAY_MESSAGE; 382 384 } 383 385 … … 1952 1954 static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message) 1953 1955 { 1956 if (state == NULL) 1957 state = ""; 1954 1958 1955 1959 if (!g_strcasecmp(state, _("Visible"))) { … … 1959 1963 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE); 1960 1964 return; 1961 } /* else... */ 1965 } else if (message == NULL) { 1966 message = state; 1967 } 1962 1968 1963 1969 if (od->rights.maxawaymsglen == 0) … … 2002 2008 } 2003 2009 2004 if ( !g_strcasecmp(state, "Online")) {2010 if (state == NULL) { 2005 2011 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); 2006 2012 } else if (!g_strcasecmp(state, "Away")) { … … 2027 2033 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE); 2028 2034 ic->away = g_strdup(msg); 2029 } else if (!g_strcasecmp(state, GAIM_AWAY_CUSTOM)){2035 } else { 2030 2036 if (no_message) { 2031 2037 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); … … 2276 2282 { 2277 2283 struct oscar_data *od = ic->proto_data; 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; 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 } 2292 2299 } 2293 2300 -
protocols/yahoo/libyahoo2.c
r08e5bb2 rbe609ff 1530 1530 newbud = y_new0(struct yahoo_buddy, 1); 1531 1531 newbud->id = strdup(pair->value); 1532 if (cur_group)1532 if (cur_group) { 1533 1533 newbud->group = strdup(cur_group); 1534 else { 1535 struct yahoo_buddy *lastbud = (struct yahoo_buddy *)y_list_nth( 1536 yd->buddies, y_list_length(yd->buddies)-1)->data; 1537 newbud->group = strdup(lastbud->group); 1534 } else { 1535 YList *last; 1536 struct yahoo_buddy *lastbud; 1537 1538 for (last = yd->buddies; last && last->next; last = last->next); 1539 if (last) { 1540 lastbud = last->data; 1541 newbud->group = strdup(lastbud->group); 1542 } else { 1543 newbud->group = strdup("Buddies"); 1544 } 1538 1545 } 1539 1546 … … 2393 2400 { 2394 2401 struct yahoo_https_auth_data *had = req->data; 2395 struct yahoo_input_data *yid = had->yid;2396 struct yahoo_data *yd = yid->yd;2402 struct yahoo_input_data *yid; 2403 struct yahoo_data *yd; 2397 2404 int st; 2405 2406 if (y_list_find(inputs, had->yid) == NULL) 2407 return; 2408 2409 yid = had->yid; 2410 yd = yid->yd; 2398 2411 2399 2412 if (req->status_code != 200) { … … 2436 2449 { 2437 2450 struct yahoo_https_auth_data *had = req->data; 2438 struct yahoo_input_data *yid = had->yid;2439 struct yahoo_data *yd = yid->yd;2451 struct yahoo_input_data *yid; 2452 struct yahoo_data *yd; 2440 2453 struct yahoo_packet *pack; 2441 char *crumb ;2454 char *crumb = NULL; 2442 2455 int st; 2456 2457 if (y_list_find(inputs, had->yid) == NULL) 2458 return; 2459 2460 yid = had->yid; 2461 yd = yid->yd; 2443 2462 2444 2463 md5_byte_t result[16]; … … 4080 4099 4081 4100 yd = yid->yd; 4082 4083 4101 old_status = yd->current_status; 4084 4085 if (msg && strncmp(msg,"Invisible",9)) { 4086 yd->current_status = YAHOO_STATUS_CUSTOM; 4087 } else { 4088 yd->current_status = state; 4089 } 4102 yd->current_status = state; 4090 4103 4091 4104 /* Thank you libpurple :) */ … … 4102 4115 snprintf(s, sizeof(s), "%d", yd->current_status); 4103 4116 yahoo_packet_hash(pkt, 10, s); 4104 4105 if (yd->current_status == YAHOO_STATUS_CUSTOM) { 4106 yahoo_packet_hash(pkt, 19, msg); 4107 } else { 4108 yahoo_packet_hash(pkt, 19, ""); 4109 } 4110 4117 yahoo_packet_hash(pkt, 19, msg && state == YAHOO_STATUS_CUSTOM ? msg : ""); 4111 4118 yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0"); 4112 4113 4119 yahoo_send_packet(yid, pkt, 0); 4114 4120 yahoo_packet_free(pkt); -
protocols/yahoo/yahoo.c
r08e5bb2 rbe609ff 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; 132 134 } 133 135 … … 197 199 { 198 200 struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data; 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 ) 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 ) 222 207 yd->current_status = YAHOO_STATUS_BRB; 223 208 else if( g_strcasecmp( state, "Busy" ) == 0 ) … … 239 224 else if( g_strcasecmp( state, "Invisible" ) == 0 ) 240 225 yd->current_status = YAHOO_STATUS_INVISIBLE; 241 else if( g_strcasecmp( state, GAIM_AWAY_CUSTOM ) == 0 ) 242 { 243 yd->current_status = YAHOO_STATUS_AVAILABLE; 244 245 away = NULL; 246 } 247 } 226 else 227 yd->current_status = YAHOO_STATUS_CUSTOM; 228 } 229 else if( state ) 230 yd->current_status = YAHOO_STATUS_CUSTOM; 248 231 else 249 232 yd->current_status = YAHOO_STATUS_AVAILABLE; 250 233 251 yahoo_set_away( yd->y2_id, yd->current_status, msg, away != NULL? 2 : 0 );234 yahoo_set_away( yd->y2_id, yd->current_status, msg, state ? 2 : 0 ); 252 235 } 253 236 … … 258 241 if( m == NULL ) 259 242 { 260 m = g_list_append( m, "Available" );261 243 m = g_list_append( m, "Be Right Back" ); 262 244 m = g_list_append( m, "Busy" ); … … 269 251 m = g_list_append( m, "Stepped Out" ); 270 252 m = g_list_append( m, "Invisible" ); 271 m = g_list_append( m, GAIM_AWAY_CUSTOM );272 253 } 273 254
Note: See TracChangeset
for help on using the changeset viewer.