示例#1
0
文件: adduser.c 项目: cstim/aqbanking
static int getBankUrl(AB_BANKING *ab,
                      const char *bankId,
                      GWEN_BUFFER *bufServer)
{
  AB_BANKINFO *bi;

  bi=AB_Banking_GetBankInfo(ab, "de", 0, bankId);
  if (bi) {
    AB_BANKINFO_SERVICE_LIST *l;
    AB_BANKINFO_SERVICE *sv;

    l=AB_BankInfo_GetServices(bi);
    assert(l);
    sv=AB_BankInfoService_List_First(l);
    while (sv) {
      const char *st;

      st=AB_BankInfoService_GetType(sv);
      if (st && *st && strcasecmp(st, "ebics")==0) {
        const char *addr;

        addr=AB_BankInfoService_GetAddress(sv);
        if (addr && *addr) {
          GWEN_Buffer_Reset(bufServer);
          GWEN_Buffer_AppendString(bufServer, addr);
          return 0;
        }
      }
      sv=AB_BankInfoService_List_Next(sv);
    }
    AB_BankInfo_free(bi);
  } /* if bank info */

  return -1;
}
示例#2
0
static void createListBoxString(const AB_BANKINFO *bi, GWEN_BUFFER *tbuf)
{
  const char *s;
  AB_BANKINFO_SERVICE *sv;
  uint32_t pos;
  int svsAdded=0;

  s=AB_BankInfo_GetBankId(bi);
  if (s && *s)
    GWEN_Buffer_AppendString(tbuf, s);
  GWEN_Buffer_AppendString(tbuf, "\t");

  s=AB_BankInfo_GetBic(bi);
  if (s && *s)
    GWEN_Buffer_AppendString(tbuf, s);
  GWEN_Buffer_AppendString(tbuf, "\t");

  s=AB_BankInfo_GetBankName(bi);
  if (s && *s)
    GWEN_Buffer_AppendString(tbuf, s);
  GWEN_Buffer_AppendString(tbuf, "\t");

  s=AB_BankInfo_GetLocation(bi);
  if (s && *s)
    GWEN_Buffer_AppendString(tbuf, s);
  GWEN_Buffer_AppendString(tbuf, "\t");

  pos=GWEN_Buffer_GetPos(tbuf);
  sv=AB_BankInfoService_List_First(AB_BankInfo_GetServices(bi));
  while (sv) {
    const char *s;

    s=AB_BankInfoService_GetType(sv);
    if (s && *s) {
      const char *p;

      p=GWEN_Buffer_GetStart(tbuf)+pos;
      if (strstr(p, s)==NULL) {
        if (svsAdded)
          GWEN_Buffer_AppendString(tbuf, ", ");
        GWEN_Buffer_AppendString(tbuf, s);
        svsAdded++;
      }
    }
    sv=AB_BankInfoService_List_Next(sv);
  }
}
示例#3
0
int getBankUrl(AB_BANKING *ab,
               AH_CRYPT_MODE cm,
	       const char *bankId,
	       GWEN_BUFFER *bufServer) {
  AB_BANKINFO *bi;
  
  bi=AB_Banking_GetBankInfo(ab, "de", 0, bankId);
  if (bi) {
    AB_BANKINFO_SERVICE_LIST *l;
    AB_BANKINFO_SERVICE *sv;
  
    l=AB_BankInfo_GetServices(bi);
    assert(l);
    sv=AB_BankInfoService_List_First(l);
    while(sv) {
      const char *st;
  
      st=AB_BankInfoService_GetType(sv);
      if (st && *st && strcasecmp(st, "hbci")==0) {
	const char *svm;
  
	svm=AB_BankInfoService_GetMode(sv);
	if (svm && *svm) {
	  if (!
	      ((strcasecmp(svm, "pintan")==0) ^
               (cm==AH_CryptMode_Pintan))){
            const char *addr;

            addr=AB_BankInfoService_GetAddress(sv);
	    if (addr && *addr) {
	      GWEN_Buffer_Reset(bufServer);
	      GWEN_Buffer_AppendString(bufServer, addr);
              return 0;
	    }
	  }
	}
      }
      sv=AB_BankInfoService_List_Next(sv);
    }
    AB_BankInfo_free(bi);
  } /* if bank info */

  return -1;
}
示例#4
0
void AB_BankInfo_SetServices(AB_BANKINFO *st, AB_BANKINFO_SERVICE_LIST *d) {
  assert(st);
  if (st->services)
    AB_BankInfoService_List_free(st->services);
  if (d) {
    AB_BANKINFO_SERVICE *e;

  st->services=AB_BankInfoService_List_new();
    e=AB_BankInfoService_List_First(d);
    while(e) {
      AB_BANKINFO_SERVICE *ne;

      ne=AB_BankInfoService_dup(e);
      assert(ne);
      AB_BankInfoService_List_Add(ne, st->services);
      e=AB_BankInfoService_List_Next(e);
    } /* while (e) */
  } /* if LIST */
  else
    st->services=0;
  st->_modified=1;
}
示例#5
0
int AH_NewKeyFileDialog_HandleActivatedBankCode(GWEN_DIALOG *dlg) {
  AH_NEWKEYFILE_DIALOG *xdlg;
  GWEN_DIALOG *dlg2;
  int rv;

  assert(dlg);
  xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AH_NEWKEYFILE_DIALOG, dlg);
  assert(xdlg);

  dlg2=AB_SelectBankInfoDialog_new(xdlg->banking, "de", NULL);
  if (dlg2==NULL) {
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Could not create dialog");
    GWEN_Gui_ShowError(I18N("Error"), "%s", I18N("Could not create dialog, maybe an installation error?"));
    return GWEN_DialogEvent_ResultHandled;
  }

  rv=GWEN_Gui_ExecDialog(dlg2, 0);
  if (rv==0) {
    /* rejected */
    GWEN_Dialog_free(dlg2);
    return GWEN_DialogEvent_ResultHandled;
  }
  else {
    const AB_BANKINFO *bi;

    bi=AB_SelectBankInfoDialog_GetSelectedBankInfo(dlg2);
    if (bi) {
      const char *s;
      AB_BANKINFO_SERVICE *sv;

      s=AB_BankInfo_GetBankId(bi);
      GWEN_Dialog_SetCharProperty(dlg,
				  "wiz_bankcode_edit",
				  GWEN_DialogProperty_Value,
				  0,
				  (s && *s)?s:"",
				  0);

      s=AB_BankInfo_GetBankName(bi);
      GWEN_Dialog_SetCharProperty(dlg,
				  "wiz_bankname_edit",
				  GWEN_DialogProperty_Value,
				  0,
				  (s && *s)?s:"",
				  0);
      sv=AB_BankInfoService_List_First(AB_BankInfo_GetServices(bi));
      while(sv) {
	const char *s;

	s=AB_BankInfoService_GetType(sv);
	if (s && *s && strcasecmp(s, "HBCI")==0) {
	  s=AB_BankInfoService_GetMode(sv);
	  if (s && *s && strncasecmp(s, "RDH", 3)==0)
	    break;
	}
	sv=AB_BankInfoService_List_Next(sv);
      }

      if (sv) {
	/* RDH service found */
	s=AB_BankInfoService_GetMode(sv);
	if (s && *s) {
	  if (strcasecmp(s, "RDH1")==0)
	    xdlg->rdhVersion=1;
	  else if (strcasecmp(s, "RDH2")==0)
	    xdlg->rdhVersion=2;
	  else if (strcasecmp(s, "RDH3")==0)
	    xdlg->rdhVersion=3;
	  else if (strcasecmp(s, "RDH4")==0)
	    xdlg->rdhVersion=4;
	  else if (strcasecmp(s, "RDH5")==0)
	    xdlg->rdhVersion=5;
	  else if (strcasecmp(s, "RDH6")==0)
	    xdlg->rdhVersion=6;
	  else if (strcasecmp(s, "RDH7")==0)
	    xdlg->rdhVersion=7;
	  else if (strcasecmp(s, "RDH8")==0)
	    xdlg->rdhVersion=8;
	  else if (strcasecmp(s, "RDH9")==0)
	    xdlg->rdhVersion=9;
	  else if (strcasecmp(s, "RDH10")==0)
	    xdlg->rdhVersion=10;
	  else if (strcasecmp(s, "RDH")==0)
	    xdlg->rdhVersion=1;
	}

	s=AB_BankInfoService_GetAddress(sv);
	GWEN_Dialog_SetCharProperty(dlg,
				    "wiz_url_edit",
				    GWEN_DialogProperty_Value,
				    0,
				    (s && *s)?s:"",
				    0);
	s=AB_BankInfoService_GetPversion(sv);
	if (s && *s) {
	  if (strcasecmp(s, "2.01")==0 ||
	      strcasecmp(s, "2")==0)
	    xdlg->hbciVersion=201;
	  else if (strcasecmp(s, "2.10")==0 ||
		   strcasecmp(s, "2.1")==0)
	    xdlg->hbciVersion=210;
	  else if (strcasecmp(s, "2.20")==0 ||
		   strcasecmp(s, "2.2")==0)
	    xdlg->hbciVersion=220;
	  else if (strcasecmp(s, "3.00")==0 ||
		   strcasecmp(s, "3.0")==0 ||
		   strcasecmp(s, "3")==0)
	    xdlg->hbciVersion=300;
	  else if (strcasecmp(s, "4.00")==0 ||
		   strcasecmp(s, "4.0")==0 ||
		   strcasecmp(s, "4")==0)
	    xdlg->hbciVersion=400;
	}
      }
    }
  }

  GWEN_Dialog_free(dlg2);

  if (AH_NewKeyFileDialog_GetBankPageData(dlg)<0)
    GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 0, 0);
  else
    GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0);

  return GWEN_DialogEvent_ResultHandled;
}
示例#6
0
int AB_BankInfo_toDb(const AB_BANKINFO *st, GWEN_DB_NODE *db) {
  assert(st);
  assert(db);
  if (st->country)
    if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "country", st->country))
      return -1;
  if (st->branchId)
    if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "branchId", st->branchId))
      return -1;
  if (st->bankId)
    if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "bankId", st->bankId))
      return -1;
  if (st->bic)
    if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "bic", st->bic))
      return -1;
  if (st->bankName)
    if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "bankName", st->bankName))
      return -1;
  if (st->location)
    if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "location", st->location))
      return -1;
  if (st->street)
    if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "street", st->street))
      return -1;
  if (st->zipcode)
    if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "zipcode", st->zipcode))
      return -1;
  if (st->city)
    if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "city", st->city))
      return -1;
  if (st->region)
    if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "region", st->region))
      return -1;
  if (st->phone)
    if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "phone", st->phone))
      return -1;
  if (st->fax)
    if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "fax", st->fax))
      return -1;
  if (st->email)
    if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "email", st->email))
      return -1;
  if (st->website)
    if (GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "website", st->website))
      return -1;
  if (st->services)
  if (1) {
    GWEN_DB_NODE *dbT;
    AB_BANKINFO_SERVICE *e;

    dbT=GWEN_DB_GetGroup(db, GWEN_PATH_FLAGS_CREATE_GROUP, "services");
    assert(dbT);
    e=AB_BankInfoService_List_First(st->services);
    while(e) {
      if (AB_BankInfoService_toDb(e, GWEN_DB_GetGroup(dbT, GWEN_PATH_FLAGS_CREATE_GROUP, "element")))
        return -1;
      e=AB_BankInfoService_List_Next(e);
    } /* while */
  } /* if (1) */
  return 0;
}