// ===================================================================== void insmm::DisplayNewTypeList(void) // ===================================================================== // Format of .INF-files: 00000001.WAV,name & surname,fido address // old: 00000001.WAV,deutsch description,englisch description { int i,n,ret; FILE *fp; char buf[300]; char tmp[300]; char name[300]; char addr[300]; CString help1; CString help2; CStrList inffiles; CStrList mmfiles; UpdateData(1); make_path(tmp,gc.MultimedPath,"*.inf"); infolist.RemoveAll(); inffiles.FillWithFiles(tmp); for (i=0;i<inffiles.GetCount();i++) { make_path(tmp,gc.MultimedPath,inffiles.GetString(i)); fp=fopen(tmp,"rt"); if (fp) { while (fgets(buf,299,fp)) { if (strchr(" ;/",buf[0]) || strlen(buf)<4) continue; infolist.AddTail(buf); } fclose(fp); } } make_path(tmp,gc.MultimedPath,m_mmtype==0 ? "*.bmp":"*.wav"); mmstuff.RemoveAll(); mmfiles.FillWithFiles(tmp); for (i=0;i<mmfiles.GetCount();i++) { help1=mmfiles.GetString(i); for (n=0;n<infolist.GetCount();n++) { help2=infolist.GetString(n); if (!strnicmp(help1,help2,help1.GetLength())) { name[0]=addr[0]=0; ret=sscanf(help2,"%[^,]%[, ]%[^,]%[ ,]%[^\n,]",tmp,tmp,name,tmp,addr); if (ret!=5) break; sprintf(buf,"%s\t%s\t%s",help1,name,addr); mmstuff.AddTail(buf); break; } } } UPDATE_LB(mmstuff,IDC_LIST); }
// =========================================================== // searches the time-period by the specified zone, returns string "UNIT CHARGESTRING" void get_period_by_zone(const char *zone,CString &period) // =========================================================== { CString str,tmp; struct tm *loctime; time_t tim; period.Empty(); for (int t=0;t<costbaselist.GetCount();t++) { str=costbaselist.GetString(t); get_token(str,BASEZONE,tmp); if (!tmp.CompareNoCase(zone)) { time(&tim); /* Get time as long integer. */ loctime = localtime(&tim); /* Convert to local time. */ if (loctime->tm_wday == 0 || loctime->tm_wday == 6) get_token(str,BASEWEND,period); // weekend else get_token(str,BASEWDAY,period); // workdays get_token(str,BASECURR,tmp); // currency strcpy(currency,tmp); get_token(str,BASEPERU,tmp); // charging per unit period = tmp+" "+period; return; } } }
// =========================================================== // searches for valid charging-period, if not found, the default-string is returned void get_current_zone(char *timeperiods) // =========================================================== { CString str; CString tmp; size_t matchlen=0; *timeperiods=0; for (int t=0;t<costuserlist.GetCount();t++) { str=costuserlist.GetString(t); get_token(str,USERPHON,tmp); if (!timeperiods[0] && (!stricmp(tmp,"default") || !stricmp(tmp,"по умолчанию"))) { get_token(str,USERZONE,tmp); strcpy(chargzone,tmp); get_period_by_zone(chargzone,tmp); strcpy(timeperiods,tmp); // defaultvalue found } else if (!strncmp(curphone,tmp,strlen(tmp)) && strlen(tmp)>matchlen) // search maximum similarity to curphone in costuser { matchlen = strlen(tmp); get_token(str,USERZONE,tmp); strcpy(chargzone,tmp); get_period_by_zone(chargzone,tmp); strcpy(timeperiods,tmp); } } }
// =========================================================================== BOOL receiver::OnInitDialog() // =========================================================================== { CString str; int tabs[]={60,170}; int tabs2[]={100}; int lng[]={ IDC_ADD1, IDC_ADD2, IDC_CHANGE1, IDC_CHANGE2, IDC_DELETE1, IDC_DELETE2, IDC_STATIC1, IDC_STATIC2, IDC_STATIC4, IDC_STATIC3, IDC_STATIC5, IDC_IMPORT, }; CDialog::OnInitDialog(); set_dlg_language(this,DlgName,lng,sizeof(lng)/sizeof(int)); TAB_LIST(m_groups,tabs2); TAB_LIST(m_members,tabs); for (int i=0;i<Agroups.GetCount();i++) { str=Agroups.GetString(i); str.Trim(); m_groups.AddString(str); } SET_SEL(m_groups,0); OnLbnSelchangeGroups(); return TRUE; }
// ===================================================================== void insmm::OnOK() // ===================================================================== { int sel; CString line; CString mmfile; char buf[300]; char *p; UpdateData(1); sel=m_mm_list.GetCurSel(); if (sel==LB_ERR) ERR_MSG_RET("E_PLSAME"); line=mmstuff.GetString(sel); get_token(line,0,mmfile); strcpy(buf,mmfile); p=strchr(buf,'.'); if (!p) ERR_MSG_RET("E_ILLMML"); *p=0; p=buf; // while (*p && *p=='0') // skip begining zeroes // p++; MM_Element.Format("%s%s%d%s",MM_PREFIX,m_mmtype==0 ? "B":"W",IDTOCOD(m_mmdisplay),p); infolist.RemoveAll(); CDialog::OnOK(); }
// ================================================================= BOOL cfgexfr::OnInitDialog() // ================================================================= { int lng[]={ IDC_STATIC2, IDC_CHECK_16BIT, IDCANCEL, IDOK }; CDialog::OnInitDialog(); set_dlg_language(this,DlgName,lng,sizeof(lng)/sizeof(int)); if (exfrcfg.GetCount()>1) { m_edit_path.SetWindowText(exfrcfg.GetString(0)); m_check_16bit.SetCheck(exfrcfg.GetString(1)=="1" ? 1 : 0); } return TRUE; }
// ================================================ BOOL resultfm::OnInitDialog() // ================================================ { int lng[]={ IDOK, IDCANCEL, IDC_STATIC1, IDHELP, IDDEFAULT, IDAPPLY }; CDialog::OnInitDialog(); set_dlg_language(this,DlgName,lng,sizeof(lng)/sizeof(int)); hinweiscounter=0; m_edit_format.SetWindowText(resultdisp.GetString(0)); m_edit_tabs.SetWindowText(resultdisp.GetString(1)); SetTimer(2345,400,0); return TRUE; }
// =========================================================================== void receiver::populate_lists() // =========================================================================== { CString help,group; int i; m_groups.ResetContent(); m_members.ResetContent(); for (i=0;i<Agroups.GetCount();i++) { help=Agroups.GetString(i); get_token(help,0,group); m_groups.AddString(group); } }
// ===================================================================== void insmm::OnTest() // ===================================================================== { CString fname; char mmdir[300]; int sel; UpdateData(1); GET_SELID(IDC_LIST); get_token(mmstuff.GetString(sel),0,fname); make_path(mmdir,gc.MultimedPath,fname); if (m_mmtype==0) { display_bitmap(mmdir); force_bmp_display_update(); } else test_sound(mmdir); }
// ================================================================== void hatch::OnOK() // ================================================================== { CString str,areapath,filepath,magic,echotag,upl,desc; int zone,net,node,point,myzone,mynet,mynode,mypoint,sel,ret; char fpath[MAX_PATH],fname[MAX_PATH]; sel=m_list.GetCurSel(); if (sel==LB_ERR) ERR_MSG_RET("E_ETMBSEC"); str=tics.GetString(sel); get_token(str,0,echotag); get_token(str,1,upl); trim_all(upl); get_token(str,3,areapath); m_description.GetWindowText(desc); trim_all(desc); desc.Replace("\r\n",". "); // if (strchr(desc,'\r') && err_out("DN_MULLDES")==IDNO) return; m_filename.GetWindowText(filepath); if (filepath.GetLength()<2) ERR_MSG_RET("E_NOFILEGIVEN"); m_edit_magic.GetWindowText(magic); get_filename(filepath,fname); make_path(fpath,areapath,fname); if (access(fpath,0) && err_out("DY_STFBCTDA",fpath)==IDYES) { if (!CopyFile(filepath,fpath,0)) { err_out("E_CTFF",filepath,fpath); return; } } if (parse_address(upl,&zone,&net,&node,&point)<3) ERR_MSG2_RET("E_INVALUPL",upl); CFido fid=upl; char phone[300],psw[300],aka[300],ffixpsw[300],replace_buf[100]; CString repl; memset(replace_buf,0,sizeof(replace_buf)); fid.GetPhoneAndPwd(phone,psw,aka,ffixpsw); if (parse_address(aka,&myzone,&mynet,&mynode,&mypoint)<3) ERR_MSG2_RET("E_INVALUPO",upl); m_replace.GetWindowText(repl); trim_all(repl); if (repl.GetLength()>0) strcpy(replace_buf,repl); ret=make_tic_file(zone,net,node, point,myzone,mynet,mynode, mypoint, filepath,ffixpsw,desc,echotag,m_deleteafter.GetCheck(), replace_buf,magic); show_msg(ret ? L("S_176") : L("S_237"),200); // Done/Error CDialog::OnOK(); }