summary refs log blame commit diff stats
path: root/src/common/userlist.h
blob: 0c53dc71a9ea5aed7aed534325c68e68de485cc1 (plain) (tree)


















                                                                            
                 
                      
 

                          






                           
                      














                                                                                                       
                                                                                                                            
                                                                      
                                                                     
                                                             


                                                             

                                                                                                     
                                                
                                                             




                                                                            

                                                                           

      
/* HexChat
 * Copyright (C) 1998-2010 Peter Zelezny.
 * Copyright (C) 2009-2013 Berke Viktor.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#include <time.h>
#include "proto-irc.h"

#ifndef HEXCHAT_USERLIST_H
#define HEXCHAT_USERLIST_H

struct User
{
	char nick[NICKLEN];
	char *hostname;
	char *realname;
	char *servername;
	char *account;
	time_t lasttalk;
	unsigned int access;	/* axs bit field */
	char prefix[2]; /* @ + % */
	unsigned int op:1;
	unsigned int hop:1;
	unsigned int voice:1;
	unsigned int me:1;
	unsigned int away:1;
	unsigned int selected:1;
};

#define USERACCESS_SIZE 12

int userlist_add_hostname (session *sess, char *nick,
									char *hostname, char *realname,
									char *servername, char *account, unsigned int away);
void userlist_set_away (session *sess, char *nick, unsigned int away);
void userlist_set_account (session *sess, char *nick, char *account);
struct User *userlist_find (session *sess, const char *name);
struct User *userlist_find_global (server *serv, char *name);
void userlist_clear (session *sess);
void userlist_free (session *sess);
void userlist_add (session *sess, char *name, char *hostname, char *account,
						 char *realname, const message_tags_data *tags_data);
int userlist_remove (session *sess, char *name);
void userlist_remove_user (session *sess, struct User *user);
int userlist_change (session *sess, char *oldname, char *newname);
void userlist_update_mode (session *sess, char *name, char mode, char sign);
GSList *userlist_flat_list (session *sess);
GList *userlist_double_list (session *sess);
void userlist_rehash (session *sess);
int nick_cmp_az_ops (server *serv, struct User *user1, struct User *user2);
int nick_cmp_alpha (struct User *user1, struct User *user2, server *serv);

#endif
b_dir); } static void plugingui_loadbutton_cb (GtkWidget * wid, gpointer unused) { plugingui_load (); } static void plugingui_unload (GtkWidget * wid, gpointer unused) { int len; char *modname, *file, *buf; GtkTreeView *view; GtkTreeIter iter; view = g_object_get_data (G_OBJECT (plugin_window), "view"); if (!gtkutil_treeview_get_selected (view, &iter, NAME_COLUMN, &modname, FILE_COLUMN, &file, -1)) return; len = strlen (file); #ifdef WIN32 if (len > 4 && g_ascii_strcasecmp (file + len - 4, ".dll") == 0) #else #if defined(__hpux) if (len > 3 && g_ascii_strcasecmp (file + len - 3, ".sl") == 0) #else if (len > 3 && g_ascii_strcasecmp (file + len - 3, ".so") == 0) #endif #endif { if (plugin_kill (modname, FALSE) == 2) fe_message (_("That plugin is refusing to unload.\n"), FE_MSG_ERROR); } else { /* let python.so or perl.so handle it */ buf = malloc (strlen (file) + 10); if (strchr (file, ' ')) sprintf (buf, "UNLOAD \"%s\"", file); else sprintf (buf, "UNLOAD %s", file); handle_command (current_sess, buf, FALSE); free (buf); } g_free (modname); g_free (file); } void plugingui_open (void) { GtkWidget *view; GtkWidget *vbox, *hbox; if (plugin_window) { mg_bring_tofront (plugin_window); return; } plugin_window = mg_create_generic_tab ("Addons", _(DISPLAY_NAME": Plugins and Scripts"), FALSE, TRUE, plugingui_close, NULL, 500, 250, &vbox, 0); gtkutil_destroy_on_esc (plugin_window); view = plugingui_treeview_new (vbox); g_object_set_data (G_OBJECT (plugin_window), "view", view); hbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0); gtkutil_button (hbox, GTK_STOCK_REVERT_TO_SAVED, NULL, plugingui_loadbutton_cb, NULL, _("_Load...")); gtkutil_button (hbox, GTK_STOCK_DELETE, NULL, plugingui_unload, NULL, _("_UnLoad")); fe_pluginlist_update (); gtk_widget_show_all (plugin_window); }