summary refs log tree commit diff stats
path: root/src/common/modes.c
AgeCommit message (Collapse)Author
2013-09-06Fix detecting utf-8 on some networksTingPing
2013-06-28server-time for all numerical messages.Diogo Sousa
2013-06-28server-time supported in most named messages.Diogo Sousa
2013-04-28Make NickServ registration configurable per-networkBerke Viktor
Fixes #394
2013-04-28Get rid of some hardcoded network recognitionBerke Viktor
2013-04-07Add events for quietTingPing
2013-04-03Add MONITOR supportTingPing
2013-04-02Only include top level includes from GTK+, GLib and GDK-PixBufBerke Viktor
2013-03-25Remove old CAPAB stuffTingPing
We already check for identify-msg elsewhere
2013-03-20Redesign the Ban List window. Closes Issues #303, #342, #427RichardHitt
This is a combination of 18 commits. The first commit's message is: Here is the initial banlist branch of RichardHitt/hexchat. Changed files are only src/fe-gtk/{banlist.c,fe-gtk.h}. This version works and contains my first efforts at selective sensitization of radio buttons and control buttons. From this point I intend to undertake a stepwise redesign. Step 1 will be to make the existing banlist code work for multiple simultaneous banlist windows (for different channels, obviously). It will be a hackathon with the only goal of getting it working. Step 2 will be the objectization and alpha-stage tidying-up of all the terrible looking stuff I will have done in Step 1. This is the 2nd commit message: Here's the post-Step-1 commit. It works for multiple banlist windows. Note particularly what I've done to banlist.h. Note that for many functions in banlist.c the argument is now a banlist_info *, rather than a session *. Note in banlist.c the initialization of array modes[] which contains driving information for the checkboxes. Of course those checkboxes aren't yet implemented. Maybe in Step 2 I will change to checkboxes from radio buttons; but definitely I will change to letting modes[] drive processing. This is the 3rd commit message: Converted to checkboxes. Much additional work. Note that the infrastructure for Auto-invite is not yet present in the hexchat tree. I'm nearly done with banlist, I think! This is the 4th commit message: Fleshed out 'invite'. Tagged masks uniformly, e.g. (b) (e) (I). General cleanup, nearly at the point of beta quality. This is the 5th commit message: Added fourth mode type: quiet. Did lots and lots of cleanup. Beta-ready? This is the 6th commit message: Get the banlist timestamps properly sortable. This is the 7th commit message: Redesign the supports_foo() routines. Now they're responsible for setting the flags in ->capable, ->readable, ->writeable. This is the 8th commit message: Deleted a couple of RBH comments. This is the 9th commit message: Now the ESC key will close the banlist window. This is the 10th commit message: Fix the fe-text occurrence of fe_add_ban_list(). This is the 11th commit message: Fixed also fe_ban_list_end() and removed fe_is_banwindow(). This is the 12th commit message: Use old-style initialization for array of structures modes[] This is the 13th commit message: Oops, incomplete regression of modes[] initialization. This fixes. This is the 14th commit message: Fixed strptime buy implementing a special version here. Fixed column width concerns by setting resizable and autosize. This is the 15th commit message: Get rid of testing line. This is the 16th commit message: Changed to gtkutil_destroy_on_esc () This is the 17th commit message: Remove no-longer-used functnion This is the 18th commit message: Minor cleanups to banlist.c, banlist.h Please enter the commit message for your changes. Lines starting with '#' will be ignored, and an empty message aborts the commit. Author: RichardHitt <rbh00@netcom.com> Committer: Richard Hitt <rbh00@f17.rbh00.pacbell.net> Not currently on any branch. Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: src/common/fe.h modified: src/common/hexchat.h modified: src/common/inbound.c modified: src/common/modes.c modified: src/common/proto-irc.c modified: src/common/server.c modified: src/fe-gtk/banlist.c modified: src/fe-gtk/banlist.h modified: src/fe-gtk/fe-gtk.c modified: src/fe-gtk/fe-gtk.h modified: src/fe-gtk/maingui.c modified: src/fe-text/fe-text.c
2012-12-23fix incorrect FSF addressDan Mashal
2012-10-24A lot more rebrandingBerke Viktor
2012-10-22Variable cleanup for irc_*Berke Viktor
2012-06-16Fix string handling for Turkish localeBerke Viktor
2011-02-24add xchat r1489berkeviktor@aol.com
*/ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 * pci.c - PCI functions for X-Sys
 * Copyright (C) 1997-1999 Martin Mares <mj@atrey.karlin.mff.cuni.cz> [PCI routines from lspci]
 * Copyright (C) 2000 Tom Rini <trini@kernel.crashing.org> [XorgAutoConfig pci.c, based on lspci]
 * Copyright (C) 2005, 2006 Tony Vroon
 *
 * 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <pci/pci.h>
#include "xsys.h"

static struct pci_filter filter;       /* Device filter */
static struct pci_access *pacc;
int bus, dev, func; /* Location of the card */

struct device {
  	struct device *next;
  	struct pci_dev *dev;
  	unsigned int config_cnt;
  	u8 config[256];
};

static struct device *first_dev;

static struct device *scan_device(struct pci_dev *p)
{
  	int how_much = 64;
  	struct device *d;

  	if (!pci_filter_match(&filter, p))
    		return NULL;
  	d = malloc(sizeof(struct device));
  	bzero(d, sizeof(*d));
  	d->dev = p;
  	if (!pci_read_block(p, 0, d->config, how_much))
    		exit(1);
  	if (how_much < 128 && (d->config[PCI_HEADER_TYPE] & 0x7f) == PCI_HEADER_TYPE_CARDBUS) {
      		/* For cardbus bridges, we need to fetch 64 bytes more to get the full standard header... */
      		if (!pci_read_block(p, 64, d->config+64, 64))
        		exit(1);
      		how_much = 128;
    	}
  	d->config_cnt = how_much;
  	pci_setup_cache(p, d->config, d->config_cnt);
  	pci_fill_info(p, PCI_FILL_IDENT);
  	return d;
}

static void scan_devices(void)
{
  	struct device *d;
  	struct pci_dev *p;

  	pci_scan_bus(pacc);
  	for(p=pacc->devices; p; p=p->next)
    	if ((d = scan_device(p))) {
        	d->next = first_dev;
        	first_dev = d;
      	}
}

static u16 get_conf_word(struct device *d, unsigned int pos)
{
  	return d->config[pos] | (d->config[pos+1] << 8);
}

int pci_find_by_class(u16 *class, char *vendor, char *device)
{
	struct device *d;
	struct pci_dev *p;
	int nomatch = 1;

	pacc = pci_alloc();
	pci_filter_init(pacc, &filter);
	pci_init(pacc);
	scan_devices();

	for(d=first_dev; d; d=d->next) {
    		p = d->dev;
    		/* Acquire vendor & device ID if the class matches */
    		if(get_conf_word(d, PCI_CLASS_DEVICE) == *class) {
      			nomatch = 0;
			snprintf(vendor,7,"%04x",p->vendor_id);
			snprintf(device,7,"%04x",p->device_id);
      			break;
    		}
  	}

  	pci_cleanup(pacc);
  	return nomatch;
}

void pci_find_fullname(char *fullname, char *vendor, char *device)
{
	char buffer[bsize];
	char vendorname[bsize/2] = "";
	char devicename[bsize/2] = "";
	char *position;
	int cardfound = 0;

	sysinfo_get_pciids (buffer);
	FILE *fp = fopen (buffer, "r");

	if(fp == NULL) {
		snprintf(fullname, bsize, "%s:%s", vendor, device);
		sysinfo_print_error ("pci.ids file not found! You might want to adjust your pciids setting with /SYSINFO SET pciids (you can query its current value with /SYSINFO LIST).\n");
		return;
	}

	while(fgets(buffer, bsize, fp) != NULL)	{
		if (!isspace(buffer[0]) && strstr(buffer, vendor) != NULL) {
                       	position = strstr(buffer, vendor);
                       	position += 6;
                       	strncpy(vendorname, position, bsize/2);
                       	position = strstr(vendorname, "\n");
                       	*(position) = '\0';
			break;
                }
	}
	while(fgets(buffer, bsize, fp) != NULL) {
		if(strstr(buffer, device) != NULL) {
                        position = strstr(buffer, device);
                        position += 6;
                        strncpy(devicename, position, bsize/2);
			position = strstr(devicename, " (");
			if (position == NULL)
                        	position = strstr(devicename, "\n");
                        *(position) = '\0';
			cardfound = 1;
			break;
 		}
	}
	if (cardfound == 1)
		snprintf(fullname, bsize, "%s %s", vendorname, devicename);
	else
		snprintf(fullname, bsize, "%s:%s", vendor, device);	
	fclose(fp);
}