MCPcopy Create free account
hub / github.com/annmuor/jnode / checkRobot

Method checkRobot

jnode-core/src/jnode/ftn/FtnTools.java:833–876  ·  view source on GitHub ↗

Проверям сообщение на соответствие роботу @param message @return

(FtnMessage message)

Source from the content-addressed store, hash-verified

831 * @return
832 */
833 public static boolean checkRobot(FtnMessage message) {
834 boolean isRobot = false;
835 String robotname = "";
836 if (message.isNetmail()) {
837 if (MainHandler.getCurrentInstance().getInfo().getAddressList()
838 .contains(message.getToAddr())) {
839 // TODO: optiomize
840 IRobot oRobot = robotMaps
841 .get(message.getToName().toLowerCase());
842 if (oRobot == null) {
843 try {
844 Robot robot = ORMManager.get(Robot.class).getById(
845 message.getToName().toLowerCase());
846 if (robot != null) {
847 robotname = robot.getRobot();
848 Class<?> clazz = Class
849 .forName(robot.getClassName());
850 oRobot = (IRobot) clazz.newInstance();
851 robotMaps.put(robotname, oRobot);
852 logger.l4("Message " + message.getMsgid()
853 + " sent to robot " + robotname);
854 }
855 } catch (ClassNotFoundException e) {
856 logger.l2("Robot class not found (INIT) " + robotname,
857 e);
858 } catch (Exception e) {
859 logger.l2(
860 "Robot excception " + robotname + " (INIT) ",
861 e);
862 }
863 }
864 if (oRobot != null) {
865 isRobot = true;
866 try {
867 oRobot.execute(message);
868 } catch (Exception e) {
869 logger.l2("Robot excception " + robotname
870 + " (PROCCESS) ", e);
871 }
872 }
873 }
874 }
875 return isRobot;
876 }
877
878 /**
879 * Получаем роутинг для нетмейла

Callers 1

tossNetmailMethod · 0.80

Calls 14

getCurrentInstanceMethod · 0.95
getMethod · 0.95
getRobotMethod · 0.95
getClassNameMethod · 0.95
executeMethod · 0.95
getAddressListMethod · 0.80
getInfoMethod · 0.80
getByIdMethod · 0.80
l4Method · 0.80
l2Method · 0.80
isNetmailMethod · 0.45
getToAddrMethod · 0.45

Tested by

no test coverage detected