| 90 if (gaim_prefs_get_bool("/core/away/away_when_idle") && |
90 if (gaim_prefs_get_bool("/core/away/away_when_idle") && |
| 91 (idle_time > (60 * gaim_prefs_get_int("/core/away/mins_before_away"))) |
91 (idle_time > (60 * gaim_prefs_get_int("/core/away/mins_before_away"))) |
| 92 && (!gc->is_auto_away)) { |
92 && (!gc->is_auto_away)) { |
| 93 |
93 |
| 94 if (!gc->away) { |
94 if (!gc->away) { |
| |
95 struct away_message *default_away = NULL; |
| |
96 const char *default_name; |
| |
97 GSList *l; |
| |
98 |
| |
99 default_name = gaim_prefs_get_string("/core/away/default_message"); |
| |
100 |
| |
101 for(l = away_messages; l; l = l->next) { |
| |
102 if(!strcmp(default_name, ((struct away_message *)l->data)->name)) { |
| |
103 default_away = l->data; |
| |
104 break; |
| |
105 } |
| |
106 } |
| |
107 |
| |
108 if(!default_away && away_messages) |
| |
109 default_away = away_messages->data; |
| |
110 |
| 95 gaim_debug(GAIM_DEBUG_INFO, "idle", |
111 gaim_debug(GAIM_DEBUG_INFO, "idle", |
| 96 "Making %s away automatically\n", |
112 "Making %s away automatically\n", |
| 97 gaim_account_get_username(account)); |
113 gaim_account_get_username(account)); |
| 98 if (g_list_length(gaim_connections_get_all()) == 1) |
114 if (g_list_length(gaim_connections_get_all()) == 1) |
| 99 do_away_message(NULL, default_away); |
115 do_away_message(NULL, default_away); |
| 100 else if (default_away) |
116 else if (default_away) |
| 101 serv_set_away(gc, GAIM_AWAY_CUSTOM, default_away->message); |
117 serv_set_away(gc, GAIM_AWAY_CUSTOM, default_away->message); |
| 102 gc->is_auto_away = 1; |
118 gc->is_auto_away = 1; |
| 103 set_default_away(NULL, (gpointer)g_slist_index(away_messages, default_away)); |
|
| 104 } else |
119 } else |
| 105 gc->is_auto_away = 2; |
120 gc->is_auto_away = 2; |
| 106 } else if (gc->is_auto_away && |
121 } else if (gc->is_auto_away && |
| 107 idle_time < 60 * gaim_prefs_get_int("/core/away/mins_before_away")) { |
122 idle_time < 60 * gaim_prefs_get_int("/core/away/mins_before_away")) { |
| 108 if (gc->is_auto_away == 2) { |
123 if (gc->is_auto_away == 2) { |