当前位置: 首页>>代码示例>>Golang>>正文


Golang Line.Copy方法代码示例

本文整理汇总了Golang中github.com/fluffle/goirc/client.Line.Copy方法的典型用法代码示例。如果您正苦于以下问题:Golang Line.Copy方法的具体用法?Golang Line.Copy怎么用?Golang Line.Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/fluffle/goirc/client.Line的用法示例。


在下文中一共展示了Line.Copy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: handleRegexp

func (self *Module) handleRegexp(eventMode Event, trigger string, line *irc.Line) {
	self.reMut.RLock()
	defer self.reMut.RUnlock()

	for _, reM := range self.reTriggers[eventMode] {
		if reM.trigger.MatchString(trigger) {
			go reM.fn(line.Copy())
		}
	}
}
开发者ID:CrimsonVoid,项目名称:irclib,代码行数:10,代码来源:module.go

示例2: handleString

func (self *Module) handleString(eventMode Event, trigger string, line *irc.Line) {
	trigger = strings.ToLower(trigger)
	evT := eventTrigger{eventMode, trigger}

	self.stMut.RLock()
	defer self.stMut.RUnlock()

	for _, fn := range self.stTriggers[evT] {
		go fn(line.Copy())
	}
}
开发者ID:CrimsonVoid,项目名称:irclib,代码行数:11,代码来源:module.go

示例3: context

func context(conn *client.Conn, line *client.Line) *Context {
	ctx := &Context{conn: conn, Line: line.Copy(), rws: bot.rewriters}
	// This is a bit of a dirty hack; context() returns nil to ignore a line.
	// TODO(fluffle): Ignores based on masks (or more likely regex).
	if ctx.Nick != "" && conf.Ns(ignoreNs).String(strings.ToLower(ctx.Nick)) != "" {
		return nil
	}
	if ctx.Cmd != client.PRIVMSG {
		return ctx
	}
	ctx.Args[1], ctx.Addressed = util.RemovePrefixedNick(
		strings.TrimSpace(ctx.Args[1]), ctx.Me())
	// If we're being talked to in private, line.Args[0] will contain our Nick.
	// We should consider this as "addressing" us, and set Addressed = true
	if ctx.Args[0] == ctx.Me() {
		ctx.Addressed = true
	}
	return ctx
}
开发者ID:gundalow,项目名称:sp0rkle,代码行数:19,代码来源:context.go

示例4: transformLine

func transformLine(line *client.Line) *base.Line {
	// We want line.Args[1] to contain the (possibly) stripped version of itself
	// but modifying the pointer will result in other goroutines seeing the
	// change, so we need to copy line for our own edification.
	nl := &base.Line{Line: line.Copy()}
	if nl.Cmd != "PRIVMSG" {
		return nl
	}
	nl.Args[1], nl.Addressed = util.RemovePrefixedNick(
		strings.TrimSpace(line.Args[1]), irc.Me.Nick)
	// If we're being talked to in private, line.Args[0] will contain our Nick.
	// To ensure the replies go to the right place (without performing this
	// check everywhere) test for this and set line.Args[0] == line.Nick.
	// We should consider this as "addressing" us too, and set Addressed = true
	if nl.Args[0] == irc.Me.Nick {
		nl.Args[0] = nl.Nick
		nl.Addressed = true
	}
	return nl
}
开发者ID:pzsz,项目名称:sp0rkle,代码行数:20,代码来源:bot.go

示例5: bot_privmsg

// Do some standard processing on incoming lines and dispatch a bot_privmsg
func bot_privmsg(irc *client.Conn, line *client.Line) {
	bot := getState(irc)

	l, p := util.RemovePrefixedNick(strings.TrimSpace(line.Args[1]), irc.Me.Nick)
	// We want line.Args[1] to contain the (possibly) stripped version of itself
	// but modifying the pointer will result in other goroutines seeing the
	// change, so we need to copy line for our own edification.
	nl := &base.Line{Line: *line.Copy()}
	nl.Args[1] = l
	nl.Addressed = p
	// If we're being talked to in private, line.Args[0] will contain our Nick.
	// To ensure the replies go to the right place (without performing this
	// check everywhere) test for this and set line.Args[0] == line.Nick.
	// We should consider this as "addressing" us too, and set Addressed = true
	if nl.Args[0] == irc.Me.Nick {
		nl.Args[0] = nl.Nick
		nl.Addressed = true
	}
	bot.Dispatch("bot_privmsg", nl)
}
开发者ID:b33f,项目名称:sp0rkle,代码行数:21,代码来源:handlers.go


注:本文中的github.com/fluffle/goirc/client.Line.Copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。