#pragma implementation #include #include #include "heartbeatconf.h" #include "heartbeatconf.m" void edit_authkeys() { DIALOG dia; VIEWITEMS tb; tb.read(file_authkeys); SSTRING key; char metod = 0; if(tb.getnb() == 2) { metod = atoi(str_skip(key.copyword(tb.getitem(0)->line.get())))-1; const char *tmp = key.copyword(str_skip(tb.getitem(1)->line.get())); tmp = key.copyword(str_skip(tmp)); key.copyword(str_skip(tmp)); } dia.newf_radio(MSG_U(F_AUTHMETOD, "Auth. Method:"), metod, 0, "crc"); dia.newf_radio("", metod, 1, "sha1"); dia.newf_radio("", metod, 2, "md5"); dia.newf_str(MSG_U(F_KEY, "Key"), key); while(1) { MENU_STATUS menu = dia.edit(MSG_U(T_AUTHKEYS, "Auth Keys"), "", help_heartbeat); if(menu == MENU_ESCAPE || menu == MENU_QUIT || menu == MENU_CANCEL) break; else if(menu == MENU_ACCEPT){ tb.remove_all(); SSTRING tmp; if(metod == 0) key.setfrom(""); const char *ch[] = { "crc", "sha1", "md5" }; tmp.setfromf("auth %d", metod+1); tb.add(new VIEWITEM(tmp.get(),VIEWITEM_VARIABLE)); tmp.setfromf("%d %s %s", metod+1, ch[metod], key.get()); tb.add(new VIEWITEM(tmp.get(),VIEWITEM_VARIABLE)); tb.write(file_authkeys, NULL); break; } } }