Method code for $smtp.parse_alias()

[Turn off line numbering]
  1: arg alias;
  2: var tmp, obj, o;
  3: 
  4: tmp = explode(alias, ":");
  5: if (listlen(tmp) != 2)
  6:     throw(~type, "Invalid alias pair '" + alias + "', should be ALIAS:OBJ");
  7: [alias, obj] = tmp;
  8: tmp = strsed(alias, "[^a-z0-9\.-]+", "", "g");
  9: if (tmp != alias)
 10:     throw(~type, "Alias must be composed of a-z, 0-9, a period or a dash");
 11: if (obj && obj[1] == "$") {
 12:     if (!(o = (| $object_lib.to_dbref(obj) |)))
 13:         throw(~type, "Invalid object: " + obj);
 14: } else if (!(o = (| $mail_lib.match_mail_recipient(obj) |))) {
 15:     throw(~type, "Invalid mail recipient: " + obj);
 16: }
 17: if (!o.is($mail_list))
 18:     throw(~type, "Object " + o + " is not a valid mail recipient.");
 19: return [alias, o];

// Created 13-Oct-1996 as a part of ColdCore, see: @help Credit

Tlon