Mercurial > pidgin.yaz
comparison src/away.c @ 1254:9da444224f0e
[gaim-migrate @ 1264]
bmiller's away-on-signon patch. does --away=mesg use "mesg" or the away message titled "mesg"? i didn't look hehe. but if it uses "mesg" instead of the away message titled "mesg" then i'm not sure it works.... i figured someone would report a bug if it didn't work
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 14 Dec 2000 00:11:59 +0000 |
parents | b5783215b245 |
children | 07f0bb41bbe1 |
comparison
equal
deleted
inserted
replaced
1253:8342d3aab1f1 | 1254:9da444224f0e |
---|---|
38 | 38 |
39 GtkWidget *imaway = NULL; | 39 GtkWidget *imaway = NULL; |
40 | 40 |
41 GtkWidget *awaymenu = NULL; | 41 GtkWidget *awaymenu = NULL; |
42 struct away_message *awaymessage = NULL; | 42 struct away_message *awaymessage = NULL; |
43 int default_away; | 43 struct away_message *default_away; |
44 int auto_away; | 44 int auto_away; |
45 | 45 |
46 static void destroy_im_away() | 46 static void destroy_im_away() |
47 { | 47 { |
48 if (imaway) | 48 if (imaway) |
99 char buf[BUF_LONG]; | 99 char buf[BUF_LONG]; |
100 GList *cnv = conversations; | 100 GList *cnv = conversations; |
101 struct conversation *c; | 101 struct conversation *c; |
102 | 102 |
103 if (!blist) | 103 if (!blist) |
104 return; | |
105 | |
106 if (!a) | |
104 return; | 107 return; |
105 | 108 |
106 #ifdef USE_APPLET | 109 #ifdef USE_APPLET |
107 remove_applet_away(); | 110 remove_applet_away(); |
108 applet_widget_register_callback(APPLET_WIDGET(applet), | 111 applet_widget_register_callback(APPLET_WIDGET(applet), |
179 plugin_event(event_away, 0, 0, 0, 0); | 182 plugin_event(event_away, 0, 0, 0, 0); |
180 } | 183 } |
181 | 184 |
182 void rem_away_mess(GtkWidget *w, struct away_message *a) | 185 void rem_away_mess(GtkWidget *w, struct away_message *a) |
183 { | 186 { |
184 struct away_message *default_msg; | 187 int default_index; |
185 #ifdef USE_APPLET | 188 #ifdef USE_APPLET |
186 char *awayname; | 189 char *awayname; |
187 awayname = g_malloc(sizeof(*awayname) * (6 + strlen(a->name))); | 190 awayname = g_malloc(sizeof(*awayname) * (6 + strlen(a->name))); |
188 awayname[0] = '\0'; | 191 awayname[0] = '\0'; |
189 strcat(awayname, "away/"); | 192 strcat(awayname, "away/"); |
190 strcat(awayname, a->name); | 193 strcat(awayname, a->name); |
191 applet_widget_unregister_callback(APPLET_WIDGET(applet), awayname); | 194 applet_widget_unregister_callback(APPLET_WIDGET(applet), awayname); |
192 g_free(awayname); | 195 g_free(awayname); |
193 #endif | 196 #endif |
194 default_msg = g_slist_nth_data(away_messages, default_away); | 197 default_index = g_slist_index(away_messages, default_away); |
195 away_messages = g_slist_remove(away_messages, a); | 198 if (default_index == -1) { |
196 default_away = g_slist_index(away_messages, default_msg); | 199 if (away_messages != NULL) |
197 if (default_away == -1) | 200 default_away = away_messages->data; |
198 default_away = 0; | 201 else |
202 default_away = NULL; | |
203 } | |
199 g_free(a); | 204 g_free(a); |
200 do_away_menu(); | 205 do_away_menu(); |
201 save_prefs(); | 206 save_prefs(); |
202 } | 207 } |
203 | 208 |