Thefoggiest.dev

“Why yes, I do have the foggiest”

How not to connect to Quassel using Rust

April 18, 2024

Quassel is an open-source Internet Relay Client (IRC) client-server system that allows multiple clients to connect to a single server, enabling users to maintain a persistent connection to IRC networks. The quassel-core server runs as a daemon, while the client provides a graphical interface for users to interact with the server. This allows users to connect to the server from multiple devices and locations while maintaining the same chat history and preferences. IRC is an older chat protocol that is still very much in use but lacks this functionality by itself.

Some time ago, I was wondering if ChatGPT could help me start writing a Quassel client in Rust. This is what it came up with:

To connect to a quassel-core server in Rust, you can use the quassel crate, which provides a high-level API for interacting with a quassel-core server.

Here is an example of how to connect to a quassel-core server and retrieve the list of IRC networks:

use quassel::Connection;

fn main() -> quassel::Result<()> {
  // Connect to the quassel-core server
  let mut conn = Connection::connect(("localhost", 4242))?;

  // Authenticate with the server
  conn.auth("username", "password")?;

  // Retrieve the list of IRC networks
  let networks = conn.get_networks()?;

  // Print the list of network names
  for network in networks {
      println!("{}", network.name);
  }

  Ok(())
}

It continued explaining the code snippet, and it all made perfect sense, except for one tiny problem: the crate (Rust package) “quassel” does not exist. I asked ChatGPT about that, to which it responded:

Yes, you can add the following line to your Cargo.toml file to use the Quassel crate:

[dependencies]
quassel = "0.1.0"

That is basically just not admitting its mistake, or even showing its awareness of it. When confronting it with that fact, it told me that during its last update in September 2021, the crate did exist, and it suggested I ask the Rust community or search forums. I have, but if it ever existed, apparently nobody has even seen it. There is, in fact, a libquassel crate that is now four years old, but it works rather differently from how ChatGPT’s imaginary “quassel” crate would work, at least according to the code it provided. Since libquassel already existed in September 2021, I wonder why it isn’t aware of it.

Anyone can make mistakes and, I suppose, so does anything. The above code, however, as suggested by ChatGPT, is not just faulty, it is complete fiction. We all know AI is not perfect and there is always the disclaimer to check important information, but if a colleague would offer this suggestion, I would look at them funny for a moment and not trust them any more.

AI is currently put in, behind and on top of everything, and it seems like we are expecting it to write our book reports, take our jobs and solve our climate crisis. The above is of course just one anecdotal example (though I have more; stay tuned) but it failed so epically here, I think we’re collectively in for one massive disappointment.

Categories: openai

Tags: internet-relay-chat, rust

CC-BY-SA 2006-2024 thefoggiest.dev