コード例 #1
0
ファイル: GosLink2.java プロジェクト: BearFather/GosLink2
 public static void sayit(int tc, String msg) {
   String tmsg[] = msg.split("<4;2>0:");
   String player = tmsg[0];
   player = player.toLowerCase().trim();
   String u1 = props("muser1").toLowerCase();
   String u2 = props("muser2").toLowerCase();
   String u3 = props("muser3").toLowerCase();
   String sname = props("server" + tc + "name");
   if (TC1.ghost == 1 || TC2 != null && TC2.ghost == 1 || TC3 != null && TC3.ghost == 1) {
     tmsg[1] = tmsg[1] + "\n";
   }
   if (!player.equals(u1) && !player.equals(u2) && !player.equals(u3)) {
     for (Entry<Integer, TelnetService> t : TNH.entrySet()) {
       if (tc != t.getValue().mynum) {
         TNH.get(t.getKey())
             .write(
                 "gos  " + sname.substring(0, 1) + ": " + tmsg[0].trim() + ": " + tmsg[1].trim());
       }
     }
     for (WebClient value : WebSocket.channels) {
       if (value != null) {
         value.send(sname + ": " + tmsg[0].trim() + ": " + tmsg[1].trim());
       }
     }
     log = shift(log, tmsg[0].trim() + " gossips: " + tmsg[1].trim());
   }
 }
コード例 #2
0
  protected void sendMessage(WebClient client, String[] stocks) throws JMSException {
    Session session = client.getSession();

    int idx = 0;
    while (true) {
      idx = (int) Math.round(stocks.length * Math.random());
      if (idx < stocks.length) {
        break;
      }
    }
    String stock = stocks[idx];
    Destination destination = session.createTopic("STOCKS." + stock);
    String stockText = createStockText(stock);
    log("Sending: " + stockText + " on destination: " + destination);
    Message message = session.createTextMessage(stockText);
    client.send(destination, message);
  }
コード例 #3
0
ファイル: Router.java プロジェクト: praneethRajput/VHKTN
 public void send(String message) {
   webclient.send(message);
 }