Freeciv-3.1: chat_listener Class Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes
chat_listener Class Reference

`#include <chatline.h>`

Inheritance diagram for chat_listener:

## Public Member Functions

| chat_listener ()
virtual void | chat_message_received (const QString &, const struct text_tag_list *)
virtual void | chat_word_list_changed (const QStringList &cmplt_word_list)
void | send_chat_message (const QString &message)
int | position_in_history ()
QString | back_in_history ()
QString | forward_in_history ()
void | reset_history_position ()
QStringList | current_word_list ()

## Static Public Member Functions

static void | update_word_list ()
Static Public Member Functions inherited from listener< chat_listener >
static void | invoke (_member_fct_ function)
static void | invoke (_member_fct_ function, _arg1_t_ arg)
static void | invoke (_member_fct_ function, _arg1_t_ arg1, _arg2_t_ arg2)

## Static Public Attributes

static const int | HISTORY_END = -1

## Private Attributes

int | position

## Static Private Attributes

static QStringList | history = QStringList()
static QStringList | word_list = QStringList()

## Additional Inherited Members

Public Types inherited from listener< chat_listener >
typedef chat_listener | type_t
Protected Member Functions inherited from listener< chat_listener >
| listener ()
virtual | ~listener ()
void | listen ()

## Detailed Description

Definition at line 45 of file chatline.h.

## Constructor & Destructor Documentation

## ◆ chat_listener()

chat_listener::chat_listener | ( |  | ) |

explicit

Constructor.

Definition at line 84 of file chatline.cpp.

## Member Function Documentation

## ◆ back_in_history()

QString chat_listener::back_in_history | ( |  | ) |

Goes back one position in history, and returns the message at the new position.

Definition at line 177 of file chatline.cpp.

Referenced by chat_input::event().

## ◆ chat_message_received()

void chat_listener::chat_message_received | ( | const QString & | ,
|  | const struct text_tag_list * |
| ) |  |

virtual

Called whenever a message is received. Default implementation does nothing.

Reimplemented in chatwdg, and fc_client.

Definition at line 92 of file chatline.cpp.

Referenced by qtg_real_output_window_append().

## ◆ chat_word_list_changed()

void chat_listener::chat_word_list_changed | ( | const QStringList & | cmplt_word_list | ) |

virtual

Called whenever the completion word list changes. Default implementation does nothing.

Reimplemented in chat_input.

Definition at line 100 of file chatline.cpp.

Referenced by update_word_list().

## ◆ current_word_list()

QStringList chat_listener::current_word_list | ( |  | ) |

inline

Definition at line 74 of file chatline.h.

Referenced by chat_input::chat_input().

## ◆ forward_in_history()

QString chat_listener::forward_in_history | ( |  | ) |

Goes forward one position in history, and returns the message at the new position. An empty string is returned if the new position is HISTORY_END.

Definition at line 191 of file chatline.cpp.

Referenced by chat_input::event().

## ◆ position_in_history()

int chat_listener::position_in_history | ( |  | ) |

inline

Definition at line 69 of file chatline.h.

## ◆ reset_history_position()

void chat_listener::reset_history_position | ( |  | ) |

Go to the end of the history.

Definition at line 208 of file chatline.cpp.

Referenced by send_chat_message().

## ◆ send_chat_message()

void chat_listener::send_chat_message | ( | const QString & | message | ) |

Sends commands to server, but first searches for custom keys, if it finds then it makes custom action.

The history position is reset to HISTORY_END.

Definition at line 109 of file chatline.cpp.

Referenced by chat_input::send(), and fc_client::send_fake_chat_message().

## ◆ update_word_list()

void chat_listener::update_word_list | ( |  | ) |

static

Updates the chat completion word list.

Definition at line 58 of file chatline.cpp.

Referenced by qtg_real_output_window_append().

## Field Documentation

## ◆ history

QStringList chat_listener::history = QStringList()

staticprivate

Definition at line 48 of file chatline.h.

Referenced by back_in_history(), forward_in_history(), and send_chat_message().

## ◆ HISTORY_END

const int chat_listener::HISTORY_END = -1

static

Definition at line 57 of file chatline.h.

Referenced by back_in_history(), forward_in_history(), and reset_history_position().

## ◆ position

int chat_listener::position

private

Definition at line 50 of file chatline.h.

Referenced by back_in_history(), forward_in_history(), position_in_history(), and reset_history_position().

## ◆ word_list

QStringList chat_listener::word_list = QStringList()

staticprivate

Definition at line 53 of file chatline.h.

Referenced by current_word_list(), and update_word_list().