forked from pgul/binkd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ftndom.c
56 lines (49 loc) · 1.48 KB
/
ftndom.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* ftndom.c -- Source to handle FTN Domains
*
* ftndom.c is a part of binkd project
*
* Copyright (C) 1996,1997 Dima Maloff, 5047/13
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. See COPYING.
*/
#include <stdio.h>
#include "sys.h"
#include "ftndom.h"
#include "tools.h"
/*
* 0 == domain not found
*/
FTN_DOMAIN *get_domain_info (char *domain_name, FTN_DOMAIN *pDomains)
{
FTN_DOMAIN *curr;
for (curr = pDomains; curr; curr = curr->next)
if (!STRICMP (curr->name, domain_name))
return curr;
return 0;
}
char *get_matched_domain (int zone, FTN_ADDR *pAddr, int nAddr, FTN_DOMAIN *pDomains)
{
FTN_DOMAIN *curr;
char *p;
int n;
/* Is it default zone for a domain? */
for (curr = pDomains; curr; curr = curr->next)
if (!curr->alias4 && curr->z[0] == zone)
return curr->name;
/* Do we have an AKA with this zone? */
if(pAddr)
for (n = 0; n < nAddr; n++)
if (zone == pAddr[n].z)
return pAddr[n].domain;
/* No defined domain, try to guess defaults */
if (nAddr && pAddr)
p = pAddr[0].domain; /* If we have nodes defined, use main AKA */
else
p = pDomains->name; /* Use first domain (at least one always defined at this point) */
Log(1, "Cannot find domain for zone %d, assuming '%s'", zone, p);
return p;
}