|
|
1.1 root 1: #include <gtk/gtk.h>
2: #include <glade/glade.h>
3:
4: #include "sbbs.h"
5: #include "dirwrap.h"
6: #include "xpbeep.h"
7: #include "datewrap.h"
8: #include "semwrap.h"
9:
10: #include "gtkuseredit.h"
11:
12: /*
13: * Sets the save buttons sensitive.
14: */
15: void user_changed(GtkWidget *wiggy, gpointer data)
16: {
17: GtkWidget *w;
18:
19: w=glade_xml_get_widget(xml, "bSaveUser");
20: if(w==NULL)
21: fprintf(stderr,"Cannot get the save user button widget\n");
22: else
23: gtk_widget_set_sensitive(GTK_WIDGET(w),TRUE);
24: w=glade_xml_get_widget(xml, "save1");
25: if(w==NULL)
26: fprintf(stderr,"Cannot get the save user menu widget\n");
27: else
28: gtk_widget_set_sensitive(GTK_WIDGET(w),TRUE);
29: }
30:
31: /*
32: * Prevents anything but digits from being entered into an input box
33: */
34: void digit_insert_text_handler (GtkEntry *entry, const gchar *text, gint length, gint *position, gpointer data)
35: {
36: GtkEditable *editable = GTK_EDITABLE(entry);
37: int i, count=0, beep=0;
38: gchar *result = g_new (gchar, length);
39:
40: for (i=0; i < length; i++) {
41: if (!isdigit(text[i])) {
42: beep=1;
43: continue;
44: }
45: result[count++] = text[i];
46: }
47:
48: if (count > 0) {
49: g_signal_handlers_block_by_func (G_OBJECT (editable)
50: ,G_CALLBACK (digit_insert_text_handler)
51: ,data);
52: gtk_editable_insert_text (editable, result, count, position);
53: g_signal_handlers_unblock_by_func (G_OBJECT (editable)
54: ,G_CALLBACK (digit_insert_text_handler)
55: ,data);
56: }
57: if(beep)
58: BEEP(440,100);
59:
60: g_signal_stop_emission_by_name (G_OBJECT (editable), "insert_text");
61:
62: g_free (result);
63: }
64:
65: /*
66: * This is one of the two big gruntwork functions
67: * (the other being save_user)
68: */
69: void load_user(GtkWidget *wiggy, gpointer data)
70: {
71: GtkWidget *w;
72: char str[1024];
73: gboolean b;
74: int i;
75: FILE *f;
76: GtkTextIter start;
77: GtkTextIter end;
78:
79: if(current_user != 0) {
80: user.number=current_user;
81: if(user.number < 1 || user.number > totalusers) {
82: fprintf(stderr,"Attempted to load illegal user number %d.\n",user.number);
83: return;
84: }
85: if(getuserdat(&cfg, &user)) {
86: fprintf(stderr,"Error loading user %d.\n",current_user);
87: return;
88: }
89: }
90:
91: /* Toolbar indicators */
92: b=user.misc&DELETED?TRUE:FALSE;
93: w=glade_xml_get_widget(xml, "bDelete");
94: if(w==NULL)
95: fprintf(stderr,"Cannot get the deleted toolbar widget\n");
96: else
97: gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(w),b);
98: w=glade_xml_get_widget(xml, "delete1");
99: if(w==NULL)
100: fprintf(stderr,"Cannot get the deleted menu widget\n");
101: else
102: gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w),b);
103:
104: b=user.misc&INACTIVE?TRUE:FALSE;
105: w=glade_xml_get_widget(xml, "bRemove");
106: if(w==NULL)
107: fprintf(stderr,"Cannot get the removed toolbar widget\n");
108: else
109: gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(w),b);
110: w=glade_xml_get_widget(xml, "remove1");
111: if(w==NULL)
112: fprintf(stderr,"Cannot get the remove menu widget\n");
113: else
114: gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w),b);
115:
116:
117: /* Peronal Tab */
118: /* Alias */
119: w=glade_xml_get_widget(xml, "eUserAlias");
120: if(w==NULL)
121: fprintf(stderr,"Cannot get the alias widget\n");
122: else
123: gtk_entry_set_text(GTK_ENTRY(w),user.alias);
124:
125: /* Real Name */
126: w=glade_xml_get_widget(xml, "eRealName");
127: if(w==NULL)
128: fprintf(stderr,"Cannot get the real name widget\n");
129: else
130: gtk_entry_set_text(GTK_ENTRY(w),user.name);
131:
132: /* Computer */
133: w=glade_xml_get_widget(xml, "eComputer");
134: if(w==NULL)
135: fprintf(stderr,"Cannot get the computer widget\n");
136: else
137: gtk_entry_set_text(GTK_ENTRY(w),user.comp);
138:
139: /* NetMail */
140: w=glade_xml_get_widget(xml, "eNetMail");
141: if(w==NULL)
142: fprintf(stderr,"Cannot get the netmail widget\n");
143: else
144: gtk_entry_set_text(GTK_ENTRY(w),user.netmail);
145:
146: /* Phone */
147: w=glade_xml_get_widget(xml, "ePhone");
148: if(w==NULL)
149: fprintf(stderr,"Cannot get the phone widget\n");
150: else
151: gtk_entry_set_text(GTK_ENTRY(w),user.phone);
152:
153: /* Note */
154: w=glade_xml_get_widget(xml, "eNote");
155: if(w==NULL)
156: fprintf(stderr,"Cannot get the note widget\n");
157: else
158: gtk_entry_set_text(GTK_ENTRY(w),user.note);
159:
160: /* Comment */
161: w=glade_xml_get_widget(xml, "eComment");
162: if(w==NULL)
163: fprintf(stderr,"Cannot get the comment widget\n");
164: else
165: gtk_entry_set_text(GTK_ENTRY(w),user.comment);
166:
167: /* Gender */
168: w=glade_xml_get_widget(xml, "eGender");
169: if(w==NULL)
170: fprintf(stderr,"Cannot get the gender widget\n");
171: else {
172: str[0]=user.sex;
173: str[1]=0;
174: gtk_entry_set_text(GTK_ENTRY(w),str);
175: }
176:
177: /* Connection */
178: w=glade_xml_get_widget(xml, "eConnection");
179: if(w==NULL)
180: fprintf(stderr,"Cannot get the connection widget\n");
181: else
182: gtk_entry_set_text(GTK_ENTRY(w),user.modem);
183:
184: /* Chat Handle */
185: w=glade_xml_get_widget(xml, "eHandle");
186: if(w==NULL)
187: fprintf(stderr,"Cannot get the handle widget\n");
188: else
189: gtk_entry_set_text(GTK_ENTRY(w),user.handle);
190:
191: /* Birthdate */
192: w=glade_xml_get_widget(xml, "eBirthdate");
193: if(w==NULL)
194: fprintf(stderr,"Cannot get the birthdate widget\n");
195: else
196: gtk_entry_set_text(GTK_ENTRY(w),user.birth);
197:
198: /* Password */
199: w=glade_xml_get_widget(xml, "ePassword");
200: if(w==NULL)
201: fprintf(stderr,"Cannot get the password widget\n");
202: else
203: gtk_entry_set_text(GTK_ENTRY(w),user.pass);
204:
205: /* Address */
206: w=glade_xml_get_widget(xml, "eAddress");
207: if(w==NULL)
208: fprintf(stderr,"Cannot get the address widget\n");
209: else
210: gtk_entry_set_text(GTK_ENTRY(w),user.address);
211:
212: /* Location */
213: w=glade_xml_get_widget(xml, "eLocation");
214: if(w==NULL)
215: fprintf(stderr,"Cannot get the location widget\n");
216: else
217: gtk_entry_set_text(GTK_ENTRY(w),user.location);
218:
219: /* Postal/ZIP code */
220: w=glade_xml_get_widget(xml, "eZip");
221: if(w==NULL)
222: fprintf(stderr,"Cannot get the postal/zip code widget\n");
223: else
224: gtk_entry_set_text(GTK_ENTRY(w),user.zipcode);
225:
226: /* Security Tab */
227: /* Level */
228: w=glade_xml_get_widget(xml, "sLevel");
229: if(w==NULL)
230: fprintf(stderr,"Cannot get the level widget\n");
231: else
232: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.level);
233:
234: /* Expiration */
235: w=glade_xml_get_widget(xml, "eExpiration");
236: if(w==NULL)
237: fprintf(stderr,"Cannot get the expiration widget\n");
238: else {
239: if(user.expire)
240: unixtodstr(&cfg, user.expire, str);
241: else
242: strcpy(str,"Never");
243: gtk_entry_set_text(GTK_ENTRY(w),str);
244: }
245:
246: /* Flag Sets */
247: strcpy(str,"tFlagSet1.");
248: for(i=0;i<26;i++) {
249: str[9]='A'+i;
250: w=glade_xml_get_widget(xml, str);
251: if(w==NULL)
252: fprintf(stderr,"Cannot get the %s widget\n",str);
253: else {
254: b = (user.flags1 & (1L << i)) != 0;
255: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),b);
256: }
257: }
258:
259: strcpy(str,"tFlagSet2.");
260: for(i=0;i<26;i++) {
261: str[9]='A'+i;
262: w=glade_xml_get_widget(xml, str);
263: if(w==NULL)
264: fprintf(stderr,"Cannot get the %s widget\n",str);
265: else {
266: b = (user.flags2 & (1L << i)) != 0;
267: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),b);
268: }
269: }
270:
271: strcpy(str,"tFlagSet3.");
272: for(i=0;i<26;i++) {
273: str[9]='A'+i;
274: w=glade_xml_get_widget(xml, str);
275: if(w==NULL)
276: fprintf(stderr,"Cannot get the %s widget\n",str);
277: else {
278: b = (user.flags3 & (1L << i)) != 0;
279: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),b);
280: }
281: }
282:
283: strcpy(str,"tFlagSet4.");
284: for(i=0;i<26;i++) {
285: str[9]='A'+i;
286: w=glade_xml_get_widget(xml, str);
287: if(w==NULL)
288: fprintf(stderr,"Cannot get the %s widget\n",str);
289: else {
290: b = (user.flags4 & (1L << i)) != 0;
291: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),b);
292: }
293: }
294:
295: /* Exemptions */
296: strcpy(str,"tExemptions.");
297: for(i=0;i<26;i++) {
298: str[11]='A'+i;
299: w=glade_xml_get_widget(xml, str);
300: if(w==NULL)
301: fprintf(stderr,"Cannot get the %s widget\n",str);
302: else {
303: b = (user.exempt & (1L << i)) != 0;
304: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),b);
305: }
306: }
307:
308: /* Restrictions */
309: strcpy(str,"tRestrictions.");
310: for(i=0;i<26;i++) {
311: str[13]='A'+i;
312: w=glade_xml_get_widget(xml, str);
313: if(w==NULL)
314: fprintf(stderr,"Cannot get the %s widget\n",str);
315: else {
316: b = (user.rest & (1L << i)) != 0;
317: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),b);
318: }
319: }
320:
321: /* Credits */
322: w=glade_xml_get_widget(xml, "sCredits");
323: if(w==NULL)
324: fprintf(stderr,"Cannot get the credits widget\n");
325: else
326: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.cdt);
327:
328: /* Free Credits */
329: w=glade_xml_get_widget(xml, "sFreeCredits");
330: if(w==NULL)
331: fprintf(stderr,"Cannot get the free credits widget\n");
332: else
333: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.freecdt);
334:
335: /* Minutes */
336: w=glade_xml_get_widget(xml, "sMinutes");
337: if(w==NULL)
338: fprintf(stderr,"Cannot get the minutes widget\n");
339: else
340: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.min);
341:
342: /* Statistics */
343: /* First On */
344: w=glade_xml_get_widget(xml, "eFirstOn");
345: if(w==NULL)
346: fprintf(stderr,"Cannot get the first on widget\n");
347: else {
348: if(user.firston)
349: unixtodstr(&cfg, user.firston, str);
350: else
351: strcpy(str,"Never");
352: gtk_entry_set_text(GTK_ENTRY(w),str);
353: }
354:
355: /* Last On */
356: w=glade_xml_get_widget(xml, "eLastOn");
357: if(w==NULL)
358: fprintf(stderr,"Cannot get the last on widget\n");
359: else {
360: if(user.laston)
361: unixtodstr(&cfg, user.laston, str);
362: else
363: strcpy(str,"Never");
364: gtk_entry_set_text(GTK_ENTRY(w),str);
365: }
366:
367: /* Total Logons */
368: w=glade_xml_get_widget(xml, "sLogonsTotal");
369: if(w==NULL)
370: fprintf(stderr,"Cannot get the total logons widget\n");
371: else
372: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.logons);
373:
374: /* Logons today */
375: w=glade_xml_get_widget(xml, "sLogonsToday");
376: if(w==NULL)
377: fprintf(stderr,"Cannot get the logons today widget\n");
378: else
379: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.ltoday);
380:
381: /* Total Posts */
382: w=glade_xml_get_widget(xml, "sTotalPosts");
383: if(w==NULL)
384: fprintf(stderr,"Cannot get the total posts widget\n");
385: else
386: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.posts);
387:
388: /* Posts Today */
389: w=glade_xml_get_widget(xml, "sPostsToday");
390: if(w==NULL)
391: fprintf(stderr,"Cannot get the posts today widget\n");
392: else
393: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.ptoday);
394:
395: /* Total Uploads */
396: w=glade_xml_get_widget(xml, "sTotalUploads");
397: if(w==NULL)
398: fprintf(stderr,"Cannot get the total uploads widget\n");
399: else
400: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.uls);
401:
402: /* Upload Bytes */
403: w=glade_xml_get_widget(xml, "sUploadBytes");
404: if(w==NULL)
405: fprintf(stderr,"Cannot get the upload bytes widget\n");
406: else
407: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.ulb);
408:
409: /* Total Time On */
410: w=glade_xml_get_widget(xml, "sTotalTimeOn");
411: if(w==NULL)
412: fprintf(stderr,"Cannot get the total time on widget\n");
413: else
414: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.timeon);
415:
416: /* Time On Today */
417: w=glade_xml_get_widget(xml, "sTimeOnToday");
418: if(w==NULL)
419: fprintf(stderr,"Cannot get the time on today widget\n");
420: else
421: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.ttoday);
422:
423: /* Time On Last Call */
424: w=glade_xml_get_widget(xml, "sTimeOnLastCall");
425: if(w==NULL)
426: fprintf(stderr,"Cannot get the last call time on widget\n");
427: else
428: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.tlast);
429:
430: /* Time On Extra */
431: w=glade_xml_get_widget(xml, "sTimeOnExtra");
432: if(w==NULL)
433: fprintf(stderr,"Cannot get the extra time on widget\n");
434: else
435: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.textra);
436:
437: /* Total Downloads */
438: w=glade_xml_get_widget(xml, "sDownloadsTotal");
439: if(w==NULL)
440: fprintf(stderr,"Cannot get the total downloads widget\n");
441: else
442: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.dls);
443:
444: /* Download Bytes */
445: w=glade_xml_get_widget(xml, "sDownloadsBytes");
446: if(w==NULL)
447: fprintf(stderr,"Cannot get the download bytes widget\n");
448: else
449: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.dlb);
450:
451: /* Download Leeches */
452: w=glade_xml_get_widget(xml, "sDownloadsLeech");
453: if(w==NULL)
454: fprintf(stderr,"Cannot get the downloads leech widget\n");
455: else
456: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.leech);
457:
458: /* Total Email */
459: w=glade_xml_get_widget(xml, "sEmailTotal");
460: if(w==NULL)
461: fprintf(stderr,"Cannot get the total email widget\n");
462: else
463: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.emails);
464:
465: /* Email Today */
466: w=glade_xml_get_widget(xml, "sEmailToday");
467: if(w==NULL)
468: fprintf(stderr,"Cannot get the email today widget\n");
469: else
470: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.etoday);
471:
472: /* Email To Sysop */
473: w=glade_xml_get_widget(xml, "sEmailToSysop");
474: if(w==NULL)
475: fprintf(stderr,"Cannot get the email to sysop widget\n");
476: else
477: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.fbacks);
478:
479: /* Settings */
480: w=glade_xml_get_widget(xml, "cUserAUTOTERM");
481: if(w==NULL)
482: fprintf(stderr,"Cannot get the autoterm widget\n");
483: else
484: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&AUTOTERM);
485:
486: w=glade_xml_get_widget(xml, "cUserNO_EXASCII");
487: if(w==NULL)
488: fprintf(stderr,"Cannot get the no exascii widget\n");
489: else
490: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&NO_EXASCII);
491:
492: w=glade_xml_get_widget(xml, "cUserANSI");
493: if(w==NULL)
494: fprintf(stderr,"Cannot get the ansi widget\n");
495: else
496: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&ANSI);
497:
498: w=glade_xml_get_widget(xml, "cUserCOLOR");
499: if(w==NULL)
500: fprintf(stderr,"Cannot get the color widget\n");
501: else
502: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&COLOR);
503:
504: w=glade_xml_get_widget(xml, "cUserRIP");
505: if(w==NULL)
506: fprintf(stderr,"Cannot get the RIP widget\n");
507: else
508: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&RIP);
509:
510: w=glade_xml_get_widget(xml, "cUserWIP");
511: if(w==NULL)
512: fprintf(stderr,"Cannot get the WIP widget\n");
513: else
514: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&WIP);
515:
516: w=glade_xml_get_widget(xml, "cUserUPAUSE");
517: if(w==NULL)
518: fprintf(stderr,"Cannot get the upause widget\n");
519: else
520: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&UPAUSE);
521:
522: w=glade_xml_get_widget(xml, "cUserCOLDKEYS");
523: if(w==NULL)
524: fprintf(stderr,"Cannot get the coldkeys widget\n");
525: else
526: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&COLDKEYS);
527:
528: w=glade_xml_get_widget(xml, "cUserSPIN");
529: if(w==NULL)
530: fprintf(stderr,"Cannot get the spin widget\n");
531: else
532: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&SPIN);
533:
534: w=glade_xml_get_widget(xml, "cUserRIP");
535: if(w==NULL)
536: fprintf(stderr,"Cannot get the RIP widget\n");
537: else
538: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&RIP);
539:
540: w=glade_xml_get_widget(xml, "sRows");
541: if(w==NULL)
542: fprintf(stderr,"Cannot get the rows widget\n");
543: else
544: gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),user.rows);
545:
546: w=glade_xml_get_widget(xml, "cCommandShell");
547: if(w==NULL)
548: fprintf(stderr,"Cannot get the command shell widget\n");
549: else
550: gtk_combo_box_set_active(GTK_COMBO_BOX(w),user.shell);
551:
552: w=glade_xml_get_widget(xml, "cUserEXPERT");
553: if(w==NULL)
554: fprintf(stderr,"Cannot get the expert widget\n");
555: else
556: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&EXPERT);
557:
558: w=glade_xml_get_widget(xml, "cUserASK_NSCAN");
559: if(w==NULL)
560: fprintf(stderr,"Cannot get the ask new scan widget\n");
561: else
562: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&ASK_NSCAN);
563:
564: w=glade_xml_get_widget(xml, "cUserASK_SSCAN");
565: if(w==NULL)
566: fprintf(stderr,"Cannot get the ask to you scan widget\n");
567: else
568: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&ASK_SSCAN);
569:
570: w=glade_xml_get_widget(xml, "cUserCURSUB");
571: if(w==NULL)
572: fprintf(stderr,"Cannot get the save current sub widget\n");
573: else
574: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&CURSUB);
575:
576: w=glade_xml_get_widget(xml, "cUserQUIET");
577: if(w==NULL)
578: fprintf(stderr,"Cannot get the quiet mode widget\n");
579: else
580: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&QUIET);
581:
582: w=glade_xml_get_widget(xml, "cUserAUTOLOGON");
583: if(w==NULL)
584: fprintf(stderr,"Cannot get the auto logon widget\n");
585: else
586: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&AUTOLOGON);
587:
588: w=glade_xml_get_widget(xml, "cUserEXPERT");
589: if(w==NULL)
590: fprintf(stderr,"Cannot get the expert widget\n");
591: else
592: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&EXPERT);
593:
594: w=glade_xml_get_widget(xml, "cUserCHAT_ECHO");
595: if(w==NULL)
596: fprintf(stderr,"Cannot get the chat echo widget\n");
597: else
598: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.chat&CHAT_ECHO);
599:
600: w=glade_xml_get_widget(xml, "cUserCHAT_ACTION");
601: if(w==NULL)
602: fprintf(stderr,"Cannot get the chat action widget\n");
603: else
604: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.chat&CHAT_ACTION);
605:
606: w=glade_xml_get_widget(xml, "cUserCHAT_NOPAGE");
607: if(w==NULL)
608: fprintf(stderr,"Cannot get the chat nopage widget\n");
609: else
610: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.chat&CHAT_NOPAGE);
611:
612: w=glade_xml_get_widget(xml, "cUserCHAT_NOACT");
613: if(w==NULL)
614: fprintf(stderr,"Cannot get the chat no activity widget\n");
615: else
616: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.chat&CHAT_NOACT);
617:
618: w=glade_xml_get_widget(xml, "cUserCHAT_SPLITP");
619: if(w==NULL)
620: fprintf(stderr,"Cannot get the chat split personal widget\n");
621: else
622: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.chat&CHAT_SPLITP);
623:
624: /* Msg/File Settings */
625:
626: w=glade_xml_get_widget(xml, "cUserNETMAIL");
627: if(w==NULL)
628: fprintf(stderr,"Cannot get the netmail widget\n");
629: else
630: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&NETMAIL);
631:
632: w=glade_xml_get_widget(xml, "cUserCLRSCRN");
633: if(w==NULL)
634: fprintf(stderr,"Cannot get the clear screen widget\n");
635: else
636: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&CLRSCRN);
637:
638: w=glade_xml_get_widget(xml, "cUserANFSCAN");
639: if(w==NULL)
640: fprintf(stderr,"Cannot get the ask new file scan widget\n");
641: else
642: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&ANFSCAN);
643:
644: w=glade_xml_get_widget(xml, "cUserEXTDESC");
645: if(w==NULL)
646: fprintf(stderr,"Cannot get the extended descriptions widget\n");
647: else
648: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&EXTDESC);
649:
650: w=glade_xml_get_widget(xml, "cUserBATCHFLAG");
651: if(w==NULL)
652: fprintf(stderr,"Cannot get the batch flagging widget\n");
653: else
654: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&BATCHFLAG);
655:
656: w=glade_xml_get_widget(xml, "cUserAUTOHANG");
657: if(w==NULL)
658: fprintf(stderr,"Cannot get the auto hangup after transfer widget\n");
659: else
660: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&AUTOHANG);
661:
662: w=glade_xml_get_widget(xml, "cUserCLRSCRN");
663: if(w==NULL)
664: fprintf(stderr,"Cannot get the clear screen widget\n");
665: else
666: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.misc&CLRSCRN);
667:
668: w=glade_xml_get_widget(xml, "cExternalEditor");
669: if(w==NULL)
670: fprintf(stderr,"Cannot get the external editor widget\n");
671: else
672: gtk_combo_box_set_active(GTK_COMBO_BOX(w),user.xedit);
673:
674: w=glade_xml_get_widget(xml, "cDefaultDownloadProtocol");
675: if(w==NULL)
676: fprintf(stderr,"Cannot get the default download protocol widget\n");
677: else {
678: gtk_combo_box_set_active(GTK_COMBO_BOX(w),0);
679: for(i=0;i<cfg.total_prots;i++) {
680: if(cfg.prot[i]->mnemonic==user.prot) {
681: gtk_combo_box_set_active(GTK_COMBO_BOX(w),i+1);
682: break;
683: }
684: }
685: }
686:
687: w=glade_xml_get_widget(xml, "cTempQWKFileType");
688: if(w==NULL)
689: fprintf(stderr,"Cannot get the temp QWK file type widget\n");
690: else {
691: gtk_combo_box_set_active(GTK_COMBO_BOX(w),-1);
692: for(i=0;i<cfg.total_fcomps;i++) {
693: if(!stricmp(cfg.fcomp[i]->ext,user.tmpext)) {
694: gtk_combo_box_set_active(GTK_COMBO_BOX(w),i);
695: break;
696: }
697: }
698: }
699:
700: w=glade_xml_get_widget(xml, "cUserQWK_FILES");
701: if(w==NULL)
702: fprintf(stderr,"Cannot get the include new files list widget\n");
703: else
704: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.qwk&QWK_FILES);
705:
706: w=glade_xml_get_widget(xml, "cUserQWK_EMAIL");
707: if(w==NULL)
708: fprintf(stderr,"Cannot get the include unread email widget\n");
709: else
710: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.qwk&QWK_EMAIL);
711:
712: w=glade_xml_get_widget(xml, "cUserQWK_ALLMAIL");
713: if(w==NULL)
714: fprintf(stderr,"Cannot get the include all email widget\n");
715: else
716: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.qwk&QWK_ALLMAIL);
717:
718: w=glade_xml_get_widget(xml, "cUserQWK_DELMAIL");
719: if(w==NULL)
720: fprintf(stderr,"Cannot get the delete email widget\n");
721: else
722: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.qwk&QWK_DELMAIL);
723:
724: w=glade_xml_get_widget(xml, "cUserQWK_BYSELF");
725: if(w==NULL)
726: fprintf(stderr,"Cannot get the include messages by self widget\n");
727: else
728: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.qwk&QWK_BYSELF);
729:
730: w=glade_xml_get_widget(xml, "cUserQWK_EXPCTLA");
731: if(w==NULL)
732: fprintf(stderr,"Cannot get the expand ctrl-a widget\n");
733: else
734: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.qwk&QWK_EXPCTLA);
735:
736: w=glade_xml_get_widget(xml, "cUserQWK_RETCTLA");
737: if(w==NULL)
738: fprintf(stderr,"Cannot get the retain ctrl-a widget\n");
739: else
740: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.qwk&QWK_RETCTLA);
741:
742: w=glade_xml_get_widget(xml, "cUserQWK_ATTACH");
743: if(w==NULL)
744: fprintf(stderr,"Cannot get the include attachments widget\n");
745: else
746: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.qwk&QWK_ATTACH);
747:
748: w=glade_xml_get_widget(xml, "cUserQWK_NOINDEX");
749: if(w==NULL)
750: fprintf(stderr,"Cannot get the don't include index files widget\n");
751: else
752: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.qwk&QWK_NOINDEX);
753:
754: w=glade_xml_get_widget(xml, "cUserQWK_TZ");
755: if(w==NULL)
756: fprintf(stderr,"Cannot get the include TZ widget\n");
757: else
758: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.qwk&QWK_TZ);
759:
760: w=glade_xml_get_widget(xml, "cUserQWK_VIA");
761: if(w==NULL)
762: fprintf(stderr,"Cannot get the include VIA widget\n");
763: else
764: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.qwk&QWK_VIA);
765:
766: w=glade_xml_get_widget(xml, "cUserQWK_NOCTRL");
767: if(w==NULL)
768: fprintf(stderr,"Cannot get the include extraneous control files widget\n");
769: else
770: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),user.qwk&QWK_NOCTRL);
771:
772: /* Extended Comment */
773: w=glade_xml_get_widget(xml, "tExtendedComment");
774:
775: gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(w)), &start);
776: gtk_text_buffer_get_end_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(w)), &end);
777: gtk_text_buffer_delete(gtk_text_view_get_buffer(GTK_TEXT_VIEW(w)), &start, &end);
778:
779: sprintf(str,"%suser/%4.4u.msg", cfg.data_dir,user.number);
780: f=fopen(str,"r");
781: if(f) {
782: while((i=fread(str,1,sizeof(str),f)))
783: gtk_text_buffer_insert_at_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(w)), str,i);
784: fclose(f);
785: }
786:
787: /*
788: * Set the save buttons as inactive to indicate that no changes were made
789: */
790: w=glade_xml_get_widget(xml, "bSaveUser");
791: if(w==NULL)
792: fprintf(stderr,"Cannot get the save user button widget\n");
793: else
794: gtk_widget_set_sensitive(GTK_WIDGET(w),FALSE);
795: w=glade_xml_get_widget(xml, "save1");
796: if(w==NULL)
797: fprintf(stderr,"Cannot get the save user menu widget\n");
798: else
799: gtk_widget_set_sensitive(GTK_WIDGET(w),FALSE);
800: }
801:
802: void save_user(GtkWidget *wiggy, gpointer data)
803: {
804: GtkWidget *w;
805: char str[1024];
806: gboolean b;
807: int i;
808: FILE *f;
809: GtkTextIter start;
810: GtkTextIter end;
811:
812: /* Toolbar indicators */
813: b=user.misc&DELETED?TRUE:FALSE;
814: w=glade_xml_get_widget(xml, "bDelete");
815: if(w==NULL)
816: fprintf(stderr,"Cannot get the deleted toolbar widget\n");
817: else {
818: switch(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(w))) {
819: case 0:
820: user.misc &= ~DELETED;
821: break;
822: default:
823: user.misc |= DELETED;
824: }
825: }
826:
827: b=user.misc&INACTIVE?TRUE:FALSE;
828: w=glade_xml_get_widget(xml, "bRemove");
829: if(w==NULL)
830: fprintf(stderr,"Cannot get the removed toolbar widget\n");
831: else {
832: switch(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(w))) {
833: case 0:
834: user.misc &= ~INACTIVE;
835: break;
836: default:
837: user.misc |= INACTIVE;
838: }
839: }
840:
841:
842: /* Peronal Tab */
843: /* Alias */
844: w=glade_xml_get_widget(xml, "eUserAlias");
845: if(w==NULL)
846: fprintf(stderr,"Cannot get the alias widget\n");
847: else {
848: strcpy(user.alias, gtk_entry_get_text(GTK_ENTRY(w)));
849: if(user.number) {
850: if(user.misc & DELETED)
851: putusername(&cfg, user.number, "");
852: else
853: putusername(&cfg, user.number, user.alias);
854: }
855: }
856:
857: /* Real Name */
858: w=glade_xml_get_widget(xml, "eRealName");
859: if(w==NULL)
860: fprintf(stderr,"Cannot get the real name widget\n");
861: else
862: strcpy(user.name, gtk_entry_get_text(GTK_ENTRY(w)));
863:
864: /* Computer */
865: w=glade_xml_get_widget(xml, "eComputer");
866: if(w==NULL)
867: fprintf(stderr,"Cannot get the computer widget\n");
868: else
869: strcpy(user.comp, gtk_entry_get_text(GTK_ENTRY(w)));
870:
871: /* NetMail */
872: w=glade_xml_get_widget(xml, "eNetMail");
873: if(w==NULL)
874: fprintf(stderr,"Cannot get the netmail widget\n");
875: else
876: strcpy(user.netmail, gtk_entry_get_text(GTK_ENTRY(w)));
877:
878: /* Phone */
879: w=glade_xml_get_widget(xml, "ePhone");
880: if(w==NULL)
881: fprintf(stderr,"Cannot get the phone widget\n");
882: else
883: strcpy(user.phone,gtk_entry_get_text(GTK_ENTRY(w)));
884:
885: /* Note */
886: w=glade_xml_get_widget(xml, "eNote");
887: if(w==NULL)
888: fprintf(stderr,"Cannot get the note widget\n");
889: else
890: strcpy(user.note, gtk_entry_get_text(GTK_ENTRY(w)));
891:
892: /* Comment */
893: w=glade_xml_get_widget(xml, "eComment");
894: if(w==NULL)
895: fprintf(stderr,"Cannot get the comment widget\n");
896: else
897: strcpy(user.comment, gtk_entry_get_text(GTK_ENTRY(w)));
898:
899: /* Gender */
900: w=glade_xml_get_widget(xml, "eGender");
901: if(w==NULL)
902: fprintf(stderr,"Cannot get the gender widget\n");
903: else
904: user.sex=*(gtk_entry_get_text(GTK_ENTRY(w)));
905:
906: /* Connection */
907: w=glade_xml_get_widget(xml, "eConnection");
908: if(w==NULL)
909: fprintf(stderr,"Cannot get the connection widget\n");
910: else
911: strcpy(user.modem, gtk_entry_get_text(GTK_ENTRY(w)));
912:
913: /* Chat Handle */
914: w=glade_xml_get_widget(xml, "eHandle");
915: if(w==NULL)
916: fprintf(stderr,"Cannot get the handle widget\n");
917: else
918: strcpy(user.handle, gtk_entry_get_text(GTK_ENTRY(w)));
919:
920: /* Birthdate - Already done */
921:
922: /* Password */
923: w=glade_xml_get_widget(xml, "ePassword");
924: if(w==NULL)
925: fprintf(stderr,"Cannot get the password widget\n");
926: else
927: strcpy(user.pass, gtk_entry_get_text(GTK_ENTRY(w)));
928:
929: /* Address */
930: w=glade_xml_get_widget(xml, "eAddress");
931: if(w==NULL)
932: fprintf(stderr,"Cannot get the address widget\n");
933: else
934: strcpy(user.address, gtk_entry_get_text(GTK_ENTRY(w)));
935:
936: /* Location */
937: w=glade_xml_get_widget(xml, "eLocation");
938: if(w==NULL)
939: fprintf(stderr,"Cannot get the location widget\n");
940: else
941: strcpy(user.location, gtk_entry_get_text(GTK_ENTRY(w)));
942:
943: /* Postal/ZIP code */
944: w=glade_xml_get_widget(xml, "eZip");
945: if(w==NULL)
946: fprintf(stderr,"Cannot get the postal/zip code widget\n");
947: else
948: strcpy(user.zipcode, gtk_entry_get_text(GTK_ENTRY(w)));
949:
950: /* Security Tab */
951: /* Level */
952: w=glade_xml_get_widget(xml, "sLevel");
953: if(w==NULL)
954: fprintf(stderr,"Cannot get the level widget\n");
955: else
956: user.level = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
957:
958: /* Expiration - Already done */
959:
960: /* Flag Sets */
961: strcpy(str,"tFlagSet1.");
962: for(i=0;i<26;i++) {
963: str[9]='A'+i;
964: w=glade_xml_get_widget(xml, str);
965: if(w==NULL)
966: fprintf(stderr,"Cannot get the %s widget\n",str);
967: else {
968: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
969: case 0:
970: user.flags1 &= ~(1L<<i);
971: break;
972: default:
973: user.flags1 |= (1L<<i);
974: }
975: }
976: }
977:
978: strcpy(str,"tFlagSet2.");
979: for(i=0;i<26;i++) {
980: str[9]='A'+i;
981: w=glade_xml_get_widget(xml, str);
982: if(w==NULL)
983: fprintf(stderr,"Cannot get the %s widget\n",str);
984: else {
985: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
986: case 0:
987: user.flags2 &= ~(1L<<i);
988: break;
989: default:
990: user.flags2 |= (1L<<i);
991: }
992: }
993: }
994:
995: strcpy(str,"tFlagSet3.");
996: for(i=0;i<26;i++) {
997: str[9]='A'+i;
998: w=glade_xml_get_widget(xml, str);
999: if(w==NULL)
1000: fprintf(stderr,"Cannot get the %s widget\n",str);
1001: else {
1002: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1003: case 0:
1004: user.flags3 &= ~(1L<<i);
1005: break;
1006: default:
1007: user.flags3 |= (1L<<i);
1008: }
1009: }
1010: }
1011:
1012: strcpy(str,"tFlagSet4.");
1013: for(i=0;i<26;i++) {
1014: str[9]='A'+i;
1015: w=glade_xml_get_widget(xml, str);
1016: if(w==NULL)
1017: fprintf(stderr,"Cannot get the %s widget\n",str);
1018: else {
1019: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1020: case 0:
1021: user.flags4 &= ~(1L<<i);
1022: break;
1023: default:
1024: user.flags4 |= (1L<<i);
1025: }
1026: }
1027: }
1028:
1029: /* Exemptions */
1030: strcpy(str,"tExemptions.");
1031: for(i=0;i<26;i++) {
1032: str[11]='A'+i;
1033: w=glade_xml_get_widget(xml, str);
1034: if(w==NULL)
1035: fprintf(stderr,"Cannot get the %s widget\n",str);
1036: else {
1037: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1038: case 0:
1039: user.exempt &= ~(1L<<i);
1040: break;
1041: default:
1042: user.exempt |= (1L<<i);
1043: }
1044: }
1045: }
1046:
1047: /* Restrictions */
1048: strcpy(str,"tRestrictions.");
1049: for(i=0;i<26;i++) {
1050: str[13]='A'+i;
1051: w=glade_xml_get_widget(xml, str);
1052: if(w==NULL)
1053: fprintf(stderr,"Cannot get the %s widget\n",str);
1054: else {
1055: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1056: case 0:
1057: user.rest &= ~(1L<<i);
1058: break;
1059: default:
1060: user.rest |= (1L<<i);
1061: }
1062: }
1063: }
1064:
1065: /* Credits */
1066: w=glade_xml_get_widget(xml, "sCredits");
1067: if(w==NULL)
1068: fprintf(stderr,"Cannot get the credits widget\n");
1069: else
1070: user.cdt = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1071:
1072: /* Free Credits */
1073: w=glade_xml_get_widget(xml, "sFreeCredits");
1074: if(w==NULL)
1075: fprintf(stderr,"Cannot get the free credits widget\n");
1076: else
1077: user.freecdt = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1078:
1079: /* Minutes */
1080: w=glade_xml_get_widget(xml, "sMinutes");
1081: if(w==NULL)
1082: fprintf(stderr,"Cannot get the minutes widget\n");
1083: else
1084: user.min = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1085:
1086: /* Statistics */
1087: /* First On - Already done */
1088:
1089: /* Last On - Already done */
1090:
1091: /* Total Logons */
1092: w=glade_xml_get_widget(xml, "sLogonsTotal");
1093: if(w==NULL)
1094: fprintf(stderr,"Cannot get the total logons widget\n");
1095: else
1096: user.logons = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1097:
1098: /* Logons today */
1099: w=glade_xml_get_widget(xml, "sLogonsToday");
1100: if(w==NULL)
1101: fprintf(stderr,"Cannot get the logons today widget\n");
1102: else
1103: user.ltoday = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1104:
1105: /* Total Posts */
1106: w=glade_xml_get_widget(xml, "sTotalPosts");
1107: if(w==NULL)
1108: fprintf(stderr,"Cannot get the total posts widget\n");
1109: else
1110: user.posts = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1111:
1112: /* Posts Today */
1113: w=glade_xml_get_widget(xml, "sPostsToday");
1114: if(w==NULL)
1115: fprintf(stderr,"Cannot get the posts today widget\n");
1116: else
1117: user.ptoday = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1118:
1119: /* Total Uploads */
1120: w=glade_xml_get_widget(xml, "sTotalUploads");
1121: if(w==NULL)
1122: fprintf(stderr,"Cannot get the total uploads widget\n");
1123: else
1124: user.uls = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1125:
1126: /* Upload Bytes */
1127: w=glade_xml_get_widget(xml, "sUploadBytes");
1128: if(w==NULL)
1129: fprintf(stderr,"Cannot get the upload bytes widget\n");
1130: else
1131: user.ulb = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1132:
1133: /* Total Time On */
1134: w=glade_xml_get_widget(xml, "sTotalTimeOn");
1135: if(w==NULL)
1136: fprintf(stderr,"Cannot get the total time on widget\n");
1137: else
1138: user.timeon = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1139:
1140: /* Time On Today */
1141: w=glade_xml_get_widget(xml, "sTimeOnToday");
1142: if(w==NULL)
1143: fprintf(stderr,"Cannot get the time on today widget\n");
1144: else
1145: user.ttoday = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1146:
1147: /* Time On Last Call */
1148: w=glade_xml_get_widget(xml, "sTimeOnLastCall");
1149: if(w==NULL)
1150: fprintf(stderr,"Cannot get the last call time on widget\n");
1151: else
1152: user.tlast = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1153:
1154: /* Time On Extra */
1155: w=glade_xml_get_widget(xml, "sTimeOnExtra");
1156: if(w==NULL)
1157: fprintf(stderr,"Cannot get the extra time on widget\n");
1158: else
1159: user.textra = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1160:
1161: /* Total Downloads */
1162: w=glade_xml_get_widget(xml, "sDownloadsTotal");
1163: if(w==NULL)
1164: fprintf(stderr,"Cannot get the total downloads widget\n");
1165: else
1166: user.dls = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1167:
1168: /* Download Bytes */
1169: w=glade_xml_get_widget(xml, "sDownloadsBytes");
1170: if(w==NULL)
1171: fprintf(stderr,"Cannot get the download bytes widget\n");
1172: else
1173: user.dlb = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1174:
1175: /* Download Leeches */
1176: w=glade_xml_get_widget(xml, "sDownloadsLeech");
1177: if(w==NULL)
1178: fprintf(stderr,"Cannot get the downloads leech widget\n");
1179: else
1180: user.leech = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1181:
1182: /* Total Email */
1183: w=glade_xml_get_widget(xml, "sEmailTotal");
1184: if(w==NULL)
1185: fprintf(stderr,"Cannot get the total email widget\n");
1186: else
1187: user.emails = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1188:
1189: /* Email Today */
1190: w=glade_xml_get_widget(xml, "sEmailToday");
1191: if(w==NULL)
1192: fprintf(stderr,"Cannot get the email today widget\n");
1193: else
1194: user.etoday = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1195:
1196: /* Email To Sysop */
1197: w=glade_xml_get_widget(xml, "sEmailToSysop");
1198: if(w==NULL)
1199: fprintf(stderr,"Cannot get the email to sysop widget\n");
1200: else
1201: user.fbacks = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1202:
1203: /* Settings */
1204: w=glade_xml_get_widget(xml, "cUserAUTOTERM");
1205: if(w==NULL)
1206: fprintf(stderr,"Cannot get the autoterm widget\n");
1207: else {
1208: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1209: case 0:
1210: user.misc&=~AUTOTERM;
1211: break;
1212: default:
1213: user.misc|=AUTOTERM;
1214: }
1215: }
1216:
1217: w=glade_xml_get_widget(xml, "cUserNO_EXASCII");
1218: if(w==NULL)
1219: fprintf(stderr,"Cannot get the no exascii widget\n");
1220: else {
1221: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1222: case 0:
1223: user.misc&=~NO_EXASCII;
1224: break;
1225: default:
1226: user.misc|=NO_EXASCII;
1227: }
1228: }
1229:
1230: w=glade_xml_get_widget(xml, "cUserANSI");
1231: if(w==NULL)
1232: fprintf(stderr,"Cannot get the ansi widget\n");
1233: else {
1234: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1235: case 0:
1236: user.misc&=~ANSI;
1237: break;
1238: default:
1239: user.misc|=ANSI;
1240: }
1241: }
1242:
1243:
1244: w=glade_xml_get_widget(xml, "cUserCOLOR");
1245: if(w==NULL)
1246: fprintf(stderr,"Cannot get the color widget\n");
1247: else {
1248: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1249: case 0:
1250: user.misc&=~COLOR;
1251: break;
1252: default:
1253: user.misc|=COLOR;
1254: }
1255: }
1256:
1257: w=glade_xml_get_widget(xml, "cUserRIP");
1258: if(w==NULL)
1259: fprintf(stderr,"Cannot get the RIP widget\n");
1260: else {
1261: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1262: case 0:
1263: user.misc&=~RIP;
1264: break;
1265: default:
1266: user.misc|=RIP;
1267: }
1268: }
1269:
1270: w=glade_xml_get_widget(xml, "cUserWIP");
1271: if(w==NULL)
1272: fprintf(stderr,"Cannot get the WIP widget\n");
1273: else {
1274: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1275: case 0:
1276: user.misc&=~WIP;
1277: break;
1278: default:
1279: user.misc|=WIP;
1280: }
1281: }
1282:
1283: w=glade_xml_get_widget(xml, "cUserUPAUSE");
1284: if(w==NULL)
1285: fprintf(stderr,"Cannot get the upause widget\n");
1286: else {
1287: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1288: case 0:
1289: user.misc&=~UPAUSE;
1290: break;
1291: default:
1292: user.misc|=UPAUSE;
1293: }
1294: }
1295:
1296: w=glade_xml_get_widget(xml, "cUserCOLDKEYS");
1297: if(w==NULL)
1298: fprintf(stderr,"Cannot get the coldkeys widget\n");
1299: else {
1300: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1301: case 0:
1302: user.misc&=~COLDKEYS;
1303: break;
1304: default:
1305: user.misc|=COLDKEYS;
1306: }
1307: }
1308:
1309: w=glade_xml_get_widget(xml, "cUserSPIN");
1310: if(w==NULL)
1311: fprintf(stderr,"Cannot get the spin widget\n");
1312: else {
1313: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1314: case 0:
1315: user.misc&=~SPIN;
1316: break;
1317: default:
1318: user.misc|=SPIN;
1319: }
1320: }
1321:
1322: w=glade_xml_get_widget(xml, "cUserRIP");
1323: if(w==NULL)
1324: fprintf(stderr,"Cannot get the RIP widget\n");
1325: else {
1326: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1327: case 0:
1328: user.misc&=~RIP;
1329: break;
1330: default:
1331: user.misc|=RIP;
1332: }
1333: }
1334:
1335: w=glade_xml_get_widget(xml, "sRows");
1336: if(w==NULL)
1337: fprintf(stderr,"Cannot get the rows widget\n");
1338: else
1339: user.rows = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
1340:
1341: w=glade_xml_get_widget(xml, "cCommandShell");
1342: if(w==NULL)
1343: fprintf(stderr,"Cannot get the command shell widget\n");
1344: else
1345: user.shell = gtk_combo_box_get_active(GTK_COMBO_BOX(w));
1346:
1347: w=glade_xml_get_widget(xml, "cUserEXPERT");
1348: if(w==NULL)
1349: fprintf(stderr,"Cannot get the expert widget\n");
1350: else {
1351: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1352: case 0:
1353: user.misc&=~EXPERT;
1354: break;
1355: default:
1356: user.misc&=~EXPERT;
1357: }
1358: }
1359:
1360: w=glade_xml_get_widget(xml, "cUserASK_NSCAN");
1361: if(w==NULL)
1362: fprintf(stderr,"Cannot get the ask new scan widget\n");
1363: else {
1364: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1365: case 0:
1366: user.misc&=~ASK_NSCAN;
1367: break;
1368: default:
1369: user.misc|=ASK_NSCAN;
1370: }
1371: }
1372:
1373: w=glade_xml_get_widget(xml, "cUserASK_SSCAN");
1374: if(w==NULL)
1375: fprintf(stderr,"Cannot get the ask to you scan widget\n");
1376: else {
1377: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1378: case 0:
1379: user.misc&=~ASK_SSCAN;
1380: break;
1381: default:
1382: user.misc|=ASK_SSCAN;
1383: }
1384: }
1385:
1386: w=glade_xml_get_widget(xml, "cUserCURSUB");
1387: if(w==NULL)
1388: fprintf(stderr,"Cannot get the save current sub widget\n");
1389: else {
1390: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1391: case 0:
1392: user.misc&=~CURSUB;
1393: break;
1394: default:
1395: user.misc&=~CURSUB;
1396: }
1397: }
1398:
1399: w=glade_xml_get_widget(xml, "cUserQUIET");
1400: if(w==NULL)
1401: fprintf(stderr,"Cannot get the quiet mode widget\n");
1402: else {
1403: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1404: case 0:
1405: user.misc&=~QUIET;
1406: break;
1407: default:
1408: user.misc|=QUIET;
1409: }
1410: }
1411:
1412: w=glade_xml_get_widget(xml, "cUserAUTOLOGON");
1413: if(w==NULL)
1414: fprintf(stderr,"Cannot get the auto logon widget\n");
1415: else {
1416: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1417: case 0:
1418: user.misc&=~AUTOLOGON;
1419: break;
1420: default:
1421: user.misc|=AUTOLOGON;
1422: }
1423: }
1424:
1425: w=glade_xml_get_widget(xml, "cUserEXPERT");
1426: if(w==NULL)
1427: fprintf(stderr,"Cannot get the expert widget\n");
1428: else {
1429: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1430: case 0:
1431: user.misc&=~EXPERT;
1432: break;
1433: default:
1434: user.misc|=EXPERT;
1435: }
1436: }
1437:
1438: w=glade_xml_get_widget(xml, "cUserCHAT_ECHO");
1439: if(w==NULL)
1440: fprintf(stderr,"Cannot get the chat echo widget\n");
1441: else {
1442: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1443: case 0:
1444: user.chat&=~CHAT_ECHO;
1445: break;
1446: default:
1447: user.chat|=CHAT_ECHO;
1448: }
1449: }
1450:
1451: w=glade_xml_get_widget(xml, "cUserCHAT_ACTION");
1452: if(w==NULL)
1453: fprintf(stderr,"Cannot get the chat action widget\n");
1454: else {
1455: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1456: case 0:
1457: user.chat&=~CHAT_ACTION;
1458: break;
1459: default:
1460: user.chat|=CHAT_ACTION;
1461: }
1462: }
1463:
1464: w=glade_xml_get_widget(xml, "cUserCHAT_NOPAGE");
1465: if(w==NULL)
1466: fprintf(stderr,"Cannot get the chat nopage widget\n");
1467: else {
1468: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1469: case 0:
1470: user.chat&=~CHAT_NOPAGE;
1471: break;
1472: default:
1473: user.chat|=CHAT_NOPAGE;
1474: }
1475: }
1476:
1477: w=glade_xml_get_widget(xml, "cUserCHAT_NOACT");
1478: if(w==NULL)
1479: fprintf(stderr,"Cannot get the chat no activity widget\n");
1480: else {
1481: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1482: case 0:
1483: user.chat&=~CHAT_NOACT;
1484: break;
1485: default:
1486: user.chat|=CHAT_NOACT;
1487: }
1488: }
1489:
1490: w=glade_xml_get_widget(xml, "cUserCHAT_SPLITP");
1491: if(w==NULL)
1492: fprintf(stderr,"Cannot get the chat split personal widget\n");
1493: else {
1494: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1495: case 0:
1496: user.chat&=~CHAT_SPLITP;
1497: break;
1498: default:
1499: user.chat&=~CHAT_SPLITP;
1500: }
1501: }
1502:
1503: /* Msg/File Settings */
1504:
1505: w=glade_xml_get_widget(xml, "cUserNETMAIL");
1506: if(w==NULL)
1507: fprintf(stderr,"Cannot get the netmail widget\n");
1508: else {
1509: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1510: case 0:
1511: user.misc&=~NETMAIL;
1512: break;
1513: default:
1514: user.misc|=NETMAIL;
1515: }
1516: }
1517:
1518: w=glade_xml_get_widget(xml, "cUserCLRSCRN");
1519: if(w==NULL)
1520: fprintf(stderr,"Cannot get the clear screen widget\n");
1521: else {
1522: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1523: case 0:
1524: user.misc&=~CLRSCRN;
1525: break;
1526: default:
1527: user.misc|=CLRSCRN;
1528: }
1529: }
1530:
1531: w=glade_xml_get_widget(xml, "cUserANFSCAN");
1532: if(w==NULL)
1533: fprintf(stderr,"Cannot get the ask new file scan widget\n");
1534: else {
1535: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1536: case 0:
1537: user.misc&=~ANFSCAN;
1538: break;
1539: default:
1540: user.misc|=ANFSCAN;
1541: }
1542: }
1543:
1544: w=glade_xml_get_widget(xml, "cUserEXTDESC");
1545: if(w==NULL)
1546: fprintf(stderr,"Cannot get the extended descriptions widget\n");
1547: else {
1548: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1549: case 0:
1550: user.misc&=~EXTDESC;
1551: break;
1552: default:
1553: user.misc|=EXTDESC;
1554: }
1555: }
1556:
1557: w=glade_xml_get_widget(xml, "cUserBATCHFLAG");
1558: if(w==NULL)
1559: fprintf(stderr,"Cannot get the batch flagging widget\n");
1560: else {
1561: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1562: case 0:
1563: user.misc&=~BATCHFLAG;
1564: break;
1565: default:
1566: user.misc|=BATCHFLAG;
1567: }
1568: }
1569:
1570: w=glade_xml_get_widget(xml, "cUserAUTOHANG");
1571: if(w==NULL)
1572: fprintf(stderr,"Cannot get the auto hangup after transfer widget\n");
1573: else {
1574: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1575: case 0:
1576: user.misc&=~AUTOHANG;
1577: break;
1578: default:
1579: user.misc|=AUTOHANG;
1580: }
1581: }
1582:
1583: w=glade_xml_get_widget(xml, "cUserCLRSCRN");
1584: if(w==NULL)
1585: fprintf(stderr,"Cannot get the clear screen widget\n");
1586: else {
1587: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1588: case 0:
1589: user.misc&=~CLRSCRN;
1590: break;
1591: default:
1592: user.misc|=CLRSCRN;
1593: }
1594: }
1595:
1596: w=glade_xml_get_widget(xml, "cExternalEditor");
1597: if(w==NULL)
1598: fprintf(stderr,"Cannot get the external editor widget\n");
1599: else
1600: user.xedit = gtk_combo_box_get_active(GTK_COMBO_BOX(w));
1601:
1602: w=glade_xml_get_widget(xml, "cDefaultDownloadProtocol");
1603: if(w==NULL)
1604: fprintf(stderr,"Cannot get the default download protocol widget\n");
1605: else {
1606: if(gtk_combo_box_get_active(GTK_COMBO_BOX(w))==0)
1607: user.prot=' ';
1608: else
1609: user.prot=cfg.prot[gtk_combo_box_get_active(GTK_COMBO_BOX(w))-1]->mnemonic;
1610: }
1611:
1612: w=glade_xml_get_widget(xml, "cTempQWKFileType");
1613: if(w==NULL)
1614: fprintf(stderr,"Cannot get the temp QWK file type widget\n");
1615: else
1616: strcpy(user.tmpext, cfg.fcomp[gtk_combo_box_get_active(GTK_COMBO_BOX(w))]->ext);
1617:
1618: w=glade_xml_get_widget(xml, "cUserQWK_FILES");
1619: if(w==NULL)
1620: fprintf(stderr,"Cannot get the include new files list widget\n");
1621: else {
1622: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1623: case 0:
1624: user.qwk&=~QWK_FILES;
1625: break;
1626: default:
1627: user.qwk|=QWK_FILES;
1628: }
1629: }
1630:
1631: w=glade_xml_get_widget(xml, "cUserQWK_EMAIL");
1632: if(w==NULL)
1633: fprintf(stderr,"Cannot get the include unread email widget\n");
1634: else {
1635: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1636: case 0:
1637: user.qwk&=~QWK_EMAIL;
1638: break;
1639: default:
1640: user.qwk|=QWK_EMAIL;
1641: }
1642: }
1643:
1644: w=glade_xml_get_widget(xml, "cUserQWK_ALLMAIL");
1645: if(w==NULL)
1646: fprintf(stderr,"Cannot get the include all email widget\n");
1647: else {
1648: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1649: case 0:
1650: user.qwk&=~QWK_ALLMAIL;
1651: break;
1652: default:
1653: user.qwk|=QWK_ALLMAIL;
1654: }
1655: }
1656:
1657: w=glade_xml_get_widget(xml, "cUserQWK_DELMAIL");
1658: if(w==NULL)
1659: fprintf(stderr,"Cannot get the delete email widget\n");
1660: else {
1661: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1662: case 0:
1663: user.qwk&=~QWK_DELMAIL;
1664: break;
1665: default:
1666: user.qwk|=QWK_DELMAIL;
1667: }
1668: }
1669:
1670: w=glade_xml_get_widget(xml, "cUserQWK_BYSELF");
1671: if(w==NULL)
1672: fprintf(stderr,"Cannot get the include messages by self widget\n");
1673: else {
1674: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1675: case 0:
1676: user.qwk&=~QWK_BYSELF;
1677: break;
1678: default:
1679: user.qwk|=QWK_BYSELF;
1680: }
1681: }
1682:
1683: w=glade_xml_get_widget(xml, "cUserQWK_EXPCTLA");
1684: if(w==NULL)
1685: fprintf(stderr,"Cannot get the expand ctrl-a widget\n");
1686: else {
1687: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1688: case 0:
1689: user.qwk&=~QWK_EXPCTLA;
1690: break;
1691: default:
1692: user.qwk|=QWK_EXPCTLA;
1693: }
1694: }
1695:
1696: w=glade_xml_get_widget(xml, "cUserQWK_RETCTLA");
1697: if(w==NULL)
1698: fprintf(stderr,"Cannot get the retain ctrl-a widget\n");
1699: else {
1700: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1701: case 0:
1702: user.qwk&=~QWK_RETCTLA;
1703: break;
1704: default:
1705: user.qwk|=QWK_RETCTLA;
1706: }
1707: }
1708:
1709: w=glade_xml_get_widget(xml, "cUserQWK_ATTACH");
1710: if(w==NULL)
1711: fprintf(stderr,"Cannot get the include attachments widget\n");
1712: else {
1713: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1714: case 0:
1715: user.qwk&=~QWK_ATTACH;
1716: break;
1717: default:
1718: user.qwk|=QWK_ATTACH;
1719: }
1720: }
1721:
1722: w=glade_xml_get_widget(xml, "cUserQWK_NOINDEX");
1723: if(w==NULL)
1724: fprintf(stderr,"Cannot get the don't include index files widget\n");
1725: else {
1726: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1727: case 0:
1728: user.qwk&=~QWK_NOINDEX;
1729: break;
1730: default:
1731: user.qwk|=QWK_NOINDEX;
1732: }
1733: }
1734:
1735: w=glade_xml_get_widget(xml, "cUserQWK_TZ");
1736: if(w==NULL)
1737: fprintf(stderr,"Cannot get the include TZ widget\n");
1738: else {
1739: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1740: case 0:
1741: user.qwk&=~QWK_TZ;
1742: break;
1743: default:
1744: user.qwk|=QWK_TZ;
1745: }
1746: }
1747:
1748: w=glade_xml_get_widget(xml, "cUserQWK_VIA");
1749: if(w==NULL)
1750: fprintf(stderr,"Cannot get the include VIA widget\n");
1751: else {
1752: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1753: case 0:
1754: user.qwk&=~QWK_VIA;
1755: break;
1756: default:
1757: user.qwk&=~QWK_VIA;
1758: }
1759: }
1760:
1761: w=glade_xml_get_widget(xml, "cUserQWK_NOCTRL");
1762: if(w==NULL)
1763: fprintf(stderr,"Cannot get the include extraneous control files widget\n");
1764: else {
1765: switch(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
1766: case 0:
1767: user.qwk&=~QWK_NOCTRL;
1768: break;
1769: default:
1770: user.qwk|=QWK_NOCTRL;
1771: }
1772: }
1773:
1774: /* Extended Comment */
1775: sprintf(str,"%suser/%4.4u.msg", cfg.data_dir,user.number);
1776: w=glade_xml_get_widget(xml, "tExtendedComment");
1777: gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(w)), &start);
1778: gtk_text_buffer_get_end_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(w)), &end);
1779: f=fopen(str,"w");
1780: if(f) {
1781: fputs(gtk_text_buffer_get_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(w)),&start,&end,TRUE), f);
1782: fclose(f);
1783: }
1784:
1785: if(user.number) {
1786: putuserdat(&cfg, &user);
1787: load_user(wiggy, data);
1788: }
1789: else {
1790: newuserdat(&cfg, &user);
1791: update_current_user(user.number);
1792: }
1793: }
1794:
1795: void new_user(GtkWidget *wiggy, gpointer data)
1796: {
1797: GtkWidget *eCurrentUser;
1798: int i;
1799:
1800: memset(&user,0,sizeof(user));
1801:
1802: /****************/
1803: /* Set Defaults */
1804: /****************/
1805:
1806: /* security */
1807: user.level=cfg.new_level;
1808: user.flags1=cfg.new_flags1;
1809: user.flags2=cfg.new_flags2;
1810: user.flags3=cfg.new_flags3;
1811: user.flags4=cfg.new_flags4;
1812: user.rest=cfg.new_rest;
1813: user.exempt=cfg.new_exempt;
1814:
1815: user.cdt=cfg.new_cdt;
1816: user.min=cfg.new_min;
1817: user.freecdt=cfg.level_freecdtperday[user.level];
1818:
1819: if(cfg.total_fcomps)
1820: strcpy(user.tmpext,cfg.fcomp[0]->ext);
1821: else
1822: strcpy(user.tmpext,"ZIP");
1823: for(i=0;i<cfg.total_xedits;i++)
1824: if(!stricmp(cfg.xedit[i]->code,cfg.new_xedit))
1825: break;
1826: if(i<cfg.total_xedits)
1827: user.xedit=i+1;
1828:
1829: user.shell=cfg.new_shell;
1830: user.misc=(cfg.new_misc&~(DELETED|INACTIVE|QUIET|NETMAIL));
1831: user.misc|=AUTOTERM; /* No way to frob the default value... */
1832: user.qwk=QWK_DEFAULT;
1833: user.firston=time(NULL);
1834: user.laston=time(NULL); /* must set this or user may be purged prematurely */
1835: user.pwmod=time(NULL);
1836: user.sex=' ';
1837: user.prot=cfg.new_prot;
1838:
1839: if(cfg.new_expire)
1840: user.expire=time(NULL)+((long)cfg.new_expire*24L*60L*60L);
1841:
1842: eCurrentUser=glade_xml_get_widget(xml, "eCurrentUser");
1843: if(eCurrentUser==NULL) {
1844: fprintf(stderr,"Cannot get the current user widget\n");
1845: load_user(wiggy, data);
1846: return;
1847: }
1848: gtk_entry_set_text(GTK_ENTRY(eCurrentUser), "New" );
1849: current_user=0;
1850: load_user(wiggy, data);
1851: }
1852:
1853: int update_current_user(int new_user)
1854: {
1855: char str[11];
1856: GtkWidget *eCurrentUser;
1857:
1858: if(new_user<1 || new_user>totalusers)
1859: new_user=current_user;
1860: sprintf(str,"%d",new_user);
1861: eCurrentUser=glade_xml_get_widget(xml, "eCurrentUser");
1862: if(eCurrentUser==NULL) {
1863: fprintf(stderr,"Cannot get the current user widget\n");
1864: return(-1);
1865: }
1866: if(strcmp(gtk_entry_get_text(GTK_ENTRY(eCurrentUser)),str))
1867: gtk_entry_set_text(GTK_ENTRY(eCurrentUser), str);
1868: if(new_user!=current_user) {
1869: current_user=new_user;
1870: load_user(eCurrentUser,NULL);
1871: }
1872: return(0);
1873: }
1874:
1875: void current_user_changed(GtkWidget *w, gpointer data)
1876: {
1877: int new_user;
1878:
1879: new_user=atoi(gtk_entry_get_text(GTK_ENTRY(w)));
1880: update_current_user(new_user);
1881: }
1882:
1883: void first_user(GtkWidget *w, gpointer data)
1884: {
1885: update_current_user(1);
1886: }
1887:
1888: void prev_user(GtkWidget *w, gpointer data)
1889: {
1890: update_current_user(current_user-1);
1891: }
1892:
1893: void next_user(GtkWidget *w, gpointer data)
1894: {
1895: update_current_user(current_user+1);
1896: }
1897:
1898: void last_user(GtkWidget *w, gpointer data)
1899: {
1900: update_current_user(totalusers);
1901: }
1902:
1903: void show_about_box(GtkWidget *unused, gpointer data)
1904: {
1905: GladeXML *axml;
1906: axml = glade_xml_new(glade_path, "AboutWindow", NULL);
1907: if(axml==NULL) {
1908: fprintf(stderr,"Could not locate AboutWindow widget\n");
1909: return;
1910: }
1911: /* connect the signals in the interface */
1912: glade_xml_signal_autoconnect(axml);
1913: gtk_window_present(GTK_WINDOW(glade_xml_get_widget(axml, "AboutWindow")));
1914: }
1915:
1916: void user_toggle_delete(GtkWidget *t, gpointer data)
1917: {
1918: gboolean deleted;
1919: GtkWidget *w;
1920:
1921: g_object_get(G_OBJECT(t), "active", &deleted, NULL);
1922:
1923: w=glade_xml_get_widget(xml, "bDelete");
1924: if(w==NULL)
1925: fprintf(stderr,"Cannot get the deleted toolbar widget\n");
1926: else
1927: gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(w),deleted);
1928: w=glade_xml_get_widget(xml, "delete1");
1929: if(w==NULL)
1930: fprintf(stderr,"Cannot get the deleted menu widget\n");
1931: else
1932: gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w),deleted);
1933: user_changed(t, data);
1934: }
1935:
1936: void user_toggle_inactive(GtkWidget *t, gpointer data)
1937: {
1938: gboolean inactive;
1939: GtkWidget *w;
1940:
1941: g_object_get(G_OBJECT(t), "active", &inactive, NULL);
1942:
1943: w=glade_xml_get_widget(xml, "bRemove");
1944: if(w==NULL)
1945: fprintf(stderr,"Cannot get the removed toolbar widget\n");
1946: else
1947: gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(w),inactive);
1948: w=glade_xml_get_widget(xml, "remove1");
1949: if(w==NULL)
1950: fprintf(stderr,"Cannot get the remove menu widget\n");
1951: else
1952: gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w),inactive);
1953: user_changed(t, data);
1954: }
1955:
1956: void find_user(GtkWidget *t, gpointer data)
1957: {
1958: GtkWidget *w;
1959: unsigned int nu;
1960:
1961: w=glade_xml_get_widget(xml, "eMatchUser");
1962: if(w==NULL)
1963: fprintf(stderr,"Cannot get the find user entry widget\n");
1964: else {
1965: nu=matchuser(&cfg, (char *)gtk_entry_get_text(GTK_ENTRY(w)), TRUE);
1966: if(nu==0) {
1967: GladeXML *cxml;
1968: cxml = glade_xml_new(glade_path, "NotFoundWindow", NULL);
1969: /* connect the signals in the interface */
1970: glade_xml_signal_autoconnect(cxml);
1971: if(cxml==NULL)
1972: fprintf(stderr,"Could not locate NotFoundWindow widget\n");
1973: gtk_window_present(GTK_WINDOW(glade_xml_get_widget(cxml, "NotFoundWindow")));
1974: }
1975: else
1976: update_current_user(nu);
1977: }
1978: }
1979:
1980: void close_this_window(GtkWidget *t, gpointer data)
1981: {
1982: gtk_widget_destroy(GTK_WIDGET(gtk_widget_get_toplevel(t)));
1983: }
1984:
1985: int got_date;
1986:
1987: void destroy_calendar_window(GtkWidget *t, gpointer data)
1988: {
1989: if(!got_date)
1990: gtk_main_quit();
1991: }
1992:
1993: void changed_day(GtkWidget *t, gpointer data)
1994: {
1995: got_date=1;
1996: gtk_main_quit();
1997: }
1998:
1999: int get_date(GtkWidget *t, isoDate_t *date)
2000: {
2001: GladeXML *cxml;
2002: GtkWidget *w;
2003: GtkWidget *win;
2004: GtkWidget *thiswin;
2005: gint x,x_off;
2006: gint y,y_off;
2007: guint year;
2008: guint month;
2009: guint day;
2010: isoDate_t odate=*date;
2011:
2012: got_date=0;
2013: cxml = glade_xml_new(glade_path, "CalendarWindow", NULL);
2014: if(cxml==NULL) {
2015: fprintf(stderr,"Could not locate Calendar Window XML\n");
2016: return(-1);
2017: }
2018: /* connect the signals in the interface */
2019: glade_xml_signal_autoconnect(cxml);
2020: win=glade_xml_get_widget(cxml, "CalendarWindow");
2021: if(win==NULL) {
2022: fprintf(stderr,"Could not locate Calendar window\n");
2023: return(-1);
2024: }
2025:
2026: thiswin = gtk_widget_get_toplevel(t);
2027: if(thiswin==NULL) {
2028: fprintf(stderr,"Could not locate main window\n");
2029: return(-1);
2030: }
2031: if(!(gtk_widget_translate_coordinates(GTK_WIDGET(t)
2032: ,GTK_WIDGET(thiswin), 0, 0, &x_off, &y_off))) {
2033: fprintf(stderr,"Could not get position of button in window");
2034: }
2035: gtk_window_get_position(GTK_WINDOW(thiswin), &x, &y);
2036:
2037: gtk_window_move(GTK_WINDOW(win), x+x_off, y+y_off);
2038:
2039: w=glade_xml_get_widget(cxml, "Calendar");
2040: if(w==NULL) {
2041: fprintf(stderr,"Could not locate Calendar widget\n");
2042: return(-1);
2043: }
2044: gtk_calendar_select_month(GTK_CALENDAR(w), isoDate_month(*date)-1, isoDate_year(*date));
2045: gtk_calendar_select_day(GTK_CALENDAR(w), isoDate_day(*date));
2046: gtk_window_present(GTK_WINDOW(win));
2047: /* Wait for window to close... */
2048: gtk_main();
2049: w=glade_xml_get_widget(cxml, "Calendar");
2050: if(w==NULL)
2051: return(-1);
2052: gtk_calendar_get_date(GTK_CALENDAR(w), &year, &month, &day);
2053: gtk_widget_destroy(GTK_WIDGET(gtk_widget_get_toplevel(GTK_WIDGET(w))));
2054: *date=isoDate_create(year, month+1, day);
2055: return(odate!=*date);
2056: }
2057:
2058: void get_expiration(GtkWidget *t, gpointer data)
2059: {
2060: isoDate_t date;
2061: GtkWidget *w;
2062: char str[9];
2063:
2064: date=time_to_isoDate(user.expire?user.expire:time(NULL));
2065: if(!get_date(t, &date)) {
2066: user.expire = isoDateTime_to_time(date,0);
2067: user_changed(t, data);
2068: w=glade_xml_get_widget(xml, "eExpiration");
2069: if(w==NULL)
2070: fprintf(stderr,"Cannot get the expiration widget\n");
2071: else {
2072: if(user.expire)
2073: unixtodstr(&cfg, user.expire, str);
2074: else
2075: strcpy(str,"Never");
2076: gtk_entry_set_text(GTK_ENTRY(w),str);
2077: }
2078: }
2079: }
2080:
2081: void clear_expire(GtkWidget *t, gpointer data)
2082: {
2083: GtkWidget *w;
2084:
2085: w=glade_xml_get_widget(xml, "eExpiration");
2086: if(w==NULL)
2087: fprintf(stderr,"Cannot get the expiration widget\n");
2088: user.expire=0;
2089: gtk_entry_set_text(GTK_ENTRY(w),"Never");
2090: user_changed(t,data);
2091: }
2092:
2093: void get_birthdate(GtkWidget *t, gpointer data)
2094: {
2095: isoDate_t date;
2096: GtkWidget *w;
2097: int year;
2098: char str[9];
2099:
2100: year=atoi(user.birth+6)+1900;
2101: if(year<Y2K_2DIGIT_WINDOW)
2102: year+=100;
2103: if(cfg.sys_misc&SM_EURODATE)
2104: date=isoDate_create(year, atoi(user.birth+3), atoi(user.birth));
2105: else
2106: date=isoDate_create(year, atoi(user.birth), atoi(user.birth+3));
2107: if(!get_date(t, &date)) {
2108: if(cfg.sys_misc&SM_EURODATE)
2109: sprintf(user.birth,"%02u/%02u/%02u",isoDate_day(date),isoDate_month(date),isoDate_year(date));
2110: else
2111: sprintf(user.birth,"%02u/%02u/%02u",isoDate_month(date),isoDate_day(date),isoDate_year(date));
2112: user_changed(t, data);
2113: w=glade_xml_get_widget(xml, "eBirthdate");
2114: if(w==NULL)
2115: fprintf(stderr,"Cannot get the birthdate widget\n");
2116: else
2117: gtk_entry_set_text(GTK_ENTRY(w),user.birth);
2118: }
2119: }
2120:
2121:
2122: void get_firston(GtkWidget *t, gpointer data)
2123: {
2124: isoDate_t date;
2125: GtkWidget *w;
2126: char str[9];
2127:
2128: date=time_to_isoDate(user.firston?user.firston:time(NULL));
2129: if(!get_date(t, &date)) {
2130: user.firston = isoDateTime_to_time(date,0);
2131: user_changed(t, data);
2132: w=glade_xml_get_widget(xml, "eFirstOn");
2133: if(w==NULL)
2134: fprintf(stderr,"Cannot get the first on widget\n");
2135: else {
2136: if(user.firston)
2137: unixtodstr(&cfg, user.firston, str);
2138: else
2139: strcpy(str,"Never");
2140: gtk_entry_set_text(GTK_ENTRY(w),str);
2141: }
2142: }
2143: }
2144:
2145: void clear_firston(GtkWidget *t, gpointer data)
2146: {
2147: GtkWidget *w;
2148:
2149: w=glade_xml_get_widget(xml, "eFirstOn");
2150: if(w==NULL)
2151: fprintf(stderr,"Cannot get the first on widget\n");
2152: user.firston=0;
2153: gtk_entry_set_text(GTK_ENTRY(w),"Never");
2154: user_changed(t,data);
2155: }
2156:
2157: void get_laston(GtkWidget *t, gpointer data)
2158: {
2159: isoDate_t date;
2160: GtkWidget *w;
2161: char str[9];
2162:
2163: date=time_to_isoDate(user.laston?user.laston:time(NULL));
2164: if(!get_date(t, &date)) {
2165: user.laston = isoDateTime_to_time(date,0);
2166: user_changed(t, data);
2167: w=glade_xml_get_widget(xml, "eLastOn");
2168: if(w==NULL)
2169: fprintf(stderr,"Cannot get the expiration widget\n");
2170: else {
2171: if(user.laston)
2172: unixtodstr(&cfg, user.laston, str);
2173: else
2174: strcpy(str,"Never");
2175: gtk_entry_set_text(GTK_ENTRY(w),str);
2176: }
2177: }
2178: }
2179:
2180: void clear_laston(GtkWidget *t, gpointer data)
2181: {
2182: GtkWidget *w;
2183:
2184: w=glade_xml_get_widget(xml, "eLastOn");
2185: if(w==NULL)
2186: fprintf(stderr,"Cannot get the expiration widget\n");
2187: user.laston=0;
2188: gtk_entry_set_text(GTK_ENTRY(w),"Never");
2189: user_changed(t,data);
2190: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.