Changes in protocols/nogaim.c [58adb7e:4cf80bb]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/nogaim.c
r58adb7e r4cf80bb 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
Note: See TracChangeset
for help on using the changeset viewer.