comparison src/server.c @ 8674:8c7da2e36136

[gaim-migrate @ 9426] That was some nasty whitespace. More people need the big red blocks enabled in their editor. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 16 Apr 2004 23:32:46 +0000
parents d4f6b9aa4cc8
children ddd2bf87fe8d
comparison
equal deleted inserted replaced
8673:5891a1a6fc7e 8674:8c7da2e36136
166 update_keepalive(gc, TRUE); 166 update_keepalive(gc, TRUE);
167 } 167 }
168 168
169 /* This should return the elapsed time in seconds in which Gaim will not send 169 /* This should return the elapsed time in seconds in which Gaim will not send
170 * typing notifications. 170 * typing notifications.
171 * if it returns zero, it will not send any more typing notifications 171 * if it returns zero, it will not send any more typing notifications
172 * typing is a flag - TRUE for typing, FALSE for stopped typing */ 172 * typing is a flag - TRUE for typing, FALSE for stopped typing */
173 int serv_send_typing(GaimConnection *g, const char *name, int typing) { 173 int serv_send_typing(GaimConnection *g, const char *name, int typing) {
174 GaimPluginProtocolInfo *prpl_info = NULL; 174 GaimPluginProtocolInfo *prpl_info = NULL;
175 175
176 if (g != NULL && g->prpl != NULL) 176 if (g != NULL && g->prpl != NULL)
594 } 594 }
595 595
596 } 596 }
597 597
598 if (prpl_info->rename_group) { 598 if (prpl_info->rename_group) {
599 /* prpl's might need to check if the group already 599 /* prpl's might need to check if the group already
600 * exists or not, and handle that differently */ 600 * exists or not, and handle that differently */
601 prpl_info->rename_group(g, old_group->name, new_name, tobemoved); 601 prpl_info->rename_group(g, old_group->name, new_name, tobemoved);
602 } else { 602 } else {
603 serv_remove_buddies(g, tobemoved, old_group->name); 603 serv_remove_buddies(g, tobemoved, old_group->name);
604 serv_add_buddies(g, tobemoved); 604 serv_add_buddies(g, tobemoved);
790 } 790 }
791 791
792 void serv_set_buddyicon(GaimConnection *gc, const char *filename) 792 void serv_set_buddyicon(GaimConnection *gc, const char *filename)
793 { 793 {
794 GaimPluginProtocolInfo *prpl_info = NULL; 794 GaimPluginProtocolInfo *prpl_info = NULL;
795 795
796 if (gc->prpl != NULL) 796 if (gc->prpl != NULL)
797 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 797 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
798 798
799 if (prpl_info && prpl_info->set_buddy_icon) 799 if (prpl_info && prpl_info->set_buddy_icon)
800 prpl_info->set_buddy_icon(gc, filename); 800 prpl_info->set_buddy_icon(gc, filename);
801 801
802 } 802 }
803 803
804 int find_queue_row_by_name(char *name) 804 int find_queue_row_by_name(char *name)
805 { 805 {
806 gchar *temp; 806 gchar *temp;
807 gint i = 0; 807 gint i = 0;
812 while(valid) { 812 while(valid) {
813 gtk_tree_model_get(GTK_TREE_MODEL(awayqueuestore), &iter, 0, &temp, -1); 813 gtk_tree_model_get(GTK_TREE_MODEL(awayqueuestore), &iter, 0, &temp, -1);
814 if(!strcmp(name, temp)) 814 if(!strcmp(name, temp))
815 return i; 815 return i;
816 g_free(temp); 816 g_free(temp);
817 817
818 i++; 818 i++;
819 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(awayqueuestore), &iter); 819 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(awayqueuestore), &iter);
820 } 820 }
821 821
822 return -1; 822 return -1;
931 * this to be queued properly, we have to make sure that the 931 * this to be queued properly, we have to make sure that the
932 * imaway dialog actually exists, first. 932 * imaway dialog actually exists, first.
933 */ 933 */
934 if (!cnv && awayqueue && 934 if (!cnv && awayqueue &&
935 gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) { 935 gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) {
936 /* 936 /*
937 * Alright, so we're going to queue it. Neat, eh? :) 937 * Alright, so we're going to queue it. Neat, eh? :)
938 * So first we create something to store the message, and add 938 * So first we create something to store the message, and add
939 * it to our queue. Then we update the away dialog to indicate 939 * it to our queue. Then we update the away dialog to indicate
940 * that we've queued something. 940 * that we've queued something.
941 */ 941 */
1099 GaimAccount *account; 1099 GaimAccount *account;
1100 GaimConversation *c; 1100 GaimConversation *c;
1101 GaimBuddy *b; 1101 GaimBuddy *b;
1102 GSList *buddies; 1102 GSList *buddies;
1103 int old_idle; 1103 int old_idle;
1104 time_t current_time = time(NULL); 1104 time_t current_time = time(NULL);
1105 int signing_on = 0; 1105 int signing_on = 0;
1106 int signing_off = 0; 1106 int signing_off = 0;
1107 1107
1108 account = gaim_connection_get_account(gc); 1108 account = gaim_connection_get_account(gc);
1109 b = gaim_find_buddy(account, name); 1109 b = gaim_find_buddy(account, name);
1110 1110
1111 if (signon && (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->options & 1111 if (signon && (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->options &
1137 gaim_blist_save(); 1137 gaim_blist_save();
1138 } 1138 }
1139 1139
1140 old_idle = b->idle; 1140 old_idle = b->idle;
1141 1141
1142 if (loggedin) { 1142 if (loggedin) {
1143 if (!GAIM_BUDDY_IS_ONLINE(b)) { 1143 if (!GAIM_BUDDY_IS_ONLINE(b)) {
1144 signing_on = TRUE; 1144 signing_on = TRUE;
1145 } 1145 }
1146 } else if (GAIM_BUDDY_IS_ONLINE(b)) { 1146 } else if (GAIM_BUDDY_IS_ONLINE(b)) {
1147 signing_off = TRUE; 1147 signing_off = TRUE;
1148 } 1148 }
1149 1149
1150 1150
1151 if (signing_on) { 1151 if (signing_on) {
1152 if (gaim_prefs_get_bool("/core/conversations/im/show_login")) { 1152 if (gaim_prefs_get_bool("/core/conversations/im/show_login")) {
1153 if (c != NULL) { 1153 if (c != NULL) {
1170 message_queue = g_slist_append(message_queue, qm); 1170 message_queue = g_slist_append(message_queue, qm);
1171 } 1171 }
1172 } 1172 }
1173 gaim_sound_play_event(GAIM_SOUND_BUDDY_ARRIVE); 1173 gaim_sound_play_event(GAIM_SOUND_BUDDY_ARRIVE);
1174 1174
1175 if(gaim_prefs_get_bool("/core/logging/log_system") && 1175 if(gaim_prefs_get_bool("/core/logging/log_system") &&
1176 gaim_prefs_get_bool("/core/logging/log_signon_signoff")) { 1176 gaim_prefs_get_bool("/core/logging/log_signon_signoff")) {
1177 GaimAccount *account = gaim_connection_get_account(gc); 1177 GaimAccount *account = gaim_connection_get_account(gc);
1178 GaimLog *log = gaim_account_get_log(account); 1178 GaimLog *log = gaim_account_get_log(account);
1179 char *tmp = g_strdup_printf(_("%s signed on"), 1179 char *tmp = g_strdup_printf(_("%s signed on"),
1180 gaim_get_buddy_alias(b)); 1180 gaim_get_buddy_alias(b));
1181 1181
1182 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b), 1182 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b),
1183 current_time, tmp); 1183 current_time, tmp);
1184 g_free(tmp); 1184 g_free(tmp);
1185 } 1185 }
1186 } 1186 }
1187 1187
1188 if(gaim_prefs_get_bool("/core/logging/log_system") && 1188 if(gaim_prefs_get_bool("/core/logging/log_system") &&
1189 gaim_prefs_get_bool("/core/logging/log_away_state")) { 1189 gaim_prefs_get_bool("/core/logging/log_away_state")) {
1190 GaimAccount *account = gaim_connection_get_account(gc); 1190 GaimAccount *account = gaim_connection_get_account(gc);
1191 GaimLog *log = gaim_account_get_log(account); 1191 GaimLog *log = gaim_account_get_log(account);
1192 char *tmp = NULL; 1192 char *tmp = NULL;
1193 1193
1194 if((b->uc & UC_UNAVAILABLE) && !(type & UC_UNAVAILABLE)) 1194 if((b->uc & UC_UNAVAILABLE) && !(type & UC_UNAVAILABLE))
1195 tmp = g_strdup_printf(_("%s came back"), gaim_get_buddy_alias(b)); 1195 tmp = g_strdup_printf(_("%s came back"), gaim_get_buddy_alias(b));
1196 else if(!(b->uc & UC_UNAVAILABLE) && (type & UC_UNAVAILABLE)) 1196 else if(!(b->uc & UC_UNAVAILABLE) && (type & UC_UNAVAILABLE))
1197 tmp = g_strdup_printf(_("%s went away"), gaim_get_buddy_alias(b)); 1197 tmp = g_strdup_printf(_("%s went away"), gaim_get_buddy_alias(b));
1198 1198
1199 if(tmp){ 1199 if(tmp){
1200 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b), 1200 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b),
1201 current_time, tmp); 1201 current_time, tmp);
1202 g_free(tmp); 1202 g_free(tmp);
1203 } 1203 }
1204 } 1204 }
1205 1205
1206 if (!old_idle && idle) { 1206 if (!old_idle && idle) {
1207 gaim_signal_emit(gaim_blist_get_handle(), "buddy-idle", b); 1207 gaim_signal_emit(gaim_blist_get_handle(), "buddy-idle", b);
1208 if(gaim_prefs_get_bool("/core/logging/log_system") && 1208 if(gaim_prefs_get_bool("/core/logging/log_system") &&
1209 gaim_prefs_get_bool("/core/logging/log_idle_state")) { 1209 gaim_prefs_get_bool("/core/logging/log_idle_state")) {
1210 GaimAccount *account = gaim_connection_get_account(gc); 1210 GaimAccount *account = gaim_connection_get_account(gc);
1211 GaimLog *log = gaim_account_get_log(account); 1211 GaimLog *log = gaim_account_get_log(account);
1212 char *tmp = g_strdup_printf(_("%s became idle"), 1212 char *tmp = g_strdup_printf(_("%s became idle"),
1213 gaim_get_buddy_alias(b)); 1213 gaim_get_buddy_alias(b));
1214 1214
1215 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b), 1215 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b),
1216 current_time, tmp); 1216 current_time, tmp);
1217 g_free(tmp); 1217 g_free(tmp);
1218 } 1218 }
1219 } else if (old_idle && !idle) { 1219 } else if (old_idle && !idle) {
1220 gaim_signal_emit(gaim_blist_get_handle(), "buddy-unidle", b); 1220 gaim_signal_emit(gaim_blist_get_handle(), "buddy-unidle", b);
1221 1221
1222 if(gaim_prefs_get_bool("/core/logging/log_system") && 1222 if(gaim_prefs_get_bool("/core/logging/log_system") &&
1223 gaim_prefs_get_bool("/core/logging/log_idle_state")) { 1223 gaim_prefs_get_bool("/core/logging/log_idle_state")) {
1224 GaimAccount *account = gaim_connection_get_account(gc); 1224 GaimAccount *account = gaim_connection_get_account(gc);
1225 GaimLog *log = gaim_account_get_log(account); 1225 GaimLog *log = gaim_account_get_log(account);
1226 char *tmp = g_strdup_printf(_("%s became unidle"), 1226 char *tmp = g_strdup_printf(_("%s became unidle"),
1227 gaim_get_buddy_alias(b)); 1227 gaim_get_buddy_alias(b));
1228 1228
1229 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b), 1229 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b),
1230 current_time, tmp); 1230 current_time, tmp);
1231 g_free(tmp); 1231 g_free(tmp);
1232 } 1232 }
1233 } 1233 }
1234 1234
1235 if (signing_off) { 1235 if (signing_off) {
1236 if (gaim_prefs_get_bool("/core/conversations/im/show_login")) { 1236 if (gaim_prefs_get_bool("/core/conversations/im/show_login")) {
1237 if (c != NULL) { 1237 if (c != NULL) {
1253 } 1253 }
1254 } 1254 }
1255 serv_got_typing_stopped(gc, name); /* obviously not typing */ 1255 serv_got_typing_stopped(gc, name); /* obviously not typing */
1256 gaim_sound_play_event(GAIM_SOUND_BUDDY_LEAVE); 1256 gaim_sound_play_event(GAIM_SOUND_BUDDY_LEAVE);
1257 1257
1258 if(gaim_prefs_get_bool("/core/logging/log_system") && 1258 if(gaim_prefs_get_bool("/core/logging/log_system") &&
1259 gaim_prefs_get_bool("/core/logging/log_signon_signoff")) { 1259 gaim_prefs_get_bool("/core/logging/log_signon_signoff")) {
1260 GaimAccount *account = gaim_connection_get_account(gc); 1260 GaimAccount *account = gaim_connection_get_account(gc);
1261 GaimLog *log = gaim_account_get_log(account); 1261 GaimLog *log = gaim_account_get_log(account);
1262 char *tmp = g_strdup_printf(_("%s signed off"), 1262 char *tmp = g_strdup_printf(_("%s signed off"),
1263 gaim_get_buddy_alias(b)); 1263 gaim_get_buddy_alias(b));
1264 1264
1265 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b), 1265 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, gaim_get_buddy_alias(b),
1266 current_time, tmp); 1266 current_time, tmp);
1267 g_free(tmp); 1267 g_free(tmp);
1268 } 1268 }
1269 } 1269 }
1270 1270
1271 if (gc->login_time_official && gc->login_time) 1271 if (gc->login_time_official && gc->login_time)
1272 signon += gc->login_time_official - gc->login_time; 1272 signon += gc->login_time_official - gc->login_time;
1273 gaim_blist_update_buddy_signon(b, signon); 1273 gaim_blist_update_buddy_signon(b, signon);