+GLOBAL CHAR *
+Lists_MakeMask( CHAR *Pattern )
+{
+ /* Hier wird aus einem "beliebigen" Pattern eine gueltige IRC-Mask erzeugt.
+ * Diese ist aber nur bis zum naechsten Aufruf von Lists_MakeMask() gueltig,
+ * da ein einziger globaler Puffer verwendet wird. ->Umkopieren!*/
+
+ STATIC CHAR TheMask[MASK_LEN];
+ CHAR *excl, *at;
+
+ assert( Pattern );
+
+ excl = strchr( Pattern, '!' );
+ at = strchr( Pattern, '@' );
+
+ if(( at ) && ( at < excl )) excl = NULL;
+
+ if(( ! at ) && ( ! excl ))
+ {
+ /* weder ! noch @ĂŠvorhanden: als Nick annehmen */
+ strncpy( TheMask, Pattern, MASK_LEN - 5 );
+ TheMask[MASK_LEN - 5] = '\0';
+ strcat( TheMask, "!*@*" );
+ return TheMask;
+ }
+
+ if(( ! at ) && ( excl ))
+ {
+ /* Domain fehlt */
+ strncpy( TheMask, Pattern, MASK_LEN - 3 );
+ TheMask[MASK_LEN - 3] = '\0';
+ strcat( TheMask, "@*" );
+ return TheMask;
+ }
+
+ if(( at ) && ( ! excl ))
+ {
+ /* User fehlt */
+ *at = '\0'; at++;
+ strncpy( TheMask, Pattern, MASK_LEN - 4 );
+ TheMask[MASK_LEN - 4] = '\0';
+ strcat( TheMask, "!*@" );
+ strncat( TheMask, at, strlen( TheMask ) - MASK_LEN - 1 );
+ TheMask[MASK_LEN - 1] = '\0';
+ return TheMask;
+ }
+
+ /* alle Teile vorhanden */
+ strncpy( TheMask, Pattern, MASK_LEN - 1 );
+ TheMask[MASK_LEN - 1] = '\0';
+ return TheMask;
+} /* Lists_MakeMask */
+
+