139 |
|
|
140 |
/* replace callsign area: UA9IA/0 -> UA0IA */ |
/* replace callsign area: UA9IA/0 -> UA0IA */ |
141 |
static gchar * |
static gchar * |
142 |
replace (gchar *c, gint area) |
change_callsignarea (gchar *c, gint area) |
143 |
{ |
{ |
144 |
gchar *end, *j; |
gchar *end, *j; |
145 |
|
|
149 |
switch (*j) |
switch (*j) |
150 |
{ |
{ |
151 |
case '0' ... '9': |
case '0' ... '9': |
|
if ((j - c) > 1) |
|
152 |
*j = area + 48; |
*j = area + 48; |
153 |
break; |
break; |
154 |
} |
} |
156 |
return(g_strdup(c)); |
return(g_strdup(c)); |
157 |
} |
} |
158 |
|
|
159 |
/* extract prefix from a c */ |
/* extract prefix from a callsign in case '/' is used */ |
160 |
static gchar * |
static gchar * |
161 |
getpx (gchar *checkcall) |
getpx (gchar *checkcall) |
162 |
{ |
{ |
167 |
if (strchr(checkcall, '/')) |
if (strchr(checkcall, '/')) |
168 |
{ |
{ |
169 |
split = g_strsplit(checkcall, "/", 2); |
split = g_strsplit(checkcall, "/", 2); |
170 |
if (split[1]) /* we might be typing */ |
if (split[1]) |
171 |
{ |
{ /* length after '/' might still be 0 because we are typing */ |
172 |
if ((strlen(split[1]) > 1) |
if ((strlen(split[1]) > 1) |
173 |
&& (strlen(split[1]) < strlen(split[0]))) |
&& (strlen(split[1]) < strlen(split[0]))) |
174 |
/* this might be a candidate */ |
/* this might be a candidate */ |
175 |
{ |
{ |
176 |
if (g_ascii_strcasecmp(split[1], "QRP") == 0) |
if (g_ascii_strcasecmp(split[1], "QRP") == 0) |
177 |
px = g_strdup(split[0]); |
px = g_strdup(split[0]); |
178 |
|
else if (g_ascii_strcasecmp(split[1], "MM") == 0) |
179 |
|
px = g_strdup(split[0]); |
180 |
|
else if (g_ascii_strcasecmp(split[1], "AM") == 0) |
181 |
|
px = g_strdup(split[0]); |
182 |
else |
else |
183 |
px = g_strdup(split[1]); |
px = g_strdup(split[1]); |
184 |
} |
} |
185 |
else if ((strlen(split[1]) == 1) && atoi(split[1])) |
else if (atoi(split[1])) |
186 |
/* c area changed */ |
/* callsign area changed */ |
187 |
{ |
px = change_callsignarea(split[0], atoi(split[1])); |
188 |
px = replace(split[0], atoi(split[1])); |
else |
189 |
} |
px = g_strdup(split[0]); |
|
else px = g_strdup(split[0]); |
|
190 |
} |
} |
191 |
else px = g_strdup(split[0]); |
else |
192 |
|
px = g_strdup(split[0]); |
193 |
g_strfreev(split); |
g_strfreev(split); |
194 |
} |
} |
195 |
else |
else |