Changeset be609ff for protocols/nogaim.c
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.