~singpolyma/biboumi

ref: f0d9273da61ce154dbe460cf58c98de851d30615 biboumi/src/main.cpp -rw-r--r-- 743 bytes
f0d9273d — Florent Le Coz Add a Config module, and use it to get the password from a file 10 years ago
                                                                                
ccebe901 Florent Le Coz
f0d9273d Florent Le Coz
bf7b05ef Florent Le Coz
f0d9273d Florent Le Coz
bf7b05ef Florent Le Coz
f0d9273d Florent Le Coz
64c1b28c Florent Le Coz
f0d9273d Florent Le Coz
ccebe901 Florent Le Coz
f0d9273d Florent Le Coz
ccebe901 Florent Le Coz
64c1b28c Florent Le Coz
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <xmpp/xmpp_component.hpp>
#include <network/poller.hpp>
#include <config/config.hpp>

#include <iostream>
#include <memory>

int main(int ac, char** av)
{
  if (ac > 1)
    Config::filename = av[1];
  Config::file_must_exist = true;

  std::string password;
  try { // The file must exist
    password = Config::get("password", "");
  }
  catch (const std::ios::failure& e) {
    return 1;
  }
  if (password.empty())
    {
      std::cerr << "No password provided." << std::endl;
      return 1;
    }
  std::shared_ptr<XmppComponent> xmpp_component =
    std::make_shared<XmppComponent>("irc.abricot", password);

  Poller p;
  p.add_socket_handler(xmpp_component);
  xmpp_component->start();
  while (p.poll())
    ;
  return 0;
}