138 |
} |
} |
139 |
|
|
140 |
static gchar * |
static gchar * |
141 |
|
replace (gchar *callsign, gint area) |
142 |
|
{ |
143 |
|
gchar *end, *j; |
144 |
|
|
145 |
|
end = callsign + strlen (callsign); |
146 |
|
for (j = callsign; j < end; ++j) |
147 |
|
{ |
148 |
|
switch (*j) |
149 |
|
{ |
150 |
|
case '0' ... '9': |
151 |
|
if ((j - callsign) > 1) |
152 |
|
*j = area + 48; |
153 |
|
break; |
154 |
|
} |
155 |
|
} |
156 |
|
|
157 |
|
return(g_strdup(callsign)); |
158 |
|
} |
159 |
|
|
160 |
|
static gchar * |
161 |
getpx (gchar *checkcall) |
getpx (gchar *checkcall) |
162 |
{ |
{ |
163 |
|
|
170 |
if (split[1]) /* we might be typing */ |
if (split[1]) /* we might be typing */ |
171 |
{ |
{ |
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 */ |
175 |
{ |
{ |
176 |
if ((g_strcasecmp(split[1], "AM") == 0) || |
if ((g_strcasecmp(split[1], "AM") == 0) || |
177 |
(g_strcasecmp(split[1], "MM") == 0)) |
(g_strcasecmp(split[1], "MM") == 0)) |
180 |
pxstr = g_strdup(split[0]); |
pxstr = g_strdup(split[0]); |
181 |
else pxstr = g_strdup(split[1]); |
else pxstr = g_strdup(split[1]); |
182 |
} |
} |
183 |
|
else if ((strlen(split[1]) == 1) && atoi(split[1])) |
184 |
|
/* callsign area changed */ |
185 |
|
{ |
186 |
|
pxstr = replace(split[0], atoi(split[1])); |
187 |
|
} |
188 |
} |
} |
189 |
else pxstr = g_strdup(split[0]); |
else pxstr = g_strdup(split[0]); |
190 |
g_strfreev(split); |
g_strfreev(split); |
191 |
} |
} |
192 |
else pxstr = g_strdup(checkcall); |
else pxstr = g_strdup(checkcall); |
193 |
|
|
194 |
return(pxstr); |
return(pxstr); |
195 |
} |
} |
196 |
|
|