Ejemplo n.º 1
0
 public void setArchiveMode(String account, ArchiveMode archiveMode) {
   AccountItem accountItem = AccountManager.getInstance().getAccount(account);
   AccountManager.getInstance()
       .updateAccount(
           account,
           accountItem.getConnectionSettings().isCustom(),
           accountItem.getConnectionSettings().getHost(),
           accountItem.getConnectionSettings().getPort(),
           accountItem.getConnectionSettings().getServerName(),
           accountItem.getConnectionSettings().getUserName(),
           accountItem.isStorePassword(),
           accountItem.getConnectionSettings().getPassword(),
           accountItem.getConnectionSettings().getResource(),
           accountItem.getPriority(),
           accountItem.isEnabled(),
           accountItem.getConnectionSettings().isSaslEnabled(),
           accountItem.getConnectionSettings().getTlsMode(),
           accountItem.getConnectionSettings().useCompression(),
           accountItem.getConnectionSettings().getProxyType(),
           accountItem.getConnectionSettings().getProxyHost(),
           accountItem.getConnectionSettings().getProxyPort(),
           accountItem.getConnectionSettings().getProxyUser(),
           accountItem.getConnectionSettings().getProxyPassword(),
           accountItem.isSyncable(),
           archiveMode);
 }
Ejemplo n.º 2
0
  @Override
  public void sendMessage(final FriendMessage message) {

    HashMap<String, Friend> friends = AccountManager.getInstance().getFriends();
    Friend friend = friends.get(message.getTo());
    Screenname buddy = new Screenname(friend.getUserName());
    Conversation c = (Conversation) friend.getUserInfo();
    if (c == null) {
      c = connection.getIcbmService().getImConversation(buddy);
      friend.setUserInfo(c);
    }
    Message oscarMessage =
        new Message() {

          public boolean isAutoResponse() {
            return false;
          }

          public String getMessageBody() {
            return message.getMessage();
          }
        };
    c.sendMessage(oscarMessage);
    Friend recipient = friends.get(message.getTo());
    accountListener.didReceiveMessageForFriend(message, recipient);
  }
Ejemplo n.º 3
0
  private void readConfigure() throws FileNotFoundException {
    ConfigureManager configureManager = new ConfigureManager();
    AccountManager accountManager = new AccountManager();
    ProblemManager problemManager = new ProblemManager();
    SubmissionManager submissionManager = new SubmissionManager();
    QAManager qaManager = new QAManager();
    ClarificationManager clarificationManager = new ClarificationManager();
    Map<String, String> config = new HashMap<String, String>();

    configureManager.createTable();
    accountManager.createTable();
    problemManager.createTable();
    submissionManager.createTable();
    qaManager.createTable();
    clarificationManager.createTable();
    this.port = 8888;
    this.scoreBoardPort = 8889;
    // default port

    File file = new File("config.txt");
    try (BufferedReader br = new BufferedReader(new FileReader(file))) {
      String line;
      while ((line = br.readLine()) != null) {
        String[] sp = line.split(":");
        if (sp[0].equals("port")) this.port = Integer.valueOf(sp[1]);
        else if (sp[0].equals("scoreboardport")) this.scoreBoardPort = Integer.valueOf(sp[1]);
        else if (sp[0].equals("team")) {
          readTeamAccount(sp[1]);
        } else if (sp[0].equals("judge")) {
          readJudgeAccount(sp[1]);
        } else if (sp[0].equals("problem")) {
          readProblemInfo(sp[1]);
        }
      }
    } catch (IOException e) {
      e.printStackTrace();
      System.exit(1);
    }

    config.put("ip", this.ip.getHostAddress());
    config.put("port", Integer.toString(this.port));
    config.put("scoreboard_port", Integer.toString(this.scoreBoardPort));
    config.put("start_time", "0");
    config.put("duration", "300");
    config.put("time_stamp", "0");
    configureManager.addEntry(config);
  }
Ejemplo n.º 4
0
 private void readJudgeAccount(String pathName) {
   AccountManager accountManager = new AccountManager();
   File file = new File(pathName);
   try (BufferedReader br = new BufferedReader(new FileReader(file))) {
     String line;
     while ((line = br.readLine()) != null) {
       String[] sp = line.split(",");
       this.judges.put(sp[0], new Judge(sp[0], null));
       Map<String, String> judge_account = new HashMap<String, String>();
       judge_account.put("account", sp[0]);
       judge_account.put("password", sp[1]);
       judge_account.put("type", "judge");
       accountManager.addEntry(judge_account);
     }
   } catch (IOException e) {
     e.printStackTrace();
     System.exit(1);
   }
 }
Ejemplo n.º 5
0
 /**
  * Sets status for all accounts.
  *
  * @param statusMode
  * @param statusText can be <code>null</code> if value was not changed.
  */
 public void setStatus(StatusMode statusMode, String statusText) {
   SettingsManager.setStatusMode(statusMode);
   if (statusText != null) {
     addSavedStatus(statusMode, statusText);
     SettingsManager.setStatusText(statusText);
   }
   for (AccountItem accountItem : accountItems.values()) {
     setStatus(
         accountItem, statusMode, statusText == null ? accountItem.getStatusText() : statusText);
   }
   resendPresence();
   onAccountsChanged(new ArrayList<String>(AccountManager.getInstance().getAllAccounts()));
 }
Ejemplo n.º 6
0
 protected UserAccount getUserAccount() {
   if (acctMgr != null) {
     return acctMgr.getUser(getUsername());
   }
   return AccountManager.NOBODY_ACCOUNT;
 }