示例#1
0
void MyIrcSession::on_connected() {
	m_connected = true;
	if (suffix.empty()) {
		np->handleConnected(user);
	}

	for(std::list<std::string>::const_iterator it = m_autoJoin.begin(); it != m_autoJoin.end(); it++) {
		sendCommand(IrcCommand::createJoin(FROM_UTF8(*it)));
	}

	if (getIdentify().find(" ") != std::string::npos) {
		std::string to = getIdentify().substr(0, getIdentify().find(" "));
		std::string what = getIdentify().substr(getIdentify().find(" ") + 1);
		sendCommand(IrcCommand::createMessage(FROM_UTF8(to), FROM_UTF8(what)));
	}
}
void BMDSmartViewClient::printStateToSerial()	{
	for(uint8_t monId=0; monId<=1; monId++)	{
		Serial.print(F("Monitor "));
		Serial.println(monId==0?F("A:"):F("B:"));
		
		Serial.print(F("Brightness: "));
		Serial.println(getBrightness(monId));

		Serial.print(F("Contrast: "));
		Serial.println(getContrast(monId));

		Serial.print(F("Saturation: "));
		Serial.println(getSaturation(monId));

		Serial.print(F("Identify: "));
		Serial.println(getIdentify(monId));

		Serial.print(F("Border: "));
		Serial.println(getBorder(monId));

		Serial.print(F("WidescreenSD: "));
		Serial.println(getWidescreenSD(monId));

		Serial.print(F("ScopeMode: "));
		Serial.println(getScopeMode(monId));

		Serial.print(F("AudioChannel: "));
		Serial.println(getAudioChannel(monId));
		
		Serial.println();
	}
}
示例#3
0
void MyIrcSession::on_connected() {
	m_connected = true;
	if (suffix.empty()) {
		np->handleConnected(user);
// 		if (!sentList) {
// 			sendCommand(IrcCommand::createList("", ""));
// 			sentList = true;
// 		}
	}

// 	sendCommand(IrcCommand::createCapability("REQ", QStringList("away-notify")));

	for(AutoJoinMap::iterator it = m_autoJoin.begin(); it != m_autoJoin.end(); it++) {
		sendCommand(IrcCommand::createJoin(FROM_UTF8(it->second->getChannel()), FROM_UTF8(it->second->getPassword())));
	}

	if (getIdentify().find(" ") != std::string::npos) {
		std::string to = getIdentify().substr(0, getIdentify().find(" "));
		std::string what = getIdentify().substr(getIdentify().find(" ") + 1);
		sendCommand(IrcCommand::createMessage(FROM_UTF8(to), FROM_UTF8(what)));
	}
}
示例#4
0
int
main(int argc, char** argv)
{
  if (argc == 1) {
    fprintf(stderr, "Usage: %s (save|load|add|delete|rename|select|list|statusbar|toggle_statusbar|checkupdate|set_checkupdate) [params]\n", argv[0]);
    return 1;
  }

  bool isSuccess = false;

  if (strcmp(argv[1], "select") == 0) {
    if (argc < 3) {
      fprintf(stderr, "Usage: %s select index\n", argv[0]);
      goto finish;
    }
    int index = atoi(argv[2]);
    isSuccess = setSelectedIndex(index);

  } else if (strcmp(argv[1], "add") == 0) {
    isSuccess = appendConfig();

  } else if (strcmp(argv[1], "delete") == 0) {
    if (argc < 3) {
      fprintf(stderr, "Usage: %s delete index\n", argv[0]);
      goto finish;
    }
    int index = atoi(argv[2]);
    isSuccess = removeConfig(index);

  } else if (strcmp(argv[1], "rename") == 0) {
    // sysctl_ctl rename "index" "newname"
    if (argc < 4) {
      fprintf(stderr, "Usage: %s rename index newname\n", argv[0]);
      goto finish;
    }
    int index = atoi(argv[2]);
    char buf[512];
    snprintf(buf, sizeof(buf), "%s", argv[3]);
    stripString(buf, sizeof(buf));
    if (buf[0] == '\0') {
      snprintf(buf, sizeof(buf), "(null)");
    }
    isSuccess = renameConfig(index, buf);

  } else if (strcmp(argv[1], "list") == 0) {
    outputConfigList();
    return 0;

  } else if (strcmp(argv[1], "statusbar") == 0) {
    printf("%ld\n", getValue(CFSTR("isStatusbarEnable")));
    return 0;

  } else if (strcmp(argv[1], "toggle_statusbar") == 0) {
    CFStringRef name = CFSTR("isStatusbarEnable");
    CFIndex value = getValue(name);
    isSuccess = setValue(name, ! value);

  } else if (strcmp(argv[1], "checkupdate") == 0) {
    printf("%ld\n", getValue(CFSTR("isCheckUpdate")));
    return 0;

  } else if (strcmp(argv[1], "set_checkupdate") == 0) {
    if (argc < 3) {
      fprintf(stderr, "Usage: %s set_checkupdate value\n", argv[0]);
      goto finish;
    }

    CFStringRef name = CFSTR("isCheckUpdate");
    CFIndex value = atoi(argv[2]);
    isSuccess = setValue(name, value);

  } else if ((strcmp(argv[1], "save") == 0) || (strcmp(argv[1], "load") == 0)) {
    CFIndex value = getSelectedIndex();
    CFStringRef identify = getIdentify(value);

    const char* targetFiles[] = {
      "/Library/org.pqrs/KeyRemap4MacBook/prefpane/checkbox.xml",
      "/Library/org.pqrs/KeyRemap4MacBook/prefpane/number.xml",
      NULL,
    };
    if (strcmp(argv[1], "save") == 0) {
      isSuccess = saveToFile(targetFiles, identify);
    }
    if (strcmp(argv[1], "load") == 0) {
      system("/Library/org.pqrs/KeyRemap4MacBook/bin/KeyRemap4MacBook_sysctl_reset");
      isSuccess = loadFromFile(targetFiles, identify);
    }
  }

  CFPreferencesAppSynchronize(applicationID);

finish:
  if (isSuccess) {
    fprintf(stderr, "[DONE]\n");
  } else {
    fprintf(stderr, "[ERROR]\n");
  }

  return 0;
}